Last week, I was putting together some reports for SSRS and at the end of the day, I wasn’t thinking straight as I just copied and pasted some previouly used code to generate the desire report.
The code I had used in the past collects data from all the databases and then store it into a table. This table would then provide me with some historical information. The new report I was working on, I wanted it to give me real time data. So instead of modifing the code to give me data from a specific database, I had it query all databases and the filter it by the 1 database I needed, which is a waste of time and processing power.
Fixed it today and now the query is hundreds of time faster!