Re: Optimize date query for large child tables: GiST or GIN?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Optimize date query for large child tables: GiST or GIN?
Дата
Msg-id 3387.1274363810@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Optimize date query for large child tables: GiST or GIN?  (Matthew Wakeling <matthew@flymine.org>)
Ответы Re: Optimize date query for large child tables: GiST or GIN?  (David Jarvis <thangalin@gmail.com>)
Список pgsql-performance
Matthew Wakeling <matthew@flymine.org> writes:
> On Wed, 19 May 2010, David Jarvis wrote:
>> extract( YEAR FROM m.taken ) BETWEEN 1900 AND 2009 AND

> That portion of the WHERE clause cannot use an index on m.taken. Postgres
> does not look inside functions (like extract) to see if something
> indexable is present. To get an index to work, you could create an index
> on (extract(YEAR FROM m.taken)).

What you really need to do is not do date arithmetic using text-string
operations.  The planner has no intelligence about that whatsoever.
Convert the operations to something natural using real date or timestamp
types, and then look at what indexes you need.

            regards, tom lane

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

Предыдущее
От: Matthew Wakeling
Дата:
Сообщение: Re: Optimize date query for large child tables: GiST or GIN?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: merge join killing performance