From: Nick Fankhauser <nickf@ontko.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: A plan returned by explain doesn't make sense to me
Date: Fri, 5 Apr 2002 12:01:42 -0500
Message-ID: <NEBBLAAHGLEEPCGOBHDGAEGEELAA.nickf@ontko.com> (raw)
In-Reply-To: <24798.1018025136@sss.pgh.pa.us>
Tom Lane wrote:
> The only reason the planner should choose a single-column index over
> using the first column of a multi-column index is that the latter index
> is likely to be physically larger and thus require more I/O to access.
> So, there's no penalty in the cost calculations other than the
> number-of-blocks-of-I/O estimated from the physical index size.
So is a multi-column index really just two separate indexes with a
constraint added if necessary? I guess I had an idea in my head that it
would be something like an index on the concatenation of the two fields.
> It
> would be interesting to see the reltuples and relpages stats from
> pg_class for your single- and multi-column indexes.
It's easy to reverse the process. How would I get those stats?
> It's actually a standard recommendation that you not bother with an
> index on a single column x if you also have one on (x,y).
Thanks- that will make my app a bit more efficient. (But now I've got to go
back & work on tuning my query again because this apparently wasn't the
source of the poor performance.)
-Nick
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-admin@postgresql.org
Cc: nickf@ontko.com, tgl@sss.pgh.pa.us
Subject: Re: A plan returned by explain doesn't make sense to me
In-Reply-To: <NEBBLAAHGLEEPCGOBHDGAEGEELAA.nickf@ontko.com>
References: <24798.1018025136@sss.pgh.pa.us> <NEBBLAAHGLEEPCGOBHDGAEGEELAA.nickf@ontko.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