FW: optimize query with a maximum(date) extraction

From: "Gregory Williamson" <Gregory(dot)Williamson(at)digitalglobe(dot)com>
To: <pgsql-performance(at)postgresql(dot)org>
Subject: FW: optimize query with a maximum(date) extraction
Date: 2007-09-05 11:06:43
Message-ID: 8B319E5A30FF4A48BE7EEAAF609DB233015E2AE7@COMAIL01.digitalglobe.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

bad address kep his from going to the list on my first try ... apologies to the moderators.

-----Original Message-----
From: Gregory Williamson
Sent: Wed 9/5/2007 4:59 AM
To: JS Ubei; pgsql-performance(at)postgresql(dot)org
Subject: RE: [PERFORM] optimize query with a maximum(date) extraction

In order to help others help you, you might provide the following:

table description (columns, types, indexes) (\d tablename from psql does nicely)

the same query run as "EXPLAIN ANALYZE <your query here>;"

Greg Williamson
Senior DBA
GlobeXplorer LLC, a DigitalGlobe company

Confidentiality Notice: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information and must be protected in accordance with those provisions. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.

(My corporate masters made me say this.)

-----Original Message-----
From: pgsql-performance-owner(at)postgresql(dot)org on behalf of JS Ubei
Sent: Wed 9/5/2007 3:53 AM
To: pgsql-performance(at)postgresql(dot)org
Subject: [PERFORM] optimize query with a maximum(date) extraction

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-05 11:30:21 Re: optimize query with a maximum(date) extraction
Previous Message JS Ubei 2007-09-05 09:53:22 optimize query with a maximum(date) extraction