sub-select in IN clause results in sequential scan

From: Anj Adu <fotographs(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: sub-select in IN clause results in sequential scan
Date: 2009-10-28 18:13:42
Message-ID: f2fd819a0910281113k1d122905h4118f4719a24cce7@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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)

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Grzegorz Jaśkiewicz 2009-10-29 09:54:02 Re: sub-select in IN clause results in sequential scan
Previous Message Dave Dutcher 2009-10-28 17:23:18 Re: Postgresql optimisation