Query Hash Values, Plan Guides and the Query Store

SQL Server 2016
I was eating dinner with Hugo Kornelis and we started talking about query hash values. You know, like everyone does at dinner. As we talked about it, I suddenly thought about both Plan Guides and the Query Store. I wondered what happened to the query hash values in that case? Thus are blog posts born. Query Hash and Plan Guides The behavior of the query hash itself is fairly straight forward. The text of the query is run through a hashing algorithm within SQL Server and a value comes out, so these two queries: SELECT * FROM Sales.SalesOrderDetail AS sod JOIN Sales.SalesOrderHeader AS soh ON sod.SalesOrderID = soh.SalesOrderID; SELECT * FROM Sales.SalesOrderDetail AS sod JOIN Sales.SalesOrderHeader AS soh ON sod.SalesOrderID = soh.SalesOrderID OPTION (FORCE ORDER); Result in two different query…
Read More

The Age of Data and Software Development

Professional Development
I am so excited to be a data professional in the modern era. Yeah, 15-20 years ago, it was cool to be a DBA and a database developer. However, now, it's amazing. Data drives, or should drive, all our decisions. Whether we're deciding how high to set the cost threshold for parallelism, which query we want to tune, or even which product would serve us best, we should be making these decisions based on data. It's not just about getting the average or the min & max, although, those are the start points. Now, you need to start to take into account standard deviation and you probably should learn how to run a regression analysis. All these tools will make you a better more valuable employee. It's not any different…
Read More

Alerts From Azure Automation

Azure
In a previous post, I showed how to set up statistics maintenance for your Azure databases using Azure Automation. However, what I didn't show was how to generate an alert when things go south. Let's do that now. An Error Needing an Alert First, I need to generate an error. I'm going to modify the code just slightly from the previous example so that it will fail: $Cmd=new-object system.Data.SqlClient.SqlCommand("UPDATE STATISTICS dbo.TableNotInDB", $Conn) If I modify my Runbook with the code above and then run it, I will get an error: This is from the test pane. I strongly recommend you use tests on your PowerShell scripts when writing your own automation. It'll save you a lot of pain trying to troubleshoot things later. Alert on Error Believe it or not,…
Read More

Learning Azure From The Web

Azure
I'm working on a technical blog post that I hope to be putting up soon. I've run into a number of configuration issues that I'm working through. However, it's these issues that sparked this blog post. See, we're learning Azure all wrong. Use Google/Bing What's the first thing you do when you hit a problem on your computer, regardless of the language, the technology, etc.. Wrong! You don't call your son-in-law who "works in computers." That's what my mother-in-law does. We already "work in computers" so we have another resource. Bingle/Ging/Boogle. We run a search. So, let's say for example I'm interested in learning about an Azure Powershell command: Set-AzureRMDiagnosticSetting. Here are the first two results from Google (as of this date, 4/3/2017, or for all my UK friends, 3/4/2017,…
Read More

Random Blogging Challenge Results

Professional Development
The winner is: Everyone. Hey, the challenge was random. I didn't promise a prize or a winner. Instead, I suggested everyone blog based on an image of the great Tom Baker: In no particular order we have: Persist and Aggregate Index Stats Across Server Restarts by Eric Cobb Nice use of the image, incorporating it into an interesting technical post on how to persist your index usage stats. Useful information since this DMV is reset when you restart the server (or fail it over or...). Good technical blog on a useful topic, data about your system. Working with SQLSaturday SpeedPass by Wayne Sheffield +10,000 points for both using the image well and for the PowerShell. -10,000 points for making me comment on a post about PASS (I'm the EVP of…
Read More

Sharing With You In All Fifty States

Misc
I made a mistake the other day. For some reason I got it into my head that I was flying to Albuquerque when I was actually flying to Phoenix. I've no idea how or why that occurred, but I sent a tweet out on how excited I was to finally be visiting and presenting in New Mexico for the first time. Yeah, oops. But here's the deal. It got me thinking. I've been presenting professionally for quite a while. I've visited a lot of places around the world because of this. I want to visit a lot more. I've decided to work closer to home as well as elsewhere. I Want to Speak in All Fifty States I've presented live sessions to user group meetings, SQLSaturdays, Code Camps, and large events all…
Read More

Why You Should Change the Cost Threshold for Parallelism

SQL Server, SQL Server 2016
I've written several times about the Cost Threshold for Parallelism and it's relationship to your execution plans, how to determine your execution plan cost, and even how to decide what value to set your Cost Threshold to. What I haven't explicitly addressed in extremely clear terms is why you should adjust your Cost Threshold for Parallelism. There are two reasons to modify this value. Cost Threshold for Parallelism Default Value The primary reason to change the Cost Threshold for Parallelism is because the default value is not a good choice for the vast majority of systems. The default value is 5. This means that when a query has an estimated cost greater than 5, it may get a parallel execution plan. Microsoft set the default value for the Cost Threshold…
Read More

Help Me, Help You, Deliver DevOps

DevOps
I believe in DevOps. Actually, that's a pretty horrible way to put it. It's not about belief, like keeping Tinkerbell alive. I have successfully worked within an environment that implemented a DevOps approach to development, deployment and maintenance. I also provide classes and consulting on how to approach DevOps from the Ops perspective as well as writing books on the topic. Because I've seen the DevOps approach work, and work well, despite the fact that my principal job description is in the Ops side of DevOps, I am a very strong and passionate advocate for DevOps. But! DevOps Despite the fact that I absolutely support the concepts of DevOps, moving development & deployment into the production space, and moving operations into better support of the development space, I frequently find…
Read More

SQL Clone and a Little Competition

Database Lifecycle Management, DevOps, Redgate Software
Redgate has released a new product, SQL Clone. I've already talked about how excited I am about it. Now, it's your turn to get excited. Our developers evidently had too much time on their hands after building SQL Clone. They created a skill in Alexa that lets you clone a database using voice commands. In fact, I was recently visiting Redgate HQ and was able to try it out and you can watch here. [embed]https://www.youtube.com/watch?v=1zI2Oj9EZM8&feature=youtu.be[/embed] Now, in celebration of the launch of SQL Clone, we want to enable you to do some voice commands of your own. We're giving away five Amazon Echo Dots and one copy of SQL Clone to an overall winner. To enter, go into the comments and let us know what skill you would like to build for Alexa…
Read More

Random Blog Post Challenge

Misc
OK, for no particular reason at all or maybe because I had too much food at lunch or just because Jason Hall gave me the idea, here's a blog post challenge for anyone who wants to take it up. Write a technical blog post that incorporates this image: Link back to here and I'll put together an aggregation and assessment of all the posts. Why this image? It's Tom Baker as Dr. Who. That's reason enough. This is just having a little fun. No ulterior motives, requirements, etc. Let's play!
Read More