Re: sub-select in IN clause results in sequential scan - Mailing list pgsql-performance

From Grzegorz Jaśkiewicz
Subject Re: sub-select in IN clause results in sequential scan
Date
Msg-id 2f4958ff0910290254j567c46ffkcdf3f83b78a521f6@mail.gmail.com
Whole thread Raw
In response to sub-select in IN clause results in sequential scan  (Anj Adu <fotographs@gmail.com>)
Responses Re: sub-select in IN clause results in sequential scan  (Angayarkanni <kangayarkanni@gmail.com>)
List pgsql-performance


On Wed, Oct 28, 2009 at 6:13 PM, Anj Adu <fotographs@gmail.com> wrote:
Postgres consistently does a sequential scan on the child partitions
for this query

select * from partitioned_table
where partitioned_column > current_timestamp - interval 8 days
where x in (select yy from z where colname like 'aaa%')

If I replace the query with

select * from partitioned_table
where partitioned_column > current_timestamp - interval 8 days
where x in (hardcode_value)

The results are in line with expectation (very fast and uses a Bitmap
Index Scan on the column X)
\

use JOIN luke..
 

--
GJ

pgsql-performance by date:

Previous
From: Anj Adu
Date:
Subject: sub-select in IN clause results in sequential scan
Next
From: Angayarkanni
Date:
Subject: Re: sub-select in IN clause results in sequential scan