From: | Michael Glaesemann <grzm(at)seespotcode(dot)net> |
---|---|
To: | Nis Jørgensen <nis(at)superlativ(dot)dk> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: timestamp interval issue |
Date: | 2007-10-08 13:37:19 |
Message-ID: | 0FA3DD0A-3BA9-4F70-A2B1-5C3A7BAE39A8@seespotcode.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On Oct 8, 2007, at 6:14 , Nis Jørgensen wrote:
> Nis Jørgensen skrev:
>> SELECT *
>> FROM footable0
>> WHERE (date_created - interval '16 hours')::date = (now() -
>> interval '16
>> hours')::date;
>>
>> Tested.
>
> Unfortunately, the performance is horrible - it is using a seqscan.
You can create a functional index to improve performance here,
something like
create index rectified_created_at_idx on mytable (cast (created_at -
interval '16 hours') to date);
I haven't thought it through, but you may run into issues with time
zones -- this is not particular to this solution however.
Michael Glaesemann
grzm seespotcode net
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2007-10-08 20:46:26 | Re: PG on NFS may be just a bad idea |
Previous Message | Nis Jørgensen | 2007-10-08 11:14:59 | Re: timestamp interval issue |