Contact us
Insights

Investigating slow month-end queries

Reports that run fine all month crawl at month end, just when finance needs them. How to find out why, before the next close.

The problem

Fine all month, slow when it matters

During the month, reports cover a few days of data and few people run them. At month end, the whole finance team runs month-to-date and year-to-date reports at once, against a month of data, while late invoices are posted and the close jobs run. A query that took seconds now takes minutes, blocks others, and times out. By the next week it’s fast again and nobody investigates.

Causes

Common causes of month-end slowdowns

Bigger date ranges

A query that scans a day scans a month or a year, and its plan doesn’t suit the larger range.

Everyone at once

Many users running heavy reports at the same time compete for memory and CPU.

Close jobs overlapping

Postings, revaluations, and batch jobs running alongside reports, causing blocking.

Out-of-date statistics

Statistics haven’t caught up with the month’s new data, so plans are poor.

Investigating

How to investigate

Step 1 of 4

  1. Turn on Query Store or a monitoring tool before the close, so evidence is there.

  2. Rank by total duration and waits during the close, not by single slow runs.

  3. Find whether queries are waiting on CPU, disk, memory, or each other.

  4. Restore a month-end copy and test index, query, or scheduling changes against it.

Separate reporting from the close

Often the lasting fix is to keep heavy reporting away from the live database during the close. For example: run month-end reports from a readable replica or a reporting copy refreshed after the main postings, and schedule batch jobs so they don’t overlap with the team’s busiest hours.

Month end grinding to a halt?

Tell us which reports slow down and when. A few lines are enough.

Tell us what’s not working