<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Performance on Rudi Bruchez</title><link>https://www.pachadata.com/en/docs/howtos/performance/</link><description>Recent content in Performance on Rudi Bruchez</description><generator>Hugo</generator><language>en</language><atom:link href="https://www.pachadata.com/en/docs/howtos/performance/index.xml" rel="self" type="application/rss+xml"/><item><title>Identify blocking problems</title><link>https://www.pachadata.com/en/docs/howtos/performance/blocking/</link><pubDate>Fri, 28 Aug 2026 00:00:00 +0000</pubDate><guid>https://www.pachadata.com/en/docs/howtos/performance/blocking/</guid><description>&lt;div class="alert alert-success" role="alert"&gt;&lt;div class="h4 alert-heading" role="heading"&gt;TL;DR&lt;/div&gt;&#10;&lt;p&gt;Blocking happens when one session waits for a lock held by another session. To find out &lt;em&gt;who&lt;/em&gt; blocks &lt;em&gt;what&lt;/em&gt;, you enable the &lt;code&gt;blocked process threshold&lt;/code&gt; and start an Extended Events session that records a report every time a block exceeds that threshold. You let it run for a few days, compress the &lt;code&gt;.xel&lt;/code&gt; files and send them for analysis. The impact on production is negligible.&lt;/p&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;This page is a procedure to follow from start to finish. If you are in a hurry, the five steps are: &lt;a href="https://www.pachadata.com/en/docs/howtos/performance/blocking/#step-1--set-the-blocked-process-threshold"&gt;set the threshold&lt;/a&gt;, &lt;a href="https://www.pachadata.com/en/docs/howtos/performance/blocking/#step-2--create-and-start-the-event-session"&gt;create the session&lt;/a&gt;, &lt;a href="https://www.pachadata.com/en/docs/howtos/performance/blocking/#step-3--let-the-collection-run"&gt;let it run&lt;/a&gt;, &lt;a href="https://www.pachadata.com/en/docs/howtos/performance/blocking/#step-4--collect-and-send-the-files"&gt;collect the files&lt;/a&gt;, &lt;a href="https://www.pachadata.com/en/docs/howtos/performance/blocking/#step-5--clean-up"&gt;clean up&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Use ABORT_QUERY_EXECUTION to block query execution in SQL Server 2025</title><link>https://www.pachadata.com/en/docs/howtos/performance/abort-query-execution/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.pachadata.com/en/docs/howtos/performance/abort-query-execution/</guid><description>&lt;p&gt;&lt;code&gt;ABORT_QUERY_EXECUTION&lt;/code&gt; is a new query hint (SQL Server 2025 / 17.x) designed as an emergency brake: it blocks future executions of a query you have identified as a problem — excessive CPU or I/O consumption, a runaway query, non-essential reporting that endangers a critical workload, and so on.&lt;/p&gt;&#10;&lt;p&gt;Added as a query hint, it makes the query fail immediately.&lt;/p&gt;&#10;&lt;p&gt;Its real value in production comes from combining it with a &lt;strong&gt;Query Store Hint&lt;/strong&gt;: you can block one specific query, identified by its &lt;code&gt;query_id&lt;/code&gt; in the Query Store, without touching the application code.&lt;/p&gt;</description></item><item><title>Fix cardinality estimator problems</title><link>https://www.pachadata.com/en/docs/howtos/performance/cardinality-estimator/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.pachadata.com/en/docs/howtos/performance/cardinality-estimator/</guid><description>&lt;p&gt;Execution plans define the strategy used to run a query, and are built by the query optimizer. That optimizer is cost-based: to do a good job, it has to estimate the volume of data the query will handle, which is called cardinality estimation&lt;sup id="fnref:1"&gt;&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref"&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;&#10;&lt;p&gt;Getting that estimate right matters. A bad estimate produces a bad plan, and very poor performance.&lt;/p&gt;&#10;&lt;p&gt;Cardinality estimation rests on two pillars:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;statistics, which must be updated regularly;&lt;/li&gt;&#10;&lt;li&gt;the Cardinality Estimator (CE), which estimates the complex cases from &lt;em&gt;heuristics&lt;/em&gt; — that is, from assumptions.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;The CE heuristics were largely implemented in SQL Server 7, in the late 1990s. They were completely reworked in SQL Server 2014, and that reworked version is what people call the &lt;strong&gt;new CE&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Get an execution plan</title><link>https://www.pachadata.com/en/docs/howtos/performance/execution-plan/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.pachadata.com/en/docs/howtos/performance/execution-plan/</guid><description>&lt;p&gt;Every query is optimized by the SQL Server query optimizer, which builds an execution plan — also called a query plan — to decide the strategy the execution engine will follow.&lt;/p&gt;&#10;&lt;p&gt;Looking at that plan is how you find opportunities to optimize a query.&lt;/p&gt;&#10;&lt;p&gt;There are two of them:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;the &lt;em&gt;estimated&lt;/em&gt; plan, more accurately described as the plan before execution;&lt;/li&gt;&#10;&lt;li&gt;the &lt;em&gt;actual&lt;/em&gt; plan, more accurately described as the plan after execution.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="estimated-plan"&gt;Estimated plan&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Display the plan &lt;strong&gt;before&lt;/strong&gt; execution by selecting a query in SSMS and pressing &lt;strong&gt;Ctrl+L&lt;/strong&gt;.&lt;/li&gt;&#10;&lt;li&gt;You can also use this button in the SSMS toolbar.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;&lt;img src="https://www.pachadata.com/images/docs/howtos/execution-plan_media/execution-plan-01.png" alt="Estimated execution plan button in the SSMS toolbar"&gt;&lt;/p&gt;</description></item><item><title>Fix implicit conversions</title><link>https://www.pachadata.com/en/docs/howtos/performance/implicit-conversions/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.pachadata.com/en/docs/howtos/performance/implicit-conversions/</guid><description>&lt;h2 id="the-problem-with-implicit-conversions"&gt;The problem with implicit conversions&lt;/h2&gt;&#10;&lt;p&gt;Implicit conversions happen when SQL Server has to convert one data type into another in order to perform an operation.&lt;/p&gt;&#10;&lt;p&gt;For example, if you compare a &lt;code&gt;VARCHAR&lt;/code&gt; column with an &lt;code&gt;NVARCHAR&lt;/code&gt; value, SQL Server has to convert the column value to &lt;code&gt;NVARCHAR&lt;/code&gt; before it can make the comparison.&lt;/p&gt;&#10;&lt;p&gt;That can turn a fast index seek into a full table scan.&lt;/p&gt;&#10;&lt;p&gt;Here is a query that causes the problem:&lt;/p&gt;</description></item><item><title>Optimize SQL queries</title><link>https://www.pachadata.com/en/docs/howtos/performance/queries/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.pachadata.com/en/docs/howtos/performance/queries/</guid><description>&lt;blockquote&gt;&#10;&lt;p&gt;What methodology can you use to optimize your Transact-SQL queries?&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;h2 id="hypotheses"&gt;Hypotheses&lt;/h2&gt;&#10;&lt;p&gt;Query performance problems can come from:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;A bad data model;&lt;/li&gt;&#10;&lt;li&gt;Badly written queries that run too long;&lt;/li&gt;&#10;&lt;li&gt;Row-at-a-time rather than set-based behaviour (&lt;em&gt;RBAR&lt;/em&gt;);&lt;/li&gt;&#10;&lt;li&gt;Trigger execution, or transactions that run too long;&lt;/li&gt;&#10;&lt;li&gt;Missing indexes;&lt;/li&gt;&#10;&lt;li&gt;Waits, on query parallelism for instance;&lt;/li&gt;&#10;&lt;li&gt;Execution plan, compilation and &lt;em&gt;parameter sniffing&lt;/em&gt; problems.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;h2 id="a-bad-data-model"&gt;A bad data model&lt;/h2&gt;&#10;&lt;p&gt;A bad data model is hard to fix. You can:&lt;/p&gt;</description></item><item><title>Enable and use the Query Store</title><link>https://www.pachadata.com/en/docs/howtos/performance/query-store/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.pachadata.com/en/docs/howtos/performance/query-store/</guid><description>&lt;p&gt;The Query Store is a SQL Server feature, available since the 2016 version, that keeps and aggregates query performance information.&lt;/p&gt;&#10;&lt;div class="alert alert-success" role="alert"&gt;&lt;div class="h4 alert-heading" role="heading"&gt;TL;DR&lt;/div&gt;&#10;&lt;p&gt;&lt;strong&gt;Enable the Query Store on all your databases.&lt;/strong&gt; It is an essential tool for diagnosing performance problems, and its impact on performance is negligible. Leaving it off means giving up the information you need to understand and fix execution plan regressions.&lt;/p&gt;&#10;&lt;/div&gt;&#10;&lt;h2 id="enable-the-query-store"&gt;Enable the Query Store&lt;/h2&gt;&#10;&lt;p&gt;You can enable the Query Store, or check that it is already enabled, from the database properties.&lt;/p&gt;</description></item><item><title>Read Committed Snapshot</title><link>https://www.pachadata.com/en/docs/howtos/performance/rcsi/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.pachadata.com/en/docs/howtos/performance/rcsi/</guid><description>&lt;p&gt;The Read Committed Snapshot Isolation (RCSI) option removes blocking between reads and writes in a database, by switching to an optimistic concurrency model based on row versioning.&lt;/p&gt;&#10;&lt;p&gt;Enable it with T-SQL rather than through the SSMS interface. The activation needs exclusive access to the database, and the &lt;code&gt;ROLLBACK IMMEDIATE&lt;/code&gt; option below &lt;strong&gt;disconnects every user from the database&lt;/strong&gt;. Plan it accordingly with the application owners.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-sql" data-lang="sql"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;USE [master]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;GO&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;ALTER&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;DATABASE&lt;/span&gt; [&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;database&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;SET&lt;/span&gt; READ_COMMITTED_SNAPSHOT &lt;span style="color:#66d9ef"&gt;ON&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;WITH&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;ROLLBACK&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;IMMEDIATE&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;GO&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Replace &lt;code&gt;&amp;lt;database&amp;gt;&lt;/code&gt; with the name of your database.&lt;/p&gt;</description></item><item><title>Troubleshoot performance problems</title><link>https://www.pachadata.com/en/docs/howtos/performance/troubleshooting/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.pachadata.com/en/docs/howtos/performance/troubleshooting/</guid><description>&lt;blockquote&gt;&#10;&lt;p&gt;If your SQL Server is slow, you absolutely must gather evidence, so that you do not assume problems — and solutions — that have nothing to do with the actual issue.&lt;/p&gt;&#10;&lt;p&gt;If you were a doctor, would you prescribe a treatment without making a diagnosis first?&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;h2 id="hypotheses"&gt;Hypotheses&lt;/h2&gt;&#10;&lt;p&gt;Where can performance problems come from?&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;An undersized server;&lt;/li&gt;&#10;&lt;li&gt;Bad configuration of SQL Server or of the databases;&lt;/li&gt;&#10;&lt;li&gt;Badly written queries that run too long;&lt;/li&gt;&#10;&lt;li&gt;Excessive round trips between the client and the server;&lt;/li&gt;&#10;&lt;li&gt;Blocking caused by too much locking;&lt;/li&gt;&#10;&lt;li&gt;Trigger execution, or transactions that run too long;&lt;/li&gt;&#10;&lt;li&gt;Missing indexes;&lt;/li&gt;&#10;&lt;li&gt;Waits, on query parallelism for instance;&lt;/li&gt;&#10;&lt;li&gt;The client code, rather than SQL Server itself;&lt;/li&gt;&#10;&lt;li&gt;Execution plan, compilation and &lt;em&gt;parameter sniffing&lt;/em&gt; problems.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;h2 id="how-to-test-the-hypotheses"&gt;How to test the hypotheses&lt;/h2&gt;&#10;&lt;h3 id="undersized-server"&gt;Undersized server&lt;/h3&gt;&#10;&lt;p&gt;SQL Server runs perfectly well on modest hardware, provided the database and the queries are optimized.&lt;/p&gt;</description></item><item><title>SQL Server Parallelism: Configuring MAXDOP and Cost Threshold</title><link>https://www.pachadata.com/en/docs/howtos/performance/parallelism/</link><pubDate>Wed, 28 Jan 2026 00:00:00 +0000</pubDate><guid>https://www.pachadata.com/en/docs/howtos/performance/parallelism/</guid><description>&lt;div class="alert alert-success" role="alert"&gt;&lt;div class="h4 alert-heading" role="heading"&gt;TL;DR&lt;/div&gt;&#10;&lt;p&gt;SQL Server&amp;rsquo;s default parallelism settings are unsuitable for most production environments.&#10;Key recommendations to optimize your performance:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Increase the &lt;strong&gt;Cost Threshold for Parallelism&lt;/strong&gt; to &lt;strong&gt;50&lt;/strong&gt; to avoid parallelism on small queries.&lt;/li&gt;&#10;&lt;li&gt;Set the &lt;strong&gt;Max Degree of Parallelism (MAXDOP)&lt;/strong&gt; to &lt;strong&gt;4&lt;/strong&gt; for OLTP workloads, and never exceed &lt;strong&gt;8&lt;/strong&gt;.&lt;/li&gt;&#10;&lt;li&gt;Use &lt;strong&gt;Database Scoped Configurations&lt;/strong&gt; (SQL Server 2016+) to define database-specific settings.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;SQL Server can use multiple CPU cores to execute a single query, a technique called &lt;strong&gt;parallelism&lt;/strong&gt;.&#10;This can improve performance for heavy queries, but when misconfigured, it can also lead to significant slowdowns and CPU resource contention.&lt;/p&gt;</description></item></channel></rss>