Re: SQL help for efficient time handling.. - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: SQL help for efficient time handling..
Date
Msg-id 20030322081350.R1246-100000@megazone23.bigpanda.com
Whole thread Raw
In response to SQL help for efficient time handling..  (Rajesh Kumar Mallah <mallah@trade-india.com>)
Responses Re: SQL help for efficient time handling..  (<mallah@trade-india.com>)
List pgsql-sql
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);



pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: ALTER TABLE does not raises WARNING/ERROR
Next
From:
Date:
Subject: Re: SQL help for efficient time handling..