Performance Question:Forced sortign Vs. MIN/MAX?
From: Azaria Elburg <azaria_at_my-deja.com>
Date: 28 Aug 2002 07:05:22 -0700
Message-ID: <7173608e.0208280605.1a481f1f_at_posting.google.com>
Date: 28 Aug 2002 07:05:22 -0700
Message-ID: <7173608e.0208280605.1a481f1f_at_posting.google.com>
Which method to use to retrieve the minimal entry from a large table?
The table is very large with many millions of rows. The conditions are
complex (including a sub query of "not exists select 'X' from same
table", to get only the most recent data for any given date. And of
select min(field)
from table
where conditions;
or
B. A forced sorting select with a where condition of ROWID<2?
select field
from (select field
from table
where
conditions
order by field )
where ROWID < 2;