Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8635

Re: Sql script code taking minutes to execute

$
0
0

Ok, what you are currently saying is:

"I have this piece of code, that I designed in a way that requires a cursor loop. I don't show the code, but I want tips how to make it faster."

 

That doesn't work.

In order to get faster performance on the database level, it's required to rewrite this code part you call "business logic" so that it doesn't work on separate rows, but on the whole set of your selection.

 

The current approach is inherently slow due to looping over single records (requires early materialization and multiple data copies) and due to the approach of appending your results to the output structure (again, data is copied over and over here).


Viewing all articles
Browse latest Browse all 8635

Trending Articles