optimize query with a maximum(date) extraction

From: JS Ubei <jsubei(at)yahoo(dot)fr>
To: pgsql-performance(at)postgresql(dot)org
Subject: optimize query with a maximum(date) extraction
Date: 2007-09-05 09:53:22
Message-ID: 302443.65402.qm@web26209.mail.ukl.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Gregory Williamson 2007-09-05 11:06:43 FW: optimize query with a maximum(date) extraction
Previous Message Hannes Dorbath 2007-09-05 08:20:31 Re: Performance on 8CPU's and 32GB of RAM