Re: Unexpected sequential scan on an indexed column

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Eddy Escardo-Raffo <eescardo(at)kikini(dot)com>
Cc: pgsql-performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Unexpected sequential scan on an indexed column
Date: 2009-11-16 01:23:19
Message-ID: 28141.1258334599@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Eddy Escardo-Raffo <eescardo(at)kikini(dot)com> writes:
> For C, the planner estimated 10 thousand rows. For D, the planner estimated
> 100 thousand rows, yet for E the planner estimated only 1 row, which is the
> closest to reality. So, is there any way to specify a query that has a
> SUB-SELECT that returns a small set of values so that the planner treats it
> similar to how it treats statement E, or does statement E get its additional
> edge precisely from the fact that the restriction is defined by integer
> literals?

Currently there is no attempt to look at the exact contents of a VALUES
construct for planning purposes. For the examples you're showing it
seems like the IN (list) notation is more compact and more widely used,
so improving the VALUES alternative doesn't seem that exciting.

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Laurent Laborde 2009-11-16 09:00:56 Re: limiting performance impact of wal archiving.
Previous Message Eddy Escardo-Raffo 2009-11-16 01:06:26 Re: Unexpected sequential scan on an indexed column