From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Craig A(dot) James" <cjames(at)modgraph-usa(dot)com> |
Cc: | Kishore B <kishorebh(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Need help in setting optimal configuration for a huge |
Date: | 2005-10-23 17:06:07 |
Message-ID: | 20903.1130087167@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin pgsql-performance |
"Craig A. James" <cjames(at)modgraph-usa(dot)com> writes:
> MIN() and MAX() -- These are surprisingly slow, because they seem to do a full table scan EVEN ON AN INDEXED COLUMN! I don't understand why, but happily there is an effective substitute:
> select mycolumn from mytable order by mycolumn limit 1; -- same as MIN()
> select mycolumn from mytable order by mycolumn desc limit 1; -- same as MAX()
BTW, Postgres does know to do that for itself as of 8.1.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tomasz Rybak | 2005-10-23 17:17:56 | Re: Need help in setting optimal configuration for a huge |
Previous Message | Steinar H. Gunderson | 2005-10-23 16:55:00 | Re: Need help in setting optimal configuration for a huge |
From | Date | Subject | |
---|---|---|---|
Next Message | Tomasz Rybak | 2005-10-23 17:17:56 | Re: Need help in setting optimal configuration for a huge |
Previous Message | Steinar H. Gunderson | 2005-10-23 16:55:00 | Re: Need help in setting optimal configuration for a huge |