pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Matthew Wakeling <matthew@flymine.org>
To: pgsql-performance@postgresql.org
Subject: Re: limit clause breaks query planner?
Date: Thu, 4 Sep 2008 16:50:00 +0100 (BST)
Message-ID: <alpine.DEB.1.10.0809041646340.4454@aragorn.flymine.org> (raw)
In-Reply-To: <23341.1220542340@sss.pgh.pa.us>
References: <48BD33B2.D078.0028.0@rentrak.com>
	<48BD33B2.D078.0028.0@rentrak.com>
	<5925.1220389248@sss.pgh.pa.us>
	<48BF195E.D078.0028.0@rentrak.com>
	<23341.1220542340@sss.pgh.pa.us>

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



view thread (26+ messages)  latest in thread

Message-ID: <alpine.DEB.1.10.0809041646340.4454@aragorn.flymine.org>
Permalink:  ../alpine.DEB.1.10.0809041646340.4454@aragorn.flymine.org/
Also on:    postgresql.org/message-id/alpine.DEB.1.10.0809041646340.4454@aragorn.flymine.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: matthew@flymine.org
  Subject: Re: limit clause breaks query planner?
  In-Reply-To: <alpine.DEB.1.10.0809041646340.4454@aragorn.flymine.org>
  References: <48BD33B2.D078.0028.0@rentrak.com> <5925.1220389248@sss.pgh.pa.us> <48BF195E.D078.0028.0@rentrak.com> <23341.1220542340@sss.pgh.pa.us> <alpine.DEB.1.10.0809041646340.4454@aragorn.flymine.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox