Does it really speed things up??? Posted: 5 Sep 2003
I tested two ASP scripts with identical code. One used the RS.MoveNext method to loop through the recordset, and the other the RS.GetRows method to populate an array and loop through it.
In the end, the scripts just print all the records in a column.
The interesting thing is that the RS.MoveNext method of moving through a RecordSet is 35% faster then the method you suggested. Why is this? I tested this using an Access database and a timer program.
Actually ADODB.Recordset is just an abstraction, a COM interface implemented by 3rd party vendors (including Microsoft).
This separation of implementation and interface means that the driver is free to cache in all the records at once without calling them from the database 1 by 1 as Rs.MoveNext is called. It will obviously increase data access speed.
Using Rs.GetRows means the same thing, we are making ADODB.Recordset pull all the records at once and populate them in an array.
Now which one to use? If you are comfortable with Rs.MoveNext then use that. If you want to be sure that you get the records ASAP and return the connection to connection pool immediately without relying on ADODB.Recordset implementation then use Rs.GetRows.
P.S. You should use Apache Bench (www.apache.org) to profile your application. Just make 2 ASP pages and make one use Rs.MoveNext and the other one Rs.GetRows.