From: Yann Michel <yann-postgresql@spline.de>
To: Litao Wu <litaowu@yahoo.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Why so much time difference with a same query/plan?
Date: Thu, 23 Dec 2004 08:04:53 +0100
Message-ID: <20041223070453.GA30031@zong.spline.inf.fu-berlin.de> (raw)
In-Reply-To: <20041222215240.12345.qmail@web13124.mail.yahoo.com>
References: <20041222200904.94015.qmail@web13124.mail.yahoo.com>
<20041222215240.12345.qmail@web13124.mail.yahoo.com>
Hi,
On Wed, Dec 22, 2004 at 01:52:40PM -0800, Litao Wu wrote:
> Does the order of columns in the index matter since
> more than 50% customer_id = 158?
>
> I think it does not in Oracle.
>
> Will the performance be better if I change index
> xxx_idx to ("domain", customer_id, created)?
Well, in Oracle this would of cause matter. Oracle calculates index
usage by being able to fill all index's attributes from the left to the
right. If any one attribute within is missing Oracle would not test if
it is only one attribute missing, or if all other attributes are missing
within the query's where clause.
Normaly you'd create an index using the most frequently parametrized
attributes first, then the second ones and so on. If the usage isn't
that different, you would use the most granule attribute in foremost
followed by the second and so on.
Regards,
Yann
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: yann-postgresql@spline.de, litaowu@yahoo.com
Subject: Re: Why so much time difference with a same query/plan?
In-Reply-To: <20041223070453.GA30031@zong.spline.inf.fu-berlin.de>
References: <20041222200904.94015.qmail@web13124.mail.yahoo.com> <20041222215240.12345.qmail@web13124.mail.yahoo.com> <20041223070453.GA30031@zong.spline.inf.fu-berlin.de>
* 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