Re: limit clause breaks query planner? - Mailing list pgsql-performance

From Matthew Wakeling
Subject Re: limit clause breaks query planner?
Date
Msg-id alpine.DEB.1.10.0809041646340.4454@aragorn.flymine.org
Whole thread Raw
In response to Re: limit clause breaks query planner?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: limit clause breaks query planner?
List pgsql-performance
On Thu, 4 Sep 2008, Tom Lane wrote:
> Ultimately the only way that we could get the right answer would be if
> the planner realized that the required rows are concentrated at the end
> of the table instead of being randomly scattered.  This isn't something
> that is considered at all right now in seqscan cost estimates.  I'm not
> sure offhand whether the existing correlation stats would be of use for
> it, or whether we'd have to get ANALYZE to gather additional data.

Using the correlation would help, I think, although it may not be the best
solution possible. At least, if the correlation is zero, you could behave
as currently, and if the correlation is 1, then you know (from the
histogram) where in the table the values are.

Matthew

--
X's book explains this very well, but, poor bloke, he did the Cambridge Maths
Tripos...                               -- Computer Science Lecturer

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: limit clause breaks query planner?
Next
From: Thomas Finneid
Date:
Subject: Re: Partitions number limitation ?