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

Re: sub-select in IN clause results in sequential scan

From: Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>
To: Anj Adu <fotographs(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: sub-select in IN clause results in sequential scan
Date: 2009-10-29 09:54:02
Message-ID: 2f4958ff0910290254j567c46ffkcdf3f83b78a521f6@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-performance
On Wed, Oct 28, 2009 at 6:13 PM, Anj Adu <fotographs(at)gmail(dot)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

In response to

Responses

pgsql-performance by date

Next:From: AngayarkanniDate: 2009-10-29 10:32:38
Subject: Re: sub-select in IN clause results in sequential scan
Previous:From: Anj AduDate: 2009-10-28 18:13:42
Subject: sub-select in IN clause results in sequential scan

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