From: Tom Lane <tgl@sss.pgh.pa.us>
To: Mike Winter <mike.winter@frontlogic.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Efficiency Issue with "SELECT IN (..)" and "SELECT .. OR .."
Date: Fri, 16 May 2003 15:25:22 -0400
Message-ID: <29030.1053113122@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.LNX.4.33L2.0305151524590.6984-100000@frontlogic.com>
References: <Pine.LNX.4.33L2.0305151524590.6984-100000@frontlogic.com>
Mike Winter <mike.winter@frontlogic.com> writes:
> If the "IN (1, 2, 3, 6, ..., n)" clause is big enough, the
> database will actually throw an error saying "Recursive Depth
> Exceeded" or something similar and not complete the query.
Would it perhaps be saying "out of free buffers: time to abort!" ?
If so, you're probably running into this bug, which was introduced
(by me :-() in 7.3:
http://archives.postgresql.org/pgsql-hackers/2003-03/msg00939.php
There is a fix in place for 7.3.3.
> It looks to me like the query parser is recursively calling
> an index scan for each row in the 'IN' clause rather than just
> doing one index scan that it seems it should be.
It is performing one index search per target value, yes, but not
recursively. That's what it's supposed to do.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, mike.winter@frontlogic.com
Subject: Re: Efficiency Issue with "SELECT IN (..)" and "SELECT .. OR .."
In-Reply-To: <29030.1053113122@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox