Analysis and method of data paging efficiency in SQL tens
Select Top * FROM (select top * to T1 ORDER by ID ASC) an ORDER by id DESC
First ASC to take the first 500 and then inverted (DESC) The results of the 100 ...
MSSQL tested it in me through
This ID field is also the primary key column if the default ascending sequence is the same as the following sentence can be achieved
SELECT * from t1 where ID between 500
I know three ways to have in between and and >= and <=
The efficiency of testing between and is the highest of 3.
First: id>400 and id<500 only 99
id>=401 and id<=500 are only 100.
The best way: With the First_rows (n) optimizer hint: The purpose is to improve the response time of SQL statements, quickly first return n rows
In addition, between and is the most efficient
Select/* FIRST_ROWS (100) * *
ID, username from t1
where ID between 401 and 500
Final summary
At the point of enquiry, it is more efficient to use between...and than to take "<" and ">" numbers.
Select A.*
From table1 A
where rownum between 10000001 and 10000101