Re: FW: Query length limitation in postgres server > 8.2.9 - Mailing list pgsql-sql

From
Subject Re: FW: Query length limitation in postgres server > 8.2.9
Date
Msg-id 6B5AF6293A289F45826220B17ABE7937FDB1D3@BORON.aers.local
Whole thread Raw
In response to Re: FW: Query length limitation in postgres server > 8.2.9  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: FW: Query length limitation in postgres server > 8.2.9
List pgsql-sql
the data is insert once, read many so we should be fine on that side.
I've past this on to the dev's and I'll let you know when I get feed
back. Thanks for your input Tom (and the others).

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Thursday, July 09, 2009 11:29 AM
To: Jacob Bresciani
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] FW: Query length limitation in postgres server >
8.2.9

<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 by date:

Previous
From: Tom Lane
Date:
Subject: Re: FW: Query length limitation in postgres server > 8.2.9
Next
From: Tom Lane
Date:
Subject: Re: FW: Query length limitation in postgres server > 8.2.9