From: Kevin Sangalee <kevin@susa.net>
To: pgsql-sql@postgresql.org
Subject: Why is this sub-query select so slow?
Date: Wed, 4 Aug 1999 22:08:43 +0000
Message-ID: <199908042213.WAA25108@kakapo.susa.net> (raw)
I am querying across two tables, each of around 35000 records.
My sql is
select * from fieldcounts where prodnum in
(select prodnum from products where value < 150);
If I execute them individually, they return immediately. When I do an
explain, the fieldcounts is always accessed sequentially. It's accessed via
and Index Scan when I do...
select * from fieldcounts where prodnum in (65,66,45); for example
Why doesn't postgresql use an index scan when the subselect is a query?
Any ideas gratefully appreciated.
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: kevin@susa.net
Subject: Re: Why is this sub-query select so slow?
In-Reply-To: <199908042213.WAA25108@kakapo.susa.net>
References: <199908042213.WAA25108@kakapo.susa.net>
* 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