Re: optimize query with a maximum(date) extraction - Mailing list pgsql-performance

From Pavel Stehule
Subject Re: optimize query with a maximum(date) extraction
Date
Msg-id 162867790709050548l3e1fd155g40b745f2ae42834e@mail.gmail.com
Whole thread Raw
In response to Re: optimize query with a maximum(date) extraction  ("Peter Childs" <peterachilds@gmail.com>)
Responses Re: optimize query with a maximum(date) extraction
List pgsql-performance
>
> why not
>
> select id,
>        min(the_date) as min_date,
>        max(the_date) as max_date
>   from my_table group by id;
>
> Since 8.0 or was it earlier this will use an index should a reasonable one
> exist.

without any limits, seq scan is optimal.

Regards
Pavel Stehule

pgsql-performance by date:

Previous
From: "Peter Childs"
Date:
Subject: Re: optimize query with a maximum(date) extraction
Next
From: JS Ubei
Date:
Subject: Re : optimize query with a maximum(date) extraction