← All articles
plan-cacheperformanceconfiguration

Plan cache bloat from one-off queries

Ad-hoc SQL can flood the plan cache with single-use plans. When optimize for ad hoc workloads helps — and when the real issue is the app.

Some applications generate endless unique SQL text. The plan cache fills with single-use plans, memory pressure rises, and compiles become more expensive.

Review signals

  • High volume of single-use plans
  • Plan cache consuming a painful share of memory
  • Compile waits under load
  • ORMs or reporting tools emitting unparameterised SQL

Configuration lever

optimize for ad hoc workloads can reduce the cost of single-use plan caching. It is a useful control — not a substitute for fixing the worst query generation patterns.

Application lever

Parameterisation, shared procedures, and fewer unique string variants reduce compile churn at the source.

How we advise

Health checks flag cache shape and related memory pressure. Recommendations combine a safe configuration discussion with honesty about application debt when that is the real driver.

Need hands-on SQL Server help?

Allay Data Solutions offers maintenance, tuning, and assessments from Port Elizabeth, South Africa.

Get in touch