Philip Warner <pjw(at)rhyme(dot)com(dot)au> writes:
> I am trying to understand some apparently odd behaviour with 7.2.1 and
> 7.2.3. Adding a LIMIT statement causes what seems like a very bad choice of
> strategy. The first statement is fine:
Could we see the pg_stats rows for the columns used in these queries?
(You have done a vacuum analyze recently, I trust...)
> If anyone could explain the likely reasons for the choice, I would be very
> interested. Even given the planner estimates, they don't look like sensible
> choices.
Why do you say that? It's taking a plan estimated at 777 cost units
over one that is estimated at (presumably) 5793 units.
regards, tom lane