Execution Plans and the GDPR

SQL Server, SQL Server 2016, SQL Server 2017
What? Execution plans and the GDPR? Is this it? Have I completely lost it? Well, no, not on this topic, keep reading so I can defend myself. GDPR and Protected Data The core of the GDPR is to ensure the privacy and protection of a "natural person's" information. As such, the GDPR defines what personal data is and what processing means (along with a bunch of additional information). It all comes down to personally identifying (PI) data, how you store it, and how you process it. More importantly, it's about the right for the individual, the natural person, to control their information, up to and including the right to be forgotten by your system. OK. Fine. And execution plans? Execution Plans and PI Data If you look at an execution…
Read More

Every Single Execution Plan is an Estimated Plan

SQL Server, SQL Server 2016, SQL Server 2017
All the execution plans are estimated plans. All of them. There fundamentally isn't any such thing as an "Actual" plan. Where Do You Get Execution Plans? There are a lot of sources for execution plans. You can capture them using extended events (or, if you must, trace). You can capture them through the Management Studio gui. You can also capture them from the SQL Operations Studio gui. You can query the cache through the DMVs and pull them in that way. You can look at plans in query store. All these resources, yet, for any given query, all the plans will be identical (assuming no recompile at work). Why? Because they're all the same plan. Each and every one of them is an estimated plan. Only an estimated plan. This…
Read More

YouTube Channel Update

Misc
Hey! Here's the latest on my YouTube Channel. Click on through and subscribe. I'll be doing lots of stuff on the Microsoft Data Platform, GDPR, DevOps, Redgate, and all sorts of IT related information. Here are the last couple of weeks worth of videos: Very popular was my discussion of the idea that the reason DBAs don't adopt the latest and greatest piece of shiny is because we're all beholden to vendors instead of trying to make good decisions for our the organizations that pay us (as if the "best" decision is to always grab the new shiny). OK, I'm giving away my thoughts, here's the video: [embedyt] https://www.youtube.com/watch?v=0TVeRSc3gLg[/embedyt] Next most popular was my question, so, if we're not resisting change because of vendor lock (and we're not) why are…
Read More

Precons in Richmond, Philadelphia and New York

Professional Development
I love when I get the opportunity to present at SQLSaturday events. Even more than that, I love when I get the opportunity to do a precon at a SQLSaturday event. Well, I've got three coming up. All three are an all day session entitled "SQL Server Tools for Query Tuning." Seating at all the events is limited, so please register early. First, in Richmond, on March 23, 2018, you can register here. Then, I'll be in Philadelphia on April 20, 2018. You can sign up here for that event. I will be in New York, NY, my old stomping grounds, May 18, 2018. Go here to register for that event. I hope to see you at one of these events where I'll do my best to share as much…
Read More

Adaptive Joins

T-SQL
I was surprised to find out that a lot people hadn't heard about the new join type, Adaptive join. So, I figured I could do a quick overview. Adaptive Join Behavior Currently the adaptive join only works with columnstore indexes, but according to Microsoft, at some point, they will also work with rowstore. The concept is simple. For larger data sets, frequently (but not always, let's not try to cover every possible caveat, it depends, right), a hash join is much faster than a loops join. For smaller data sets, frequently, a loops join is faster. Wouldn't it be nice if we could change the join type, on the fly, so that the most effective join was used depending on the data in the query. Ta-da, enter the adaptive join.…
Read More

GDPR: Your Hair Is Not On Fire

DevOps, Professional Development
Along with a lot of other people, I've been attempting to call people's attentions to the new General Data Protection Regulation (GDPR) that was created two years ago and becomes effective in May of this year. The regulation defines processes and practices around the privacy and protection of personal data of any EU citizen. While the regulation is defined by the EU, since it's applicable to the data of EU citizens, the applicability is anywhere that data may exist, even in other countries. So, the GDPR applies to you and your data if you have EU citizens data in your databases. Different countries have trade treaties in effect with the EU which will allow the EU to enforce this, even though you and your data are located somewhere else. None…
Read More

Wait Statistics on a Query

SQL Server, SQL Server 2016, SQL Server 2017
Wait statistics are a vital part of understanding what is causing your system to run slowly. Capturing them can be done through a variety of mechanisms from sys.dm_os_wait_stats (use this query for that) to sys.dm_db_wait_stats in Azure SQL Database. Those cover the system and the database, however, what about capturing query wait statistics on a specific query? Query Wait Statistics There was a time when this was actually kind of difficult. However, now we have a lot of different tools to capture query wait statistics. First up, and really, one of the best and easiest ways to deal with this, is to use the wait statistics captured by the Query Store. The only drawback to this method is that it is an aggregation of query wait statistics for the given…
Read More

Youtube Channel Update

Misc
Hello, I just wanted to take a moment to promote the work I've been doing with the YouTube Channel. I've published four videos in the last week. The most popular was an introduction to the GDPR: [embedyt] https://www.youtube.com/watch?v=uADi45AVUM4[/embedyt] I'll be talking about that quite a bit more in the coming weeks. I thought this video which shows you how to compare plans in SQL Server Management Studio would be more popular: [embedyt] https://www.youtube.com/watch?v=KHnZCtUAo44[/embedyt] However, this one showing wait statistics in execution plans seems to be getting more hits: [embedyt] https://www.youtube.com/watch?v=hTf82c6L4oE[/embedyt] Finally, my comparison between the mistaken missile alerts in Hawaii and database design fell over flat. No one was all that interested: [embedyt] https://www.youtube.com/watch?v=MYy9xmieFmM[/embedyt] I hope these videos are proving as useful to you as the blog posts I do…
Read More

You Need a New Hobby

Misc
Not sure who this is that is attempting to hack into my blog so desperately, but seriously, time for a new hobby: administrador 202.137.154.1 20 mins ago administrador 186.101.223.223 1 hour 41 mins ago administrador 115.84.92.197 3 hours 2 mins ago administrador 200.63.105.23 4 hours 20 mins ago administrador 137.59.225.11 5 hours 38 mins ago administrador 181.198.216.161 6 hours 56 mins ago admin 168.195.206.130 9 hours 36 mins ago admin 115.84.92.48 10 hours 55 mins ago admin 200.43.234.138 12 hours 14 mins ago admin 115.84.92.3 13 hours 33 mins ago admin 115.84.99.18 14 hours 48 mins ago admin 187.189.27.236 16 hours 7 mins ago admin 103.1.94.110 17 hours 26 mins ago admin 177.19.164.181 18 hours 44 mins ago admin 202.137.141.190 20 hours 5 mins ago admin 186.101.223.216 21 hours 25…
Read More

Database Fundamentals #16: Removing Data With T-SQL

Database Fundamentals
Deleting data from a table using T-SQL works quite a lot like the UPDATE statement. How it Works In the same way you supply the statement, DELETE, and then the table name. You’re not going to specify columns in any way because deleting data is all about removing a row. If you just wanted to remove the values in a column, you would use the UPDATE statement. Because of this, the only other thing you need for a DELETE statement is the WHERE clause. Just like with the UPDATE statement, if you don’t supply a WHERE clause, then the DELETE statement will remove all data in the table. Be very careful about using this statement. Make sure you’ve always got a WHERE clause. This example would delete all the rows…
Read More