Re: Order by and index - Mailing list pgsql-novice

From Tom Lane
Subject Re: Order by and index
Date
Msg-id 18676.1128523806@sss.pgh.pa.us
Whole thread Raw
In response to Order by and index  (Jonathan Tse <dev@tsez.net>)
Responses Re: Order by and index  (Jonathan Tse <dev@tsez.net>)
List pgsql-novice
Jonathan Tse <dev@tsez.net> writes:
>     It is good. However, if I execute the following query:

>     select * from t_post where ownerid = 2
>     order by t_stamp

>     The query planner doesn't use the index for sorting.

Try "order by ownerid, t_stamp".

Postgres 8.1 will recognize that the where clause makes it OK to
consider the ORDER BY as matching the index order, but existing
releases do not know that.

            regards, tom lane

pgsql-novice by date:

Previous
From: "Daniel T. Staal"
Date:
Subject: Re: Missing file LIBC06P1
Next
From:
Date:
Subject: Re: Moving from MySQL