Skip site navigation (1) Skip section navigation (2)

Re: Why so much time difference with a same query/plan?

From: Yann Michel <yann-postgresql(at)spline(dot)de>
To: Litao Wu <litaowu(at)yahoo(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Why so much time difference with a same query/plan?
Date: 2004-12-23 07:04:53
Message-ID: 20041223070453.GA30031@zong.spline.inf.fu-berlin.de (view raw or flat)
Thread:
Lists: pgsql-performance
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

In response to

Responses

pgsql-performance by date

Next:From: AlexDate: 2004-12-23 14:27:15
Subject: Some Performance Advice Needed
Previous:From: Mario WeilguniDate: 2004-12-23 07:00:41
Subject: Re: 8rc2 & BLCKSZ

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group