-1
I have a table with 2 million records and I need to take 1000 by 1000, I know I can use TOP, but use the form below pq need to control the quantity, example: I get 1000 after the next 1000, then the next 1000 and so on, ie in place of this thousand, is a variable, anyway this is my select:
select * from (select *, ROW_NUMBER() OVER(ORDER BY cd_cpfcgc ASC)as Row from cad_cliente) as teste where teste.Row between 1 and 1000
But when performing is taking about 20 seconds, is there any other way to improve performance? because when running on the server is giving timeout by the delay.
Ever since I thank.
if you want a better analysis you need to put in your question the structure of the tables and if they have index. Only seeing the Execution Plain is that you may have a more real idea of the problem, if you have table scan, if index is missing, loop interactions.. I put this in the question to help in the analysis
– Ricardo Pontual