Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Performance Question:Forced sortign Vs. MIN/MAX?

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@posting.google.com>


Which method to use to retrieve the minimal entry from a large table?

  1. Use Oracle's MINIMUM function:
	     	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;
		

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 course the select is not from just one table, but a JOIN of three tables) Received on Wed Aug 28 2002 - 09:05:22 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US