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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: jacob(at)aers(dot)ca
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: FW: Query length limitation in postgres server > 8.2.9
Date: 2009-07-09 18:28:59
Message-ID: 4289.1247164139@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

<jacob(at)aers(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message jacob 2009-07-09 18:33:09 Re: FW: Query length limitation in postgres server > 8.2.9
Previous Message jacob 2009-07-09 18:20:27 Re: FW: Query length limitation in postgres server > 8.2.9