expression index on date_trunc

Поиск
Список
Период
Сортировка
От a.redhead@openinternetsolutions.com
Тема expression index on date_trunc
Дата
Msg-id 17486740.1457461201727173140.JavaMail.servlet@kundenserver
обсуждение исходный текст
Ответы Re: expression index on date_trunc  ("Daniel Verite" <daniel@manitou-mail.org>)
Re: expression index on date_trunc  (Gregory Stark <stark@enterprisedb.com>)
Список pgsql-general
Hi,

is is possible to create an expression index based on the date_trunc function?

Working with PostgreSQL 8.2, I'm trying to create an index using:

  CREATE INDEX request_day_idx ON moksha_sm_request (date_trunc('day', request_received));

I get the error message:

  ERROR: functions in index expression must be marked IMMUTABLE
  SQL state: 42P17

I'd like to use the index to speed up a query that does a "group by" on the day part of a timestamp to lump all the
stuffthat happens in the same day together (I have a timestamp because the information in the table is coming from an
appserverlogfile and the date/time component of each line provides a full timestamptz (always the same tz!)). 

I'd be grateful if someone could point out what part of the statement is not IMMUTABLE or how I could mark my create
indexstatement as being immutable. 

Thanks,

Andy

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

Предыдущее
От: Tom Hart
Дата:
Сообщение: Re: postgresql book - practical or something newer?
Следующее
От: Tom Hart
Дата:
Сообщение: Mailing list archives/docs project