Re: FW: Query length limitation in postgres server > 8.2.9

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: FW: Query length limitation in postgres server > 8.2.9
Дата
Msg-id 4289.1247164139@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: FW: Query length limitation in postgres server > 8.2.9  (<jacob@aers.ca>)
Ответы Re: FW: Query length limitation in postgres server > 8.2.9  (<jacob@aers.ca>)
Список pgsql-sql
<jacob@aers.ca> writes:
> leaf_category_1     

Ah.  So you are wishing it would use this index:
   "search_site1_2009_03_13_leaf_category_1" btree (leaf_category_1,
site_id) WHERE leaf_category_1 IS NOT NULL

If I were you I'd drop the WHERE clause, which is eliminating no index
entries whatsoever (since the column is actually declared not null).
What it is doing is forcing the planner to expend many cycles proving
that the query's WHERE clause requires leaf_category_1 to be non-null
hence the index is potentially usable.  The reason recent releases
are giving you trouble is that we put a limit on how many cycles we'd
expend on such silliness.

If you really don't want to change the schema, you could work around
the issue by adding a separate "leaf_category_1 IS NOT NULL" test to
the query, so that the planner can prove the index is relevant without
having to grovel through hundreds of IN-list items to do it.

In general, this table schema looks like somebody has drastically
overengineered the index definitions with rather little understanding
of what they were doing or what the performance consequences would be.
I hope the table is read-mostly, because you're paying a *lot* anytime
you update those indexes.
        regards, tom lane


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

Предыдущее
От:
Дата:
Сообщение: Re: FW: Query length limitation in postgres server > 8.2.9
Следующее
От:
Дата:
Сообщение: Re: FW: Query length limitation in postgres server > 8.2.9