cfwheels/cfwheels — comment on commit a8e378eba490bbd7c80aef87a0e91b9eaa4c24e5
File:  line 0
By rip747:

now i feel like an idiot and finally get what you're trying to do with this commit. tell me if i'm on track with this or not.

when using maxrow, since it's a cfquery attribute, the statement that is passed to the database will be the same whether you select 10 and then 20 since coldfusion is doing the truncation at it's level, not the database level.

now, what we can do, instead of adding the maxrow comment to the query, is utilize the database to truncate the result at that number that maxrows would. so for instance let's take mysql. if the dev does the following:

then instead of us generating the statement like so:

select * from users -- 5

we can use mysql built in limit like so:

select * from users limit 5

for mssql, we can use top:

select top 5 * from users

that would give us the same result and a performance boost.