From: | Josh Berkus <josh(at)agliodbs(dot)com> |
---|---|
To: | Christoph Haller <ch(at)rodos(dot)fzk(dot)de>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Speeding up SELECT MAX(),... GROUP BY ... ? |
Date: | 2002-05-22 23:48:39 |
Message-ID: | 200205221648.39951.josh@agliodbs.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Chris,
> EXPLAIN
> select max(timepoint),lid,mid,sid from onfvalue
> where timepoint <= '2002-05-01 08:00:00' and sid in (1,3,5,7) group by
sid,lid,mid;
Having indexes on all four columns will help. Beyond that, there's not a lot
you can do; aggregate queries are slow. Rely on raw hardware power
(multi-channel SCSI, fast processor, lots of RAM and a very high sort_mem
setting).
BTW, if those four columns are the only data in the table, a Seq Scan is
actually the fastest method.
--
-Josh Berkus
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco
From | Date | Subject | |
---|---|---|---|
Next Message | Bhuvan A | 2002-05-23 05:57:04 | Compatibility Issue of CREATE RULE in 7.2 |
Previous Message | Command Prompt, Inc. | 2002-05-22 18:57:43 | Re: MacOS X Shared Buffers (SHMMAX)? |