SQL Server stops sending records

We have a very complex analysis process with several variables and thousands of records, which usually generate trillions of permutation records in tempdb. Through preprocessing and dynamic SQL, we were able to complete the analysis in a few seconds and only a few thousand records in tempdb(instead of trillions).

The code has been used for several years. Today, one of the input variables has doubled compared to the traditional size, and SQL Server has been linked to complete code execution. It will simply stop sending data for one of the preprocessing steps. The full code is very long and complicated to include here, but to illustrate what happens:

/* Lots of SQL code */

print 'debug 1'

select distinct field
from   #table

print 'debug 2'

select   several..fields
from     many..tables..joined..with..temp..tables
where    multiple..conditions
group by several..fields

print 'debug 3'

SSMS ( ), print 'debug 2', 330 select distinct field .

, select distinct field 290-325 ( ) , . 330 , debug 2 "". , / 330 .26 > .

select SQL Server select.

( ), print 'debug 2'. #temp, db select , . .

- , Microsoft SQL Server 2008 R2 (SP1) SQL? , ?

+4
1

, - . PRINT RaisError('Debug n', 0, 0) WITH NOWAIT , .

PS: , , = P

0

Source: https://habr.com/ru/post/1529496/


All Articles