Re: BUG #7591: Large query string has limit

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pking(at)nrcan(dot)gc(dot)ca
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #7591: Large query string has limit
Date: 2012-10-09 18:34:27
Message-ID: 2282.1349807667@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

pking(at)nrcan(dot)gc(dot)ca writes:
> I am dealing with the open source program called "Geonetwork". It is passing
> the following query to postgres/postgis :

> SELECT "fid", asText("the_geom") FROM "public"."spatialindex" WHERE ("fid" =
> '10') OR ("fid" = '100') OR ("fid" = '1000') OR ("fid" = '10001') OR ("fid"
> = '10005') ..........

> Unfortunately, the query has > 50,000 OR clauses, and the query hangs.

[ rolls eyes ... ] You will not find a lot of DBMSes that don't have
indigestion with that. It's possible that converting to an IN list
would be less inefficient, but personally I'd suggesting putting all the
target IDs into a temp table and joining to that.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2012-10-09 18:38:15 Re: BUG #7590: Data corruption using pg_dump only with -Z parameter
Previous Message Tom Lane 2012-10-09 18:28:48 Re: BUG #7589: Canceled "CREATE UNIQUE INDEX CONCURRENTLY" leave not-fully-build index existing