Across client servers we see the same afternoon repeat. Someone sorts statements by CPU, picks the one at the top, makes it ten times faster, and the nightly job finishes at the same minute it always did. Nobody did anything wrong. The ranking simply showed one statement at a time, and the work was never one statement. Database Health Monitor has a report for exactly this gap, called Workload Families, and the first question to put to it is a simple one: which of these queries are really one piece of work?
What are workload families in SQL Server and how do I read them? Workload families group the statements in a database by when they run, using Query Store execution counts per time bucket. Statements whose counts rise and fall together form one family with a combined cost and a schedule. Read the hour of day chart first, then cohesion, then the members, so you tune the whole job.
Open the report and you meet a heat map above a grid. The eye wants to jump to the biggest number in the grid. Resist that for about thirty seconds. The chart tells you what kind of work this database does, and the numbers mean more once you know.
Workload Families 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.
In this post
- The question workload families answer
- Read the chart first
- Then the grid, left to right
- What a healthy reading looks like
- What a reading that needs action looks like
- Use the toolbar to test a family
- The drill down, and where it leads
- What this version does not do yet
The question workload families answer
Every query ranking returns individual statements. Real work is organized in groups. An ETL step might be forty statements. An order entry screen might run a dozen each time somebody opens it. A top ten by CPU can contain four members of one family and six unrelated statements, and nothing in the list says which are which.
That matters because fixing the first statement of a family can change nothing at all. The other thirty nine still run. We have watched teams lose a day to this, and the cost is not the day. It is the confidence that the work was done, when the job is exactly as slow as before.
The report takes a different route. It does not group by what statements cost or by what they say. It groups by when they run. Statements in one batch start when the batch starts and stop when it stops. Statements behind a screen fire when a person clicks. Count executions in each time bucket, and statements that belong together rise and fall in step.
Read the chart first
The chart has one lane per family, with the 24 hours of the day running across. A cell gets darker the more of the window's days that family ran in that hour. So a dark cell means the family ran in that hour on most days, not that it was expensive. Times are server local, which is worth confirming before you tell anyone a job runs at two in the morning.
Shape is the first thing to read. A nightly cycle is a dark band packed into a few consecutive hours. A report screen used by people spreads across business hours and fades at the edges. A family that is dark in the same hour every day is a schedule. A family with pale smears across the whole day is something else, and we come back to it below.
Why chart first rather than cost first? Because cost is the number that fooled you in the top ten list. Two statements with identical CPU totals can belong to different jobs, and two with very different totals can be steps of one. The chart is the part of the report that cost cannot distort.
Then the grid, left to right
Under the chart, the grid has three views. Families is the one you land on. Read its columns in this order rather than starting with cost.
| Column | What it tells you | Why it comes in this order |
|---|---|---|
| Schedule | The hours the family runs | Confirms the chart and ties the row to a job you may recognize |
| Statements | How many members the family holds | Tells you whether you are looking at forty statements or three |
| Cohesion | The mean correlation between members | Tells you whether to trust the family as one job |
| Cost and share | The family's total in the chosen measure, and its part of the database | Tells you whether the job is worth your afternoon |
| Executions | How often the members ran | Separates a few heavy runs from a constant trickle |
Cost and share come near the end on purpose. By the time you reach them you already know when the family runs, how big it is and how tightly it hangs together. A large share on a loose family is a different conversation from a large share on a tight one.
A family is named after the module holding most of its members, as long as that is at least two. Otherwise the name is the word Family, a number, and its hours. A module name is a gift, because it points at code someone owns. An hours name means the family is real but nobody has attached a program to it yet.
What a healthy reading looks like
A healthy page is boring in a useful way. Each lane has a clear shape. The schedule column matches what the people who run the system would say, and the module names are ones you recognize. Cohesion sits at or above the minimum correlation you chose in the toolbar, so the members really do follow one pattern.
It is also worth knowing how the report keeps itself honest. If the members of a family sit on average more than 0.1 below the minimum, the report raises its linking threshold and splits the family until each piece holds together. Families that survive that test have earned the row.
Finally, the Ungrouped view is short or full of statements you already know are one-offs. Those are the independent heavy hitters, and a database where they are the only big items is a database where classic single statement tuning is still the right tool.
What a reading that needs action looks like
Three patterns deserve action, and the chart and grid together tell you which one you have.
- One dark band, high share, high cohesion. This is a single job eating a large part of the database. Tune the family as a unit, starting with the member holding the biggest share of it.
- A family with low cohesion. The members barely follow the family pattern, so you may be looking at unrelated statements that share a busy hour. Raise the minimum correlation and see which members survive before you commit to any plan of work.
- A cost that sits in Ungrouped. The heaviest statements fit no schedule, so no family will fix them. Those need ordinary statement level work.
Telling them apart takes two glances. Look at the lane: tight and dark, or smeared? Then look at cohesion: near the minimum or well above it? Tight and high means tune the job. Smeared and low means do not trust the grouping yet.
There is one caveat we would give any client. A statement active in fewer than 5 buckets is too sparse to correlate, so it is counted in the footer and left out. And at most 2000 statements are clustered, most expensive first, with fewer on a long window with short buckets. The footer reports the cut. Read it, so you know what the report did not see.
Use the toolbar to test a family
The toolbar is a set of questions you can ask of a family you are not sure about. The measure buttons choose whether cost is added up as CPU, duration, reads or writes, so a family that looks modest on CPU may lead on writes. The window is 7 or 30 days. Buckets are 15 minutes or an hour, and never shorter than the Query Store interval.
The two that change the grouping are the correlation and the minimum family size. Correlation comes in 0.7, 0.8 and 0.9. At 0.9 only statements that move almost in lockstep are linked, so a family that survives there is solid and one that falls apart was loose. Minimum size comes in 2, 3 and 5 or more. A family below it is dissolved, though its statements can still join a surviving family whose members they follow closely enough.
Sweeping the correlation is the quickest test of whether a family is real. Watch what splits.
The drill down, and where it leads
Double click a family and the grid switches to Members. Each row shows a statement's share of the family and its correlation with the family's pattern. Read that list before you open any plan. The member with the largest share is where you start, and a member with a weak correlation may not belong to the job at all.
From a family or a single statement, a right click leads to Statement Hot Spots, Plan Regressions and Workload Change. That is the handoff from which job to which statement and what changed in it. If the member you picked turns out to read far more data than its row count justifies, the post Logical Reads Per Row: Which Query Reads Too Much? covers that next question.
What this version does not do yet
Two things are not built. The report cannot yet name a family from the program in Active Session History data, and there is no Compare button against the prior period. So for now, a family that changed shape last month is something you spot by running the report on a 30 day window and a 7 day window and comparing by eye.
It needs SQL Server 2016 or newer, Query Store turned on for the database, and the VIEW DATABASE STATE permission, because the counts come from sys.query_store_runtime_stats. If you want to see the report work before pointing it at anything real, the sample script SampleBadDatabase\WorkloadFamilies.sql builds a database with two scheduled loads of 8 statements and 5 independent statements. It takes about two and a half hours to run, so start it before a long meeting. The full reference for every control is on the Workload Families documentation page.
What to check on your own server
- Open the report on a seven day window and look at the chart lanes before you read any number in the grid
- Compare each family's schedule with what you believe your nightly jobs and report screens do
- Raise the minimum correlation from 0.7 to 0.9 and note which families break into pieces
- Open Ungrouped and write down the reason given for each heavy statement
- Check the footer for statements skipped as too sparse and for the 2000 statement cut
Try Database Health Monitor Today
Statements that run together as one job show up as a single family with one cost, so you stop tuning the first query of a forty statement load. 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 Workload Families 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.
Related reading: When Did the Workload Change? Find the Exact Hour. When a server is slower than it used to be and nobody can say since when, this post shows how to find the exact hour the workload shifted and what moved it.

