From: Tom Lane <tgl@sss.pgh.pa.us>
To: Sean Chittenden <sean@chittenden.org>
Cc: scott.marlowe <scott.marlowe@ihs.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Moving postgresql.conf tunables into 2003...
Date: Thu, 03 Jul 2003 21:57:35 -0400
Message-ID: <10560.1057283855@sss.pgh.pa.us> (raw)
In-Reply-To: <20030703232351.GS72567@perrin.int.nxad.com>
References: <20030703190502.GR72567@perrin.int.nxad.com>
<Pine.LNX.4.33.0307031405180.22660-100000@css120.ihs.com>
<20030703232351.GS72567@perrin.int.nxad.com>
Sean Chittenden <sean@chittenden.org> writes:
> Getting the planner to pick
> using the index to filter out data inserted in the last 3 days over
> doing a seq scan... well, I don't know how you could do that without
> changing the random_page_cost.
This sounds a *whole* lot like a correlation issue. If the data in
question were scattered randomly in the table, it's likely that an
indexscan would be a loser. The recently-inserted data is probably
clustered near the end of the table (especially if they're doing VACUUM
FULL after data purges; are they?). But the planner's correlation stats
are much too crude to recognize that situation, if the rest of the table
is not well-ordered.
If their typical process involves a periodic data purge and then a
VACUUM FULL, it might be worth experimenting with doing a CLUSTER on the
timestamp index instead of the VACUUM FULL. The CLUSTER would reclaim
space as effectively as VACUUM FULL + REINDEX, and it would leave the
table with an unmistakable 1.0 correlation ... which should tilt the
planner towards an indexscan without needing a physically impossible
random_page_cost to do it. I think CLUSTER would probably be a little
slower than VACUUM FULL but it's hard to be sure without trying.
regards, tom lane
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, sean@chittenden.org, scott.marlowe@ihs.com
Subject: Re: Moving postgresql.conf tunables into 2003...
In-Reply-To: <10560.1057283855@sss.pgh.pa.us>
References: <20030703190502.GR72567@perrin.int.nxad.com> <Pine.LNX.4.33.0307031405180.22660-100000@css120.ihs.com> <20030703232351.GS72567@perrin.int.nxad.com> <10560.1057283855@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