All Forums Database
mithunk 7 posts Joined 02/13
14 Apr 2013
TOP vs QUALIFY RANK to fetch records

Which is the best option in means of performance ?
selecting rows using top clause without any order by clause (or)
selecting rows using qualify rank() over() =1 ?
 

Mithun
dnoeth 4628 posts Joined 11/04
14 Apr 2013

Hi Mithun,
you can't use RANK without ORDER BY, so TOP will be more performant.
When you need an ordered output there will be no difference in speed.
Dieter

Dieter

jacobjonz 2 posts Joined 09/10
03 Dec 2014

First off, sorry for hitting an old thread.
 
Dieter,
The below link from teradata says that top n is better performing even in case of ordered output.
http://www.info.teradata.com/htmlpubs/DB_TTU_14_00/index.html#page/SQL_Reference/B035_1146_111A/ch01.032.097.html
Do you think this is only from Version 14?
 

You must sign in to leave a comment.