pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Simon Riggs <simon@2ndquadrant.com>
Cc: Karim A Nassar <Karim.Nassar@NAU.EDU>
Cc: Stephan Szabo <sszabo@megazone.bigpanda.com>
Cc: Christopher Kings-Lynne <chriskl@familyhealth.com.au>
Cc: pgsql-performance@postgresql.org
Subject: Re: Delete query takes exorbitant amount of time
Date: Tue, 29 Mar 2005 12:31:49 -0500
Message-ID: <3340.1112117509@sss.pgh.pa.us> (raw)
In-Reply-To: <1112116665.11750.1017.camel@localhost.localdomain>
References: <Pine.SOL.4.21.0503290120550.5642-100000@coruscant.cet.nau.edu>
	<1112095776.11750.958.camel@localhost.localdomain>
	<21461.1112107257@sss.pgh.pa.us>
	<1112116665.11750.1017.camel@localhost.localdomain>

Simon Riggs <simon@2ndquadrant.com> writes:
> That implies to me that LIMIT queries are not considered correctly in
> the M&L formula and thus we are more likely to calculate a too-high cost
> for using an index in those circumstances....and thus more likely to
> SeqScan for medium sized relations?

You misunderstand how LIMIT is handled.  The plan structure is

	LIMIT ...
		regular plan ...

and so the strategy is to plan and cost the regular plan as though it
would be carried out in full, and then take an appropriate fraction
of that at the LIMIT stage.

			regards, tom lane



view thread (60+ messages)  latest in thread

Message-ID: <3340.1112117509@sss.pgh.pa.us>
Permalink:  ../3340.1112117509@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3340.1112117509@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, simon@2ndquadrant.com, Karim.Nassar@NAU.EDU, sszabo@megazone.bigpanda.com, chriskl@familyhealth.com.au
  Subject: Re: Delete query takes exorbitant amount of time
  In-Reply-To: <3340.1112117509@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