When an application using one of your databases is modified, e.g. an upgrade, a new application, etc, new queries can appear based on those changes. Within DPA, you can run a Top SQL report or drill into the day a change was made, and probably see the queries that are new, assuming they are causing a performance issue. However, this script will provide the list of all new SQL statements, ranked by wait times. With this data, it becomes easier to head off any performance issues because of the application changes.
This custom query can be run for any monitored instance, and the @InstanceID
variable controls which one. There are three other variables at the top of the script that control the Start and End dates, as well as the minimum amount of wait time for a SQL statement to appear.