Dnia 23-10-2005, nie o godzinie 09:31 -0700, Craig A. James napisaƂ(a):
<cut>
> MIN() and MAX() -- These are surprisingly slow, because they seem to do a 
> full table scan EVEN ON AN INDEXED COLUMN!
In 8.1 this is no true, see the changelog.

> 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()

In 8.1 these queries are equivalent:

select mycolumn from mytable order by mycolumn limit 1;
select min(mycolumn) from mytable;

-- 
Tomasz Rybak <[EMAIL PROTECTED]>


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to