Finding New Queries After a SQL Server Release

Finding New Queries After a SQL Server Release

The release went out Friday. By Monday morning waits on one database are up by a third, and the usual dashboards only say that something is slow. What you actually need to know is which new queries showed up in that window, and that is a question about age, not cost.

How do I find new queries that started running after a release in SQL Server? Compare the first day each statement was seen waiting against your release date. Statements whose first sighting falls on or after the release, and that already rank among the database's top waiters, are the first suspects. Wait history recorded over time supplies those first and last seen dates, so no extra tracing is needed.

Database Health Monitor answers it from history it already keeps. The New and Vanished Queries report reads the recorded waits in DBHealthHistory and sorts every waiting statement of a database by when it first appeared, when it was last seen, and whether it came back.

New and Vanished Queries is one of the reports in Database Health Monitor. It runs against your own servers, and it takes about a minute to have this same screen open on one of them.

Why the top waiters list misleads you

The obvious first move is to sort statements by wait and read from the top. It tells you what is expensive right now. It does not tell you what changed. A statement that has hurt for six months sits next to one that arrived Friday, and they look identical.

Ad hoc code makes it worse. A statement that carries a fresh literal on every call is a different row in the history each time. Judged by text alone, it is new every single day, and a real newcomer drowns in the noise.

Measure the first sighting instead

The honest number is the first day a statement was seen waiting. The wait history stores that for as long as retention allows, with no Query Store required, so the report needs nothing new collected. It reads dbo.waitsNormalized and takes the statement text from dbo.waitsQueries.

To keep literals from faking novelty, the report replaces them in the first 300 characters with a marker and ignores case and layout. Statements that come out the same are one line. The Folded column tells you how many recorded statements were merged. If an older copy of the statement is still running, the newcomer is not new.

It also refuses to guess. When the history is shorter than the quiet period before your window, everything would look new. The New tab says "history too short" instead of listing a false answer.

Reading new queries, vanished ones and returners

Find it under Historic > New and Vanished Queries after expanding a database. It is offered for every database except tempdb and model. Three tabs split the story:

TabWhat it means
NewFirst seen within the recent window (3, 7, 14 or 30 days, default 7), with enough history behind it to be sure
VanishedA regular, seen on at least 5 days, not seen since before the quiet period (7, 14 or 30 days, default 14)
ReturningSeen before, absent for at least the quiet period, then back inside the recent window

On the New tab, the rank column shows where each statement sits among all the database's statements by wait in the recent window. It turns red inside the top 10. A newcomer that is already red is your first suspect. Next to it you get the wait since it appeared, its top wait type, the program and the login.

The deployment hint is the useful extra. If there was DDL in the database on the first-seen day or the day before, the row says so. It reads Audit.DDLAuditLog, and it appears only when you are on the instance that hosts DBHealthHistory.

The chart above the grid counts statements first seen per day. A spike is a release, and the recent window is drawn in orange. Select a row and Query Card or Query Waits Advisor opens for that statement. Export (CSV) saves what is on screen.

What to do with the answer, and what it cannot see

Vanished is the quieter half. A regular statement that stops may be a feature that broke or a job that stopped, and nobody files a ticket for something that is simply absent. Each Vanished row gives a last seen date, days seen before, and a typical wait per day, so you can judge how much it mattered.

Know the limits. Only statements that waited when the monitor looked are recorded. A fast statement that never waits is invisible, so Vanished means no longer seen waiting, not no longer running. A procedure is recorded by object name, so an altered procedure is not new. Use Schema Change Analytics for ALTER PROCEDURE.

Statement rows are deleted when nothing references them, so a first sighting can never predate your retention. If you are still setting up history, SQL Server Historic Reporting: One Page, One Click shows what DBHealthHistory feeds. The full column reference lives on the New and Vanished Queries documentation page.

What to check on your own server

  • Note the date of your last release and pick a recent window that covers it, 7 days or 14
  • Open the New tab and look for statements already ranked in the database's top 10 by wait
  • Check the deployment hint on each new statement against the DDL that went in that day
  • Review the Vanished tab for regular statements that stopped appearing and decide whether a feature or job broke
  • Check the Returning tab for statements that came back after a long gap

Try Database Health Monitor Today

It shows which statements first appeared after a release, which regular ones disappeared, and what each costs in waits. Database Health Monitor shows it on every instance you connect, in the time it takes to open the report.

Download Database Health Monitor and run the New and Vanished Queries report against your own server. There is nothing to configure first, and you will know inside a few minutes whether it tells you something you did not already know.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

To prove you are not a robot: *