FW: optimize query with a maximum(date) extraction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Title: FW: optimize query with a maximum(date) extraction

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@xxxxxxxxxxxxxx
Subject: RE: 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@xxxxxxxxxxxxxx on behalf of JS Ubei
Sent: Wed 9/5/2007 3:53 AM
To: pgsql-performance@xxxxxxxxxxxxxx
Subject: 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



[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux