From: Josh Berkus <josh@agliodbs.com>
To: Karl O. Pinc <kop@meme.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Poor index choice -- multiple indexes of the same columns
Date: Mon, 27 Jun 2005 15:37:41 -0700
Message-ID: <200506271537.41797.josh@agliodbs.com> (raw)
In-Reply-To: <1119913766l.4428l.2l@mofo>
References: <1119913766l.4428l.2l@mofo>
Karl,
> Seems to me that when there's a constant value in the query
> and an = comparision it will always be faster to use the (b-tree)
> index that's ordered first by the constant value, as then all further
> blocks are guarenteed to have a higher relevant information
> density. At least when compared with another index that has the
> same columns in it.
That really depends on the stats. Such a choice would *not* be
appropriate if the < comparison was expected to return 1- rows while the =
condition applied to 15% of the table.
What is your STATISTICS_TARGET for the relevant columns set to? When's
the last time you ran analyze? If this is all updated, you want to post
the pg_stats rows for the relevant columns?
--
--Josh
Josh Berkus
Aglio Database Solutions
San Francisco
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: josh@agliodbs.com, kop@meme.com
Subject: Re: Poor index choice -- multiple indexes of the same columns
In-Reply-To: <200506271537.41797.josh@agliodbs.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