Re: Order by optimisations?

From: Hannu Krosing <hannu(at)skype(dot)net>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Order by optimisations?
Date: 2005-07-13 20:12:58
Message-ID: 1121285578.5551.0.camel@fuji.krosing.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On K, 2005-07-13 at 16:08 +0800, Christopher Kings-Lynne wrote:
> Hi,
>
> Does PostgreSQL do the following optimisation:
>
> SELECT * FROM diary WHERE date = '2005-05-01' ORDER BY date;
>
> or in fact even better (for my situation)
>
> SELECT * FROM diary WHERE date BETWEEN '2005-05-01' AND '2005-05-01'
> ORDER BY date;
>
> Does it know that the input to the sort routine is already sorted and
> hence is a no-op?

Yes

try EXPLAIN ;)

--
Hannu Krosing <hannu(at)skype(dot)net>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2005-07-13 20:23:08 Re: checkpoint_segments 32 megs?
Previous Message Tom Lane 2005-07-13 19:58:28 Re: commit_delay and commit_siblings