Posts

Showing posts with the label Parameter Sniffing

SQL Server 2022 and the Parameter Sensitive Plan Optimization (PSP) with example

Image
Hi guys, Today we will start talking about the features that the new SQL Server 2022 bring us. We have already talked about it here. In particular, today I want to talk to you about the new feature called   Parameter Sensitive Plan Optimization or PSP . This feature is part of the family of features known as Intelligent Query Processing and aims to improve the performance of existing workloads. I want to remark that this is a big performance improvement and one of the main highlights of this new version of SQL Server .   This improvement comes at no cost and without any changes to the application code. Parameter Sensitive Plan (PSP) Optimization   Starting from the idea that creating an execution plan (determine which is the best way to solve a Query) require resources and time. Microsoft has developed into SQL Server 2022 a mechanism to save and reuse created execution plans. Briefly, the first time a query is executed its execution plan is created and stored in th...

SQL Server, the Parametrization and the Parameter Sniffing

Image
Hi Guys, What I want to do today is an experiment . In fact this is my first article written in English. I don't know at the moment if it will be the last. But what is certain is that, as usually, i will try to tell you each topic in a simple and clear way! Enjoy the reading! In my previous article i showed you a little tip , today instead i will tell you a little about theory. We will talk about parameterization and a phenomenon called parameter sniffing . But now to introduce the topic lets start with... The history of the execution of a Query Today's question is?   What happens when i run a query? Well, as you can imagine, solving a query is a process that requires many steps. These steps, how can be see from the drawing below, are: The Parsing phase The first of these steps is called parsing . During the parsing (the parser) checks our T-SQL String for proper syntax (eg. you write the words " SLECT " or " FRON ") At the ...