Re: cannot use multicolumn index

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: MirrorX <mirrorx(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: cannot use multicolumn index
Date: 2011-09-19 02:37:44
Message-ID: CAOR=d=3iP-iVahZPS1O1-GAijo=0M_NMrdmM59kkT7Wh-Vgs_w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Wed, Sep 14, 2011 at 6:50 AM, MirrorX <mirrorx(at)gmail(dot)com> wrote:
> dear all,
>
> i have a table with (approx) 500.000.000 rows. it has several indexes, one
> of which is a multicolumn index
> for a column that has an id (integer) and a column that has a timestamp. i
> have read in the manual that the multicolumn index can be used only if the
> clauses of the query are in the same order as the columns of the index. so i
> am trying the following simple query ->

this is incorrect. Where did you read this? The order in the where
clause doesn't matter. Older versions of pg cannot use a muilticolumn
index unless you use the first column in the where clause / group by,
but newer versions can use that index, but since it's much less
efficient that way they will usually pick another index with the other
column in it first.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Scott Marlowe 2011-09-19 02:39:16 Re: cannot use multicolumn index
Previous Message Jeff Janes 2011-09-19 02:14:39 Re: Hash index use presently(?) discouraged since 2005: revive or bury it?