Normally, I always use maxrows attribute of CFQuery when I want to display limited records from table. Sometimes I want to display limited records from table with built-in Microsoft SQL command like TOP in Oracle. Yesterday I found that there is ROWNUM command in Oracle which can display limited records like maxrows in CF and Top in SQL. That's why I feel happy to use this command in my query. On the other hand, I want to test the performance between maxrows and rowcount.
So I've tested as follow
With maxrows
2 select NAME, DOB from nh_person
3</cfquery>
Query execution time for above statement is 31ms and debugging output is as follow
With rownum
2 select NAME, DOB from nh_person
3 WHERE ROWNUM <= 100
4</cfquery>
Query execution time for above statement is 16ms and debugging output is as follow
So what I want to know is Coldfusion use which Oracle function if we put recordcount into maxrows of CFQuery tag.

Android
Top of Page
#1 by Travis on 12/22/10 - 7:05 AM
Oracle stops the query after the value of rownum is reached. That means the query doesn't have to continue all the way to the end before it sends jdbc/cf the results.
#2 by ppshein on 12/22/10 - 8:27 AM