TOP vs QUALIFY RANK to fetch records

Database

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 ?

Tags (1)
2 REPLIES
N/A

Re: TOP vs QUALIFY RANK to fetch records

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

Re: TOP vs QUALIFY RANK to fetch records

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...

Do you think this is only from Version 14?