pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl>
Cc: pgsql-performance@postgresql.org
Subject: Re: Why the difference in plans ??
Date: Fri, 15 Sep 2006 10:08:35 -0400
Message-ID: <24190.1158329315@sss.pgh.pa.us> (raw)
In-Reply-To: <1158309566.30482.29.camel@panoramix>
References: <1158309566.30482.29.camel@panoramix>

"Joost Kraaijeveld" <J.Kraaijeveld@Askesis.nl> writes:
> Why the difference and can I influence the result so that the first
> query plan (which is the fastest) is actually used in both cases (I
> would expect that the limit would be done after the sort?)? 

It likes the second plan because 6694025.41/353 < 41812.78.  It would
probably be right, too, if the number of matching rows were indeed 353,
but it seems there are only 7.  Try increasing your statistics target
and re-analyzing.

			regards, tom lane



view thread (13+ messages)  latest in thread

Message-ID: <24190.1158329315@sss.pgh.pa.us>
Permalink:  ../24190.1158329315@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/24190.1158329315@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, J.Kraaijeveld@Askesis.nl
  Subject: Re: Why the difference in plans ??
  In-Reply-To: <24190.1158329315@sss.pgh.pa.us>

* 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