Test Using datareader Paging

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.