Re: Multicolumn Indexes - Mailing list pgsql-general

From Tom Lane
Subject Re: Multicolumn Indexes
Date
Msg-id 11530.1097863054@sss.pgh.pa.us
Whole thread Raw
In response to Multicolumn Indexes  ("Thomas Yagel" <tyagel@yahoo.com>)
List pgsql-general
"Thomas Yagel" <tyagel@yahoo.com> writes:
> Right now the index that I have on timestamp is not used because the Primary
> Key(ID) index is chosen for ordering.  If I place a multicolumn index on
> (timestamp, id) will that index be able to filter the timestamp and still be
> used for returning the ordered IDs?

You'd need to do that and also say "ORDER BY timestamp, id" not just
"ORDER BY id".

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Changing session ownership in a web app (or how to peel an onion)
Next
From: snpe
Date:
Subject: pgsql cvs