I use 5 million of the data to test, interested people can try tens;
1. Add a lot of data first
SQL SERVER millions data test "measurement"
2. Normal paging
A,row_number () over
select * (select row_number () over ( Span style= "color: #0000ff;" >order as row, * from Users as as TT where tt.row between 999000 and 1000000 ;
Test: "Millions" first page time:126MS, 100W time 1073MS, close to the first page 10 times times,500W time 58696MS 100W 55 times times , 466 times times the first page .
B, two times top page
SELECT TOP + * fromUsersWHEREUserid not inch(SELECT TOP( + *( the - 1) UserID fromUsersORDER byUserID)ORDER byUserID;
Test: "Millions" first page time:140MS, 100W time 1190MS, 500W time 5526MS 100W 5 times times, the first page 39 times times.
Why is the top top more efficient than row_number () when I test the acquisition (500W)?
At least: 100W of data can be used row_number () Such paging, more elegant efficiency is slightly better, reluctantly acceptable, the data is larger, how to optimize the code is useless, this involves the database computing power, Similar to both of the pass.
2. Optimize paging ( first time )
Paging "test" of SQL SERVER Big Data