From: Tom Lane <tgl@sss.pgh.pa.us>
To: Brad Might <bmight@storediq.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Specific query performance problem help requested - postgresql 7.4
Date: Thu, 26 May 2005 14:31:57 -0400
Message-ID: <4062.1117132317@sss.pgh.pa.us> (raw)
In-Reply-To: <E387E2E9622FDD408359F98BF183879E08DA5C@dc1.storediq.com>
References: <E387E2E9622FDD408359F98BF183879E08DA5C@dc1.storediq.com>
"Brad Might" <bmight@storediq.com> writes:
> Can someone help me break this down and figure out why the one query
> takes so much longer than the other?
It looks to me like there's a correlation between filename and bucket,
such that the indexscan in filename order takes much longer to run
across the first 25 rows with bucket = 3 than it does to run across
the first 25 with bucket = 7 or bucket = 8. It's not just a matter of
there being fewer rows with bucket = 3 ... the cost differential is much
larger than is explained by the count ratios. The bucket = 3 rows have
to be lurking further to the back of the filename order than the others.
> Here's the bucket distribution..i have clustered the index on the bucket
> value.
If you have an index on bucket, it's not doing you any good here anyway,
since you wrote the constraint as a crosstype operator ("3" is int4 not
int8). It might help to explicitly cast the constant to int8.
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, bmight@storediq.com
Subject: Re: Specific query performance problem help requested - postgresql 7.4
In-Reply-To: <4062.1117132317@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