Posts

Showing posts with the label SNIFFING

Speaking to Sql Server, sniffing the TDS protocol

Image
Hello friends!  If yesterday you read my post and found it definitely boring (for the topic of course and not for how it was written to the author 😁) well today I promise you that the topic will be much more interesting! Let's talk about Sniffing , let's talk about going to see what happens when we "log in" or when we send a Query to SQL Server.  We will do this by taking a look to the little known tabular data stream (TDS) protocol built on top of the TCP/IP protocol. Ready! The TDS protocol What is the Tabular data stream (TDS) protocol?  The TDS is the protocol used by the SQL Server client Net-Library to communicates with SQL Server . TDS is specific to SQL Server and it is a low-level protocol that specifies both commands and data in a specific arrangement.  TDS encapsulate the TCP/IP protocol. Sniffing TDS packets you can read from the network the requests that your application do to the SQL Server and read the answer .   How to Sniff data from the ne...

SQL Server and the Plan Guides, An easy way create and utilize!

Image
Hi Guys! First of all I must say a big t hank you for the first five thousands visualizations of this my Blog . I am really very proud of it! Thank you so much!   Today i will show you how to create a Plan Guide in order to resolve, for example, parameter sniffing issues . I hope you enjoy this post! Introduction It was November when we spoke about parameter sniffing (read here. ) We have seen that parameter sniffing is not necessary a bad thing. Parametrization sniffing, instead, could be a problem if your data is distribuited unevenly! Today for this first post of february I will show you a way to solve this problem through the creation of a Plan Guide However, before talking of Plan Guide, we do also a small summary about unevenly distributed data . Let's start! Recap about not evenly distribuited data Suppose we have two tables where we store our orders. OrdTes represents the header of the documents while OrdRig its rows. A document can have on...

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 ...