Sql-Server

Category: sql-server

Query Store Size Based Cleanup Causes Performance Problems - How to Avoid It

Query Store Size Based Cleanup Causes Performance Problems - How to Avoid It

I’m a huge fan of SQL Server’s Query Store feature. Query Store collects query execution plans and aggregate query performance metrics, including wait stats. Having Query Store enabled makes troubleshooting performance issues such as bad parameter sniffing, much, much easier. Because Query Store is integrated into SQL Server itself, it also can catch query plans in a lightweight way that an external monitoring system will often miss.

When performance matters, it’s important to ensure that you’re managing Query Store so that Query Store cleanup does not run during high volume times. Query Store cleanup could slow your workload down significantly.

Continue reading

You Will Not Find Long Compilers Who Time Out in Query Store

You Will Not Find Long Compilers Who Time Out in Query Store

Last November, a puzzle was really bothering me. Some queries from an application were timing out frequently after running for 30 seconds, but they were halfway invisible in the SQL Server.

Continue reading

How to Start an XEvents Trace on a Read Scale-Out Azure SQL Managed Instance

How to Start an XEvents Trace on a Read Scale-Out Azure SQL Managed Instance

It took me more than half hour to figure out how to start an XEvents trace on a read-scale out instance of Azure SQL Managed Instance. It’s hard to monitor read scale-out instances, so tracing is desirable! I started with a simple trace of sql_statement_completed. Hopefully this saves other folks some time.

Continue reading

Should You Use SQL Server Readable Secondaries If Queries Can Fail Repeatedly at Any Time?

Should You Use SQL Server Readable Secondaries If Queries Can Fail Repeatedly at Any Time?

If you use readable secondaries in Availability Groups or Read-Scale out instances in Azure SQL Managed Instance, you may have queries fail repeatedly if there is a glitch and statistics are not successfully ‘refreshed’ on the secondary replica. Those queries may keep failing until you manually intervene.

It’s unclear if Microsoft will ever fix this. There is a well established support deflection article which documents the issue and provides ‘workarounds’.

Continue reading

Azure SQL Managed Instance General Purpose Architecture and Performance/Cost Tradeoffs

Azure SQL Managed Instance General Purpose Architecture and Performance/Cost Tradeoffs

🔥 UPDATE: Microsoft has announced the general availability of the Next-gen General Purpose service tier for Azure SQL Managed Instance, which includes improvements to I/O latency, IOPS, and transaction log throughput. This post describes the original General Purpose blob storage. You don't want that.

Whether or not you use Azure SQL Managed Instance, you will likely be asked for an opinion on it eventually if you’re a SQL Server person.

While the architecture is documented, it can be a bit of a long read and some of the gotchas are spread out over different pages – so I’m drawing up the architecture of each service tier along with notable implications for the design on performance and cost. Here’s the scoop on General Purpose.

Continue reading

Getting Around Error 40510 to Configure Resource Governor in Azure SQL Managed Instance

Getting Around Error 40510 to Configure Resource Governor in Azure SQL Managed Instance

One feature I’ve not appreciated enough in the past in SQL Server is Resource Governor.

Resource Governor allows you to fix problems with Memory Grants in a simple way, as Erik Darling recommends. It also lets you classify sessions into groups and limit the maximum number of simultaneous requests, and /or limit the degree of parallelism if you need more CPU for other workloads. While this will slow down the queries you classify into that group, this can be super useful, especially if you’re already using something like Snapshot isolation to prevent blocking or you are using a read-only replica.

In Azure SQL Managed Instance, you get to use Resource Governor, even in the General Purpose tier. This is awesome.

Just make sure you execute commands in the context of the master database, or you’ll get error 40510: Statement 'ALTER RESOURCE GOVERNOR' is not supported in this version of SQL Server.

It is supported! Just USE master; before running your commands.

Continue reading

How Many Features Are Missing from Azure SQL Managed Instance?

How Many Features Are Missing from Azure SQL Managed Instance?

🔥 UPDATE (November 2025): Since this post was written, most Intelligent Query Processing features are now available.
  • According to Microsoft documentation, most Intelligent Query Processing features are now available in Azure SQL Managed Instance, including Cardinality Estimation Feedback, Memory Grant Feedback (percentile), and Parameter Sensitivity Plan Optimization. Some features require specific database compatibility levels.
  • Storage increases: Business Critical service tier now supports up to 16 TB of storage (increased from 4 TB), and the new Next-gen General Purpose service tier supports up to 32 TB. See resource limits documentation for details.
  • Next-gen General Purpose (GPV2) improvements: The new Next-gen General Purpose service tier eliminates the need to configure abnormally large file sizes to get IOPS and throughput. This limitation only applied to the original General Purpose (GPV1) tier, where file sizes determined IOPS and throughput allocation.
Still missing: The following features remain unavailable in Azure SQL Managed Instance as of November 2025, along with most of the features in the post not listed above.

Spoiler: a large amount of features from SQL Server 2022 are missing from Azure SQL Managed Instance. Some major features are missing that were introduced in SQL Server 2019– and here we are just a few weeks away from 2024.

But Microsoft’s top-line marketing claims about Azure SQL Managed Instance remain that ‘it’s always up to date with the latest SQL features and functionality.’

Let’s dig into some of the documented highlights on missing features, so you can decide for yourself what to think of that statement.

Continue reading