Database Configuration

Azure, SQL Server 2016
It's amazing just how much the landscape changed with the release of SQL Server 2016 SP1. For example, I just found out that you can disable parameter sniffing at the database level using the database configuration. Not only does this work for SQL Server 2016 SP1, but it's enabled for Azure SQL Database. How Database Configuration Works The syntax is very simple and documented here. So, if I want to disable parameter sniffing for a single database, I can do this: ALTER DATABASE SCOPED CONFIGURATION SET PARAMETER_SNIFFING = OFF; That's it. Done. It works from within the database and doesn't require rebooting or anything else. Changing this setting does flush the cache of all the execution plans for that database. No other actions are necessary. You can control parameter sniffing at the…
Read More

PASS Board: Year-End Wrap-Up

PASS
This month concludes my second full year on the PASS Board of Directors and my first full year on the Executive Committee. This year has been exciting, challenging, educational, and, I truly believe, useful to the organization. We've accomplished a lot. We will do more. Year In Review I have two primary responsibilities as the Executive Vice President – Finance and Governance. Firstly, I am responsible for PASS’ budget.  Secondly, I am responsible to oversee the governance of PASS. Here's how the year went on these two topics. Finance At the beginning of the year, our primary focus is to ensure that the various directors in charge of different portfolios are getting ready for the annual budget. Our fiscal year runs from July to June. A significant amount of work is spent…
Read More

OPTIMIZE FOR Hints When Parameter Sniffing is Turned Off

Azure, SQL Server, SQL Server 2016, T-SQL
While presenting recently and talking about dealing with bad Parameter Sniffing, I got the question; what happens to OPTIMIZE FOR hints when parameter sniffing is disabled? This is my favorite kind of question because the answer is simple: I don't know. Parameter Sniffing For those who don't know, parameter sniffing is when SQL Server uses the precise values passed into a query as a parameter (this means stored procedures or prepared statements) to generate an execution plan from the statistics using the value from the parameter. Most of the time, parameter sniffing is either helping you, or is not hurting you. Sometimes, parameter sniffing turns bad and hurts you quite severely. Usually, but not always, this is because you either have severely skewed data (some data is very different than the rest, lots…
Read More

Presentations for SQL Server Beginners

Azure, PASS, PowerShell, Professional Development, SQL Server, SQL Server 2016
[caption id="attachment_2548" align="alignleft" width="300"] Tired from all those blog posts[/caption] For my final blog post in the #gettingstarted, #iwanttohelp series, I decided to curate a set of presentations from the PASS Virtual Chapters. This content is available online. It's free. Most importantly for the person just getting started as a SQL Server data pro, it's good. I'm going to marry each of the presentations with my eleven blog posts in this series. The Importance of a Full Backup in SQL Server For this one I'm going to recommend Tim Radney's session Understanding SQL Server Backup and Restore. I know Tim personally and guarantee this is a good session. Why Is The Server Slow Jes Borland is a very close personal friend and an absolutely outstanding presenter (and person). She has…
Read More

Database Clone

SQL Server 2016, T-SQL
There are a bunch of ways you could create a database clone. Backup and restore is one method. Export/Import is another. There are even third party tools that will help with that. However, each of these has a problem. It's moving all the data, not just once, but twice. You move the data when you export it and you move it again when import it (same thing with backup and restore). That makes these methods slow for larger databases. How can you create a database clone without moving the data multiple times? Don't Move the Data At All New with SQL Server 2016, expanded in SP1, and added to SQL Server 2014 SP2 is a new command, DBCC CLONEDATABASE. This is like a dream come true. The use is extremely…
Read More

PowerShell to Test a Query

DevOps, PowerShell, SQL Server, SQL Server 2016, T-SQL
So you want to do some tuning, but you're not sure how to test a query on it's performance. Not a problem. Here's a very rough script that I use to do some recent testing. This script to test a query is post #11 of the #enterylevel #iwanttohelp effort started by Tim Ford (b|t). Read about it here. The Script The goal here is to load a bunch of parameter values from one table and then use those values to run a query to test it. To do this I connect up to my SQL Server instance, naturally. Then I retrieve the values I'm interested in. I set up the query I want to test. Finally a loop through the data set, calling the query once for each value. [reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | out-null #…
Read More

SQL Server on Linux: Boring

SQL Server 2016
As a concept, SQL Server on Linux is thrilling. Due to this, the OS doesn't stand in the way of taking advantage of everything that SQL Server offers. Because we have Linux, we have opportunity for all sorts of new fun. I first saw SQL Server running on Linux about six months ago. The install was shockingly easy. I saw a few command line commands run and it all looked good. I didn't have the opportunity to set up my own full blown install then, but I do now. My Installation Today I did all the work necessary to get this thing running. I got a copy of Ubuntu Desktop and put it on VMWare Workstation in a virtual machine. That was a painless process. SIDE NOTE: It was a painless process…
Read More

Query Data Store Data

SQL Server 2016, T-SQL
The data in the Query Data Store is what makes all the magic happen. From collecting the aggregate performance metrics of a query to the various plans in use by that query to being able to force a plan, it's all controlled by the data within the Query Data Store system tables. The Question When I was presenting on this topic at the PASS Summit a few weeks ago, one great question came up (great question = answer is "I don't know"), well, I defaulted to an "I don't know" answer, but my guess was, "No." The question was: can you take a plan from one server, let's say a test server, export it in some way, and then import it to production? In this manner, you ensure that a…
Read More

Book Review: Marshmallow Test

Professional Development
Different people approach their career in different ways. My working assumption, all the time, is that I don't know enough and I'm not good enough. Don't get me wrong, I've got an ego (way too big of one really). I just know that there's room for improvement. It's one of the reasons I read books like the Marshmallow Test. The core concept is simple. You show a kid a treat, a marshmallow. You let them know that they can have that marshmallow right now, or, if they wait, they have two later. Kids who choose to wait, and succeed in waiting, generally do better in life, have better jobs, lower BMI, all sorts of things. It's about discipline and self-control, and even more importantly, delayed gratification. "Yeah, I can something…
Read More

Azure Data Platform Learning Resources

Azure
I know that more and more of you are moving more and more resources into the Azure Data Platform. In an effort to help you learn about all that Azure offers I created a GitHub repository of blogs, teachers, courses, etc. It's open to the community to update. New material has been recently added and there will be more and more all the time. Check it out. If you know of resources that should be listed there, please issue a branch pull and add them right in. This is your resource.
Read More