Re: is this a bug or do I not understand the query planner? - Mailing list pgsql-bugs

From Peter Eisentraut
Subject Re: is this a bug or do I not understand the query planner?
Date
Msg-id 200511040059.27965.peter_e@gmx.net
Whole thread Raw
In response to is this a bug or do I not understand the query planner?  (Rob Prowel <tempest766@yahoo.com>)
List pgsql-bugs
Rob Prowel wrote:
> two almost identical queries: one searches for
> read in ('N','n')
> and the other searches for
> read in ('Y','y').
>
> the (explain) SQL statement says that one uses the
> index on the (read) field and the other does a
> sequential table scan.  Why!!!????  I can think of no
> logical reason for this behavior.

Imagine a table with one million 'Y' and one 'N'.  Searching for the
first should not use an index, searching for the second should.  A
similar case probably applies here.  I hope that is logical enough for
you. :)

In general, if you disagree with a plan choice, you should provide
evidence that the chosen plan is in practice worse then the one you
would have preferred.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

pgsql-bugs by date:

Previous
From: "Qingqing Zhou"
Date:
Subject: Re: is this a bug or do I not understand the query planner?
Next
From: "Bernhard Weisshuhn"
Date:
Subject: BUG #2019: tsearch2-related coredump