Re: timestamp interval issue

Поиск
Список
Период
Сортировка
От Michael Glaesemann
Тема Re: timestamp interval issue
Дата
Msg-id 0FA3DD0A-3BA9-4F70-A2B1-5C3A7BAE39A8@seespotcode.net
обсуждение исходный текст
Ответ на Re: timestamp interval issue  (Nis Jørgensen <nis@superlativ.dk>)
Список 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



В списке pgsql-novice по дате отправления:

Предыдущее
От: Nis Jørgensen
Дата:
Сообщение: Re: timestamp interval issue
Следующее
От: "Justin Vassallo"
Дата:
Сообщение: is my pgsql 32 or 64 bit?