Sqlsever Big Data Paging

Source: Internet
Author: User

The paging of big data in SQL Sever has always been a difficult piece to handle, and there are shortcomings in the use of ID self-adding columns. From a relatively comprehensive page view, the new Row_number () function in SQL sever2005 solves this problem. Let's start by introducing a practical project. China Railway Construction Company's project table data is very large, the beginning of development with the GridView control comes with the paging, after running a year, click on the next page is finally difficult to wait, the system needs to be optimized. The improvement of paging is a business need. So, I used the row_number () function paging. is also a solution to the urgent.

Note: This article is only a case description, more detailed theory please see the essay "Big Data Paging implementation and performance optimization"

The main factors to improve the paging efficiency are:
(1) Make full use of foreign keys to improve table connection speed
(2) Use natural links as much as possible to avoid external connections
(3) Minimize the number of records on the left side of the connection to reduce the amount of records processed first
(4) Select as much as possible, then connect to reduce the amount of data processed
(5) When possible, build a view that fully uses the database's own optimization capabilities

The following is the SQL statement for the paging query:

SELECT * FROM
(select T_GCXM_TEST.SGDW,T_GCXM_TEST.ID,XMMC,T_GCXM_TEST.GCLB as gclb,gchte,gchte-kl2 as Xmsyjzl,
Kl2 as Klsl,dwmc,lry, Row_number () over (order by t_gcxm_test.id Desc) as Idrank
From T_dw,t_gcxm_test where T_dw.dwid=t_gcxm_test.sgdw and (Sgdw like ' gf12% ' and (sgdw <> ' gf12 ' and fgcid are null ) or (SGDW = ' gf12 ')) or lry = ' Gf12gao '))
As B
where idrank>=50023 and idrank<50033

The value of the Idrank can be passed through the Web page. The paging SQL statement is written in the stored procedure, can fully show the effect of paging.

Figure A single table paging time-consuming

Figure two Multi-table paging time-consuming

Sqlsever Big Data Paging

Related Article

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.