December 19th, 2012, 10:40 AM
Reading a huge database
I'm processing a query contains LEFT OUTER JOINS from a table to 5 other. I'm receiving an error.
I put the SQL of the query in SQL Server Management Studio and it returns 2,412,348 rows and consume 02:06 min.
I would like to know if is there a way of make MS SQL Server manage the query in the way it returns 1,000 or another controlled number of lines in non-synchronous way or something like this.
If the SQL Server doesn't do the job, I would like to receive a suggestion of how to solve the problem.
I think about read the first 1,000(for example) rows, then reopen the query skipping first 1,000 and reading the 1,001 to 2,000 and so on. It is notorius that I would have performance degradation.
Would someone of you give me some explanation about this?
It can also occurs with another RDBMS. We use MS SQL Server and Oracle here.
Greetings from São Paulo - Brasil