Re: select max() much slower than select min()

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

 



> -----Original Message-----
> From: Brian Cox
> Subject:  select max() much slower than select min()
> 

> 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?


That is odd.  It seems like max should actually have to scan fewer rows than
min should.  It might still be bloat in the table, because unless you did
VACUUM FULL there could still be dead rows.  A vacuum verbose would show if
there is bloat or not.  Also maybe you could try a two column index like
this:

create index test_index on ts_stats_transet_user_interval
(ts_interval_start_time, ts_id);


Dave



-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

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

  Powered by Linux