Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-performance by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group