Re: Index on timestamp fields

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Index on timestamp fields
Дата
Msg-id 11650.1181266111@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Index on timestamp fields  (David Gardner <David.Gardner@yucaipaco.com>)
Ответы Re: Index on timestamp fields  (David Gardner <David.Gardner@yucaipaco.com>)
Список pgsql-novice
David Gardner <David.Gardner@yucaipaco.com> writes:
> I have a timestamp without timezone field in one of my tables that is used =
> in the where clause of one of my queries:
> WHERE date_trunc('day',"backupReports"."start") = current_date

If you can change the query, it'd be better/more efficient to spell this
as
    WHERE "backupReports"."start"::date = current_date

Either way, you need to build an index on the expression, not just the
raw column, to make this search fast.

            regards, tom lane

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

Предыдущее
От: David Gardner
Дата:
Сообщение: Index on timestamp fields
Следующее
От: Richard Broersma Jr
Дата:
Сообщение: Re: Index on timestamp fields