I wrote some stored procedures , like 1 month ago.
During this month, these stored procedures suffered from different modification, new fields, new joins, new where conditions , so they end up in an “ugly” form of writing and the performance was very poor. Initial form were run in a few second, and the yesterday form were running in like 2 hours :O . To much.
But testing was started , so was hard to rewrite , because this is generating a new start of testing. But after a new negotiation and some coffees “bribes” , they let me rewrite the queries and now I am back , with the run in under 1 minutes.
Thanks sql server, because you can write the same queries in different format.
S