Re: index usage in multi-column ORDER BY

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Adam Pritchard <vesper76(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: index usage in multi-column ORDER BY
Date: 2005-07-09 13:49:04
Message-ID: 20050709134903.GA36703@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Jul 08, 2005 at 10:06:23AM -0700, Adam Pritchard wrote:
> Why aren't two single-column indexes used in a two-column ORDER BY
> clause? And is there some way to work around this?
>
> For example:
> CREATE TABLE t ( c1 INT, c2 INT );
> CREATE INDEX c1_idx ON t(c2);
^^^^
> CREATE INDEX c2_idx ON t(c2);

Not that it changes anything, but I assume you meant to create the
first index on c1. I'll defer an explanation of the sequential
scan behavior to somebody who understands the planner better.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adam Pritchard 2005-07-09 14:09:08 Re: index usage in multi-column ORDER BY
Previous Message Michael Fuhr 2005-07-09 13:02:40 Re: Transaction isolation levels