From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jens Hartwig <jhartwig@debis.com>
Cc: PostgreSQL SQL <pgsql-sql@postgresql.org>
Subject: Re: Strange Execution-Plan for NOT EXISTS
Date: Mon, 08 Jan 2001 14:12:17 -0500
Message-ID: <18767.978981137@sss.pgh.pa.us> (raw)
In-Reply-To: <3A4B1C06.2A5C6C94@debis.com>
References: <3A4B1C06.2A5C6C94@debis.com>
Jens Hartwig <jhartwig@debis.com> writes:
> select (min(id) + 1)
> from t_dummy d1
> where not exists (
> select id
> from t_dummy d2
> where d2.id = (d1.id + 1)
> );
> Aggregate (cost=2924207.88..2924207.88 rows=1 width=12)
-> Seq Scan on t_dummy d1 (cost=0.00..2924207.88 rows=1 width=12)
> SubPlan
> -> Seq Scan on t_dummy d2 (cost=0.00..331.36 rows=1 width=12)
> Why that? Wouldn´t it be possible to simple use the primary key index in
> the sub-query
I think that 7.0.* is too stupid to consider an indexscan for a
qualifier that looks like "indexvar = ($1 + 1)", which is what you
effectively have in this case ($1 being the Param passed in from
the outer plan). It only recognizes "indexvar = constant" and
"indexvar = param" as indexable expressions. Current sources do
better.
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, jhartwig@debis.com
Subject: Re: Strange Execution-Plan for NOT EXISTS
In-Reply-To: <18767.978981137@sss.pgh.pa.us>
References: <3A4B1C06.2A5C6C94@debis.com> <18767.978981137@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