Re: Need help in setting optimal configuration for a huge "Craig A. James" <cjames@modgraph-usa.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
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match |