From: John Siracusa <siracusa@mindspring.com>
To: Postgres Performance <pgsql-performance@postgresql.org>
Subject: Re: Column correlation drifts, index ignored again
Date: Sun, 22 Feb 2004 17:34:47 -0500
Message-ID: <BC5E98B7.2DCB2%siracusa@mindspring.com> (raw)
In-Reply-To: <18941.1077487618@sss.pgh.pa.us>
On 2/22/04 5:06 PM, Tom Lane wrote:
> John Siracusa <siracusa@mindspring.com> writes:
>> I want to do something that will convince Postgres that using the date
>> index is, by far, the best plan when running my queries, even when the
>> date column correlation stat drops well below 1.0.
>
> Have you tried experimenting with random_page_cost? Seems like your
> results suggest that you need to lower it.
I don't want to do anything that "universal" if I can help it, because I
don't want to adversely affect any other queries that the planner currently
aces.
I'm guessing that the reason using the date index is always so much faster
is that doing so only reads the rows in the date range (say, 1,000 of them)
instead of reading every single row in the table (1,000,000) as in a seqscan
plan.
I think the key is to get the planner to correctly ballpark the number of
rows in the date range. If it does, I can't imagine it ever deciding to
read 1,000,000 rows instead of 1,000 with any sane "cost" setting. I'm
assuming the defaults are sane :)
-John
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: siracusa@mindspring.com
Subject: Re: Column correlation drifts, index ignored again
In-Reply-To: <BC5E98B7.2DCB2%siracusa@mindspring.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