pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dawid Kuroczko <qnex42@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org
Cc: pgsql-hackers@postgresql.org
Subject: Re: Planner doesn't look at LIMIT?
Date: Fri, 22 Jul 2005 22:48:58 +0200
Message-ID: <758d5e7f05072213486919c8f4@mail.gmail.com> (raw)
In-Reply-To: <6440.1122049220@sss.pgh.pa.us>
References: <758d5e7f0507220210bfa4978@mail.gmail.com>
	<29473.1122043197@sss.pgh.pa.us>
	<6440.1122049220@sss.pgh.pa.us>

On 7/22/05, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > This is quite strange.  The nestloop plan definitely should be preferred
> > in the context of the LIMIT, considering that it has far lower estimated
> > cost.  And it is preferred in simple tests for me.
> 
> After a suitable period of contemplating my navel, I figured out
> what is going on here: the total costs involved are large enough that
> the still-fairly-high startup cost of the hash is disregarded by
> compare_fuzzy_path_costs(), and so the nestloop is discarded as not
> having any significant potential advantage in startup time.
> 
> I think that this refutes the original scheme of using the same fuzz
> factor for both startup and total cost comparisons, and therefore
> propose the attached patch.
> 
> Comments?

Works great!!!

With LIMIT below 4 000 000 rows (its 47-milion row table) it prefers
nested loops, then it starts to introduce merge joins.

   Regards,
      Dawid



view thread (13+ messages)  latest in thread

Message-ID: <758d5e7f05072213486919c8f4@mail.gmail.com>
Permalink:  ../758d5e7f05072213486919c8f4@mail.gmail.com/
Also on:    postgresql.org/message-id/758d5e7f05072213486919c8f4@mail.gmail.com

 · 

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: qnex42@gmail.com, tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org
  Subject: Re: Planner doesn't look at LIMIT?
  In-Reply-To: <758d5e7f05072213486919c8f4@mail.gmail.com>

* 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