• Library
  • Sample DBs
  • RU
  • About

Query Plan on a Busy Server

Posted on February 18, 2016 by Dmitry Pilugin Posted in memory, query plan 1 Comment

Yesterday I came across a question on one of SQL forums, that I may rephrase like:

“Does a query plan compilation depend on how busy is SQL Server”.

Before we go further, I should explicitly mention that we talk about a Compiled plan, not an Executable plan. Plan execution will of course depend on how busy is server, for example, the query may wait for the memory grant to start execution, or execution may be slow because there are no cached pages in the Buffer Pool etc.

However, the question was about a Compiled plan: does the shape of a plan depend on the server load.

From the first glance it should not. But…

Read…

busy server memry limit exceeded reason for early termination TF 8780

Query Trace Column Values

Posted on December 2, 2015 by Dmitry Pilugin Posted in query execution

Sometimes, when I saw expressions like ‘Expr1002’ or ‘WindowCount1007’ or something similar in the columns Output List of a query plan, I asked myself, is there a way to project those columns in to the final result to look at the values. That question first came to me out of curiosity when I was playing with window aggregate functions and a Window Spool plan operator in SQL Server 2012, I wanted to look into the Window Spool to understand, how it performs an aggregation.

Interestingly, that SQL Server 2016 CTP3.0 allows us to look deep inside into the iterator and observe the data flowing through it. Let’s turn on an “xRay machine” and take a look.

Read…

query_trace_column_values TF 2486

Runtime Constants Sniffing

Posted on April 15, 2015 by Dmitry Pilugin Posted in query plan

Most of the people knows about the so-called “Parameter Sniffing”. This topic was discussed in many aspects in a number of great articles. It is interesting that not only parameters might be “sniffed” during the first execution, but also a runtime constant functions. Let’s look at the example.

Read…

sniffing

Few Outer Rows Optimization

Posted on April 6, 2015 by Dmitry Pilugin Posted in Nested Loops, Post Optimization Rewrite, query execution

In this blog post, we will look at one more Nested Loops (NL) Join Post Optimization Rewrite. This time we will talk about parallel NL and Few Outer Rows Optimization.

Read…

Post Optimization Rewrite PQTEConvert TF 2329

Batch Sort and Nested Loops

Posted on April 1, 2015 by Dmitry Pilugin Posted in join, Nested Loops, Post Optimization Rewrite, Uncategorized

Continuing my blog post series after 24HOP Russia “Query Processor Internals – Joins”.
In this (and the next one) blog post, we will talk about the Nested Loops Post Optimization Rewrite optimizations.

Read…

Post Optimization Rewrite PQTEConvert TF 2340 TF 8744 TF 9115

Hash Join Execution Internals

Posted on March 20, 2015 by Dmitry Pilugin Posted in join, query execution, query plan

Two days ago, on the 24HOP Russia I was talking about the Query Processor internals and joins. Despite I had three hours, I felt the lack of time, and something left behind, because it is a huge topic, if you try to cover it in different aspects in details. With the few next articles, I’ll try to describe some interesting parts of my talk in more details. I will start with Hash Join execution internals.

Read…

bailout bitmap hash join spill TF 7357 TF 7359

Yet another X-Ray for the QP

Posted on March 4, 2015 by Dmitry Pilugin Posted in query plan, Uncategorized

This post is for the absolutely geeky people. For those that will not afraid when they hear: “query transformation rules”.

Read…

query optimizer rules TF 8628

Partitioned clustered index and FORCESCAN bug

Posted on February 17, 2015 by Dmitry Pilugin Posted in bug, Uncategorized

I would like to share one curios case that I recently came across.

Long story short:
This bug may lead to incorrect results if you use a partitioned table and the FORCESCAN hint.
Connect Item

Read…

bug partitioning

NOLOCK and Top Optimization

Posted on January 7, 2015 by Dmitry Pilugin Posted in query plan, Uncategorized

Sometimes people use nolock hint as a “turbo” button for their queries, assuming that not taking locks will speed up the query execution. There are many good articles describing all the dangerous moments of this approach, because of the read uncommitted isolation level. However, the focus of this article is a performance problem that you may encounter using nolock hint in some cases.
Read…

allocation order scan nolock top uncommited

MTVF and CE Model Variation

Posted on May 7, 2014 by Dmitry Pilugin Posted in cardinality estimation, Uncategorized

This is a short quick note about multi-statement table valued functions (MTVF) and how their cardinality is estimated in the new CE framework.

Read…

mtvf TF 9488

Recent Posts

  • SQL Server 2017: Adaptive Join Internals
  • SQL Server 2017: How to Get a Parallel Plan
  • SQL Server 2017: Statistics to Compile a Query Plan
  • SQL Server 2017: Sort, Spill, Memory and Adaptive Memory Grant Feedback
  • SQL Server vNext: Interleaved Execution for mTVF

Archives

  • May 2017
  • April 2017
  • March 2017
  • February 2017
  • January 2017
  • July 2016
  • February 2016
  • December 2015
  • April 2015
  • March 2015
  • February 2015
  • January 2015
  • May 2014

Tags

adaptive query processing allocation order scan Ascending Key bailout bitmap bug cardinality columnstore estimation process hash join model mtvf nolock partitioning plan construction Post Optimization Rewrite PQTEConvert query optimizer query_trace_column_values rules sniffing spill sql server 2017 statistics TF 2312 TF 2329 TF 2340 TF 2363 TF 2389 TF 2390 TF 2486 TF 7357 TF 7359 TF 8628 TF 8744 TF 9115 TF 9481 TF 9482 TF 9483 TF 9488 TF 9489 top uncommited version vnext
  • Prev
  • 1
  • 2
  • 3
  • Next
© Dmitry Pilugin (SomewhereSomehow), 2014 - 2017