Brian Cox <brian.cox@xxxxxx> wrote: > cemdb=# explain select min(ts_id) from > ts_stats_transet_user_interval a > where 0=0 and a.ts_interval_start_time >= '2009-6-16 01:00' and > a.ts_interval_start_time < '2009-6-16 02:00'; > seems like max() shouldn't take any longer than min() and certainly > not 10 times as long. Any ideas on how to determine the max more > quickly? Is there any correlation between ts_id and ts_interval_start_time? Perhaps if you tried min and max with different time ranges it would find a row on a backward scan faster. It'll take ten times as long if it has to scan through ten times as many rows to find a match. I don't suppose you have an index on ts_interval_start_time? If not, what happens if you run these queries after adding one? -Kevin -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance