pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jim C. Nasby <decibel@decibel.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: John Meinel <john@johnmeinel.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Sequential Scan with LIMIT
Date: Thu, 28 Oct 2004 18:46:58 -0500
Message-ID: <20041028234658.GI55164@decibel.org> (raw)
In-Reply-To: <17689.1098648713@sss.pgh.pa.us>
References: <417C023F.1080502@johnmeinel.com>
	<17689.1098648713@sss.pgh.pa.us>

On Sun, Oct 24, 2004 at 04:11:53PM -0400, Tom Lane wrote:
> But the LIMIT will cut the cost of the seqscan case too.  Given the
> numbers you posit above, about one row in five will have 'myval', so a
> seqscan can reasonably expect to hit the first matching row in the first
> page of the table.  This is still cheaper than doing an index scan
> (which must require reading at least one index page plus at least one
> table page).
> 
> The test case you are showing is probably suffering from nonrandom
> placement of this particular data value; which is something that the
> statistics we keep are too crude to detect.
 
Isn't that exactly what pg_stats.correlation is?
-- 
Jim C. Nasby, Database Consultant               decibel@decibel.org 
Give your computer some brain candy! www.distributed.net Team #1828

Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"



view thread (13+ messages)  latest in thread

Message-ID: <20041028234658.GI55164@decibel.org>
Permalink:  ../20041028234658.GI55164@decibel.org/
Also on:    postgresql.org/message-id/20041028234658.GI55164@decibel.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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: decibel@decibel.org, tgl@sss.pgh.pa.us, john@johnmeinel.com
  Subject: Re: Sequential Scan with LIMIT
  In-Reply-To: <20041028234658.GI55164@decibel.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