Re: Question on a select - Mailing list pgsql-general

From Pierre-Frédéric Caillaud
Subject Re: Question on a select
Date
Msg-id opsjzfejkwcq72hf@musicbox
Whole thread Raw
In response to Re: Question on a select  (Madison Kelly <linux@alteeve.com>)
List pgsql-general

>    I didn't realize that the order made a difference. A sign of how much
> learning I need to do. :p For reference, I think 'file_parent_dir' and
> 'fs_parent_dir' are the most important because I do an 'ORDER BY
> [fs|file]_parent_dir ASC' on most queries. I've made the changes, thank
> you again!

    If you SELECT ... WHERE condition on A order by B :

an index on A will be used, but an index on B won't

    If you SELECT ... WHERE condition on A order by A, B :

an index on A,B will be used because it will give the rows in already
sorted order

pgsql-general by date:

Previous
From: "C. Duncan Hudson"
Date:
Subject: Shared Sequences?
Next
From: Andreas Kretschmer
Date:
Subject: Re: Shared Sequences?