三种数据分页方法的效率分析
2009-08-13甘群文林颖明
甘群文 林颖明
摘 要:对三种存储过程分页算法的响应速度进行比较。采用WAST1.1测试工具,对每种算法分别以5个不同级别的记录数进行测试,并记下满足查询条件的记录数首页、末页的第一个字节到达客户端的时间(即TTFB)。对于小数据量,三种算法中首页、末页的TTFB相差不大;对于大数据量,算法Ⅰ和算法Ⅱ的首页、末页的TTFB相差较大,而算法Ⅲ却相差无几。在海量数据下,算法Ⅲ是三者中效率最高的分页算法。
关键词:SQL;存储过程;分页算法;测试;效率分析
中图分类号:TP392文献标识码:B
文章编号:1004-373X(2009)10-045-03
Efficiency Analysis of Three Kinds of Data Pagination Methods
GAN Qunwen1,LIN Yingming2
(1.Information and Technology Department of Library,Guangxi Traditional Chinese Medical University,Nanning,530001,China;
2.Grand & Loan Office of the Education Department of Guangxi,Nanning,530021,China)
Abstract:To compare the response rates of three storage process pagination algorithms.Using the WAST1.1 test tool,testing each algorithm with five levels′records,and taking down the Total Time to First Byte (TTFB) of first page and the last page in the records which meet the query criteria.In small data sets,there is slight difference between TTFB of the first page and the last page.In large amount data,the difference of the TTFB between the first page and the last page in algorithms I and algorithms II is big,but there is hardly any difference in algorithm III.In mass data,the algorithm III is the most efficient pagination one in the three algorithms.
Keywords:SQL;storage process;pagination algorithm;test;efficiency analysis
0 引 言
随着互联网的不断发展,Web数据库的应用越来越广泛,用户对访问Web数据库页面的效率要求也越来越高,对于大型数据模型而言,把成千上万条满足查询条件的所有记录一次性地输出到客户端是不现实的,一是浏览的页面内容过多;二是用户等待的时间过长;三是浪费服务器资源而使其负载过重。然而采用分页技术,每次只发送一个页面给用户,提高了页面响应速度,减轻了数据库服务器的负担[1] 。因此数据分页技术是Web数据库系统开发中不可忽视的一项重要工作,现在流行的分页方法一般是检索页面大小的块区数据返回给客户端[2]。
1 三种存储过程分页技术分析
存储过程是在SQL Server数据库建立的能够完成一定操作的一组SQL语句,在ASP.NET代码中调用;它执行时只需要SQL Server 对其进行一次解析、编译和优化,能够显著提高数据库驱动Web网站性能[3]。它能减少与数据库交互次数,有利于SQL语句重用[4]。……
