Re: Question on a select

From: Pierre-Frédéric Caillaud <lists(at)boutiquenumerique(dot)com>
To: "Madison Kelly" <linux(at)alteeve(dot)com>, "PgSQL General List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Question on a select
Date: 2005-01-02 15:45:45
Message-ID: opsjzfejkwcq72hf@musicbox
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Kretschmer 2005-01-02 16:06:44 Re: Shared Sequences?
Previous Message C. Duncan Hudson 2005-01-02 15:44:16 Shared Sequences?