The paging method is displayed on the Internet. It is said that datareader has the fastest paging speed. So I did some tests.
First, I use the ACCESS database, use socancode to automatically generate code pagination (socancode generates not in statements for paging), and use datareader paging. the test time is as follows:
Stopwatch Sw = new stopwatch ();
Sw. Start (); // start timing
// Write the code to execute the tested Algorithm
Sw. Stop (); // stop timing
// Obtain the algorithm execution time
Long usedtime = Sw. elapsedmilliseconds;
//...
There is not much data, about one hundred. The test result is as follows. The datareader page is displayed on the left and SQL page is displayed on the right:
Page 4: 44
Page 2nd:
Page 3rd:
Page 4th:
Page 6: 5th
Page 4: 6th
Page 7th:
Page 8th:
Page 9th:
Page 10th:
Page 6: 11th
From the data above, the paging time of datareader is relatively uniform, and there is no longer a slower latency, while the SQL paging has a slower speed trend. As a result, we increased the data volume to 10 thousand, and found that SQL paging was slow, which is about several hundred times different. I have no patience to wait for the page to open.
After searching, we can see that although the testing data of other people is the fastest, there is no such huge difference. So we test the data in sqlserver. The results show that although datareader is faster, however, the gap is very small. It is estimated that the more powerful the database function is, the faster the SQL Execution speed is.
The final conclusion is: the speed of datareader is indeed the fastest, but with the powerful database functions, the gap is narrowing, so the access gap with weak functions is huge, the difference between SQL Server with powerful functions is very small. The next step is to upgrade socancode to the datareader paging mode.