catch.saravana
Member
We just completed phase I of a migration project and started with phase II which will run for another 3 to 4 weeks. Once we are done with the phase II we are planning for this kind of a revamp because we have so many customer complaints on the slowness. During the analysis I was surprised to see concatenation using SUBSTITUTE consuming more time and was thinking of providing a temporary fix by replacing the function with '+' operator.Have you considered other mechanisms altogether? Like populating a temp-table and then exporting it as JSON?
I am 100% sure that the db reads are not consuming time. I checked the results of profiler and ran once again with etime to cross verify the results.So, are you now saying that there is DB access in this loop? And suggesting that the concatenation is slower than the DB access?
To keep it simple I wrote the code snippet with DO loop and ran it on a procedure editor without db connection which took 3 seconds and that proves SUBSTITUTE function is the culprit in this case.