Re: Sequential Scan with LIMIT - Mailing list pgsql-performance

From Jim C. Nasby
Subject Re: Sequential Scan with LIMIT
Date
Msg-id 20041028234658.GI55164@decibel.org
Whole thread Raw
In response to Re: Sequential Scan with LIMIT  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Sequential Scan with LIMIT
List pgsql-performance
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?"

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: Performance Anomalies in 7.4.5
Next
From: Tom Lane
Date:
Subject: Re: Sequential Scan with LIMIT