pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Rajesh Kumar Mallah <mallah@trade-india.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: SQL help for efficient time handling..
Date: Sat, 22 Mar 2003 08:17:19 -0800 (PST)
Message-ID: <20030322081350.R1246-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <200303221332.33121.mallah@trade-india.com>


On Sat, 22 Mar 2003, Rajesh Kumar Mallah wrote:

> To get current_time_id  i use a query like
> SELECT  time_id from time_dimension where sql_time=date_trunc('minute' , cast(now() as time without time zone) );
>
> it works but uses seq_scan
> Seq Scan on time_dimension  (cost=0.00..35.00 rows=5 width=4) (actual time=4.75..8.16 rows=1 loops=1)
>    Filter: ((sql_time)::interval = date_trunc('minute'::text, ((now())::time without time zone)::interval))
>  Total runtime: 8.20 msec

How about something like:

select time_id from time_dimension where sql_time=
 cast(date_trunc('minute', now()) as time);




view thread (6+ messages)  latest in thread

Message-ID: <20030322081350.R1246-100000@megazone23.bigpanda.com>
Permalink:  ../20030322081350.R1246-100000@megazone23.bigpanda.com/
Also on:    postgresql.org/message-id/20030322081350.R1246-100000@megazone23.bigpanda.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sszabo@megazone23.bigpanda.com, mallah@trade-india.com
  Subject: Re: SQL help for efficient time handling..
  In-Reply-To: <20030322081350.R1246-100000@megazone23.bigpanda.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox