Re: optimize query with a maximum(date) extraction

From: Dimitri <dimitrik(dot)fr(at)gmail(dot)com>
To: "JS Ubei" <jsubei(at)yahoo(dot)fr>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: optimize query with a maximum(date) extraction
Date: 2007-09-08 08:00:22
Message-ID: 5482c80a0709080100i266bc41ajae0b34825cc9af5e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

BTW, will it improve something if you change your index to "my_table(
id, the_date )"?

Rgds,
-Dimitri

On 9/5/07, JS Ubei <jsubei(at)yahoo(dot)fr> wrote:
> Hi all,
>
> I need to improve a query like :
>
> SELECT id, min(the_date), max(the_date) FROM my_table GROUP BY id;
>
> Stupidly, I create a B-tree index on my_table(the_date), witch is logically
> not used in my query, because it's not with a constant ? isn't it ?
>
> I know that I can't create a function index with an aggregative function.
>
> How I can do ?
>
> thanks,
>
> jsubei
>
>
>
>
>
> _____________________________________________________________________________
> Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Gregory Stark 2007-09-08 10:04:41 Re: DRBD and Postgres: how to improve the perfomance?
Previous Message Simon Riggs 2007-09-08 06:28:24 Re: DRBD and Postgres: how to improve the perfomance?