Databases and DevOps, Tools are the Easy Part

DevOps
Moving your database development, deployment and management into a DevOps methodology does involve choosing and implementing tools and tooling. Tools are a necessary aspect of DevOps because, one of the fundamentals of implementing a DevOps approach is automation. To automate, you need the right tools. However, tools and automation, while they represent a lot of work, are actually the easy part of the process of moving into DevOps. What's the hard part? Changing how you do things. Change is Hard One of the fundamental questions you need to learn when you start to implement a DevOps approach consists of a single word: Why. "We always manually run a script in staging prior to running it in production." Well, why? Why can't that be automated? Is there a reason that the…
Read More

What Is The Preferred Join Operator in SQL Server?

SQL Server 2005, SQL Server 2008, SQL Server 2012, SQL Server 2014, SQL Server 2016, SQL Server 2017, TSQL
I schedule many of my blog posts at least 2-3 weeks out, so I have time to adjust them, change, them, insert new things into the schedule, what have you. So, as you read this, I'll have written it at least two weeks ago. As I write this, I'm recovering from a very mild, but irritating, cold. I needed to write a blog post, but my stuffed head wasn't coming up with ideas. So, I half-jokingly asked Twitter for any execution plan questions so I could write something. First response, also a joke, was the question at the title of this post: What is the preferred operator when joining tables: Hash Match, Nested Loops or Merge? While my immediate response to this question is, yes. Meaning, they're all preferred, situationally.…
Read More

Why Aren’t You Using SSMS 17?

SQL Server 2005, SQL Server 2008, SQL Server 2012, SQL Server 2014, SQL Server 2016, SQL Server 2017
Last fall, Microsoft split the coding and release of SQL Server Management Studio away from any dependency on the server code. With that, they began an aggressive and exciting series of releases with exciting new functionality in each release. However, you don't care. How do I know? I've seen the telemetry that shows that most of you are still using old versions of SSMS. I want to know why. Please, post comments below so I can understand. Why You Should Move to SSMS 17 There are a ton of reasons for you to make the move. The least of which is bug fixes are coming hot and fast. The more exciting things are the ability to compare execution plans or the new Extended Events sessions that look just like those…
Read More

My Speaking Schedule

Misc
I have quite a few speaking engagements coming up. Rather than an intermittent blog post, I've decided to have a permanent home for this information. If you want to know where to get in touch with me, go to this page of my blog. I'll keep a rolling update of all the events I have coming up. Also, if you want me to speak at your event, it might be a good idea to look to see if I'm already scheduled, or, if I'm going to be right in your area already (I'm happy to go to local user groups if I'm free). I hope this page is helpful. I'll still occasionally promote a particular event with a blog post or links at the bottom of other posts. Anything I…
Read More

Database Fundamentals #17: Learning T-SQL

Database Fundamentals
While SQL Server Management Studio (SSMS) provides a robust graphical user interface (GUI), the commands you're going to use the most to control databases and the data within them in SQL Server are going to be done through T-SQL. Therefore, you really need to spend time learning how to write, read, and edit T-SQL. Previous posts in the Fundamentals series have showed how to INSERT, UPDATE and DELETE data using T-SQL. Next, we're going to learn SELECT. However, I want to show you a crutch you can use as you get started learning how to write T-SQL, the Query Designer window. The instruction on this topic is only meant to provide a mechanism to focus on the more important topic, learning T-SQL. However, this may be an easier path for…
Read More

Plan Metrics Without the Plan: Trace Flag 7412

SQL Server 2014, SQL Server 2016, SQL Server 2017, TSQL
I place a lot of emphasis on capturing actual execution plans because of the runtime metrics, but with Trace Flag 7412, we don't need the plan. This is great news, because capturing execution plans, even using extended events, is an expensive proposition. However, using either the query_thread_profile event, or, Trace Flag 7412, we can get the runtime metrics without the plan. Trace Flag 7412 Here's how it works.You can either be running the extended event, query_thread_profile (a debug event, but one documented and supported by Microsoft) or, enable the Trace Flag 7412. I like to use the extended event in a targeted fashion to easily see behaviors on a query without having to capture the plan. You can even capture the information and then combine it with an estimated plan…
Read More

SQL in the City Streamed: June 2018

DevOps, Red Gate Software
Next week, Redgate Software, will be putting on SQL in the City Streamed. These events are a great way to learn about SQL Server, the Microsoft Data Platform, privacy and protection, the GDPR, and, of course, DevOps. All of that, with some great information on Redgate tools and how they can help tossed in there. Agenda Scroll down at the link and check out the agenda. We're covering a pretty wide range of topics this time. I have the keynote, and I'm not going to tell you what it's about yet. OK. I'll tell you a little. Twist my arm. I have a message about DevOps that I think is very important. When it comes to the database, we frequently think about development and deployment as nothing but change, and…
Read More

Extended Events, the system_health Session, and Waits

SQL Server 2008, SQL Server 2012, SQL Server 2014, SQL Server 2016, SQL Server 2017, TSQL
I advocate for, use, document, teach, and just downright love, Extended Events. They are so much better than the old Trace Events (aka, Profiler) that it's sometimes difficult to keep from just gushing. Let's talk about a common situation that you're going to run into on your servers all the time and how you can put Extended Events to work to help you, without actually doing any work at all. What's that? Be lazy and get rewards? Yes. The Extended Events system_health Session On your servers, any of them that are SQL Server 2008 or newer, right now, unless you've performed actions to prevent this, you're running the Extended Events system_health session. It's just happening, currently, on all your servers. Nothing you need to do about it at all. I'll…
Read More

Query To Retrieve Statistics Data: dm_db_stats_histogram

SQL Server 2017, TSQL
Starting with SQL Server 2016 Sp1 CU2, a new way of directly querying statistics, specifically the histogram, has been introduced: dm_db_stats_histogram. We've always been able to query the statistics using DBCC SHOW_STATISTICS. However, the output, three different result sets with three different structures, made automating access to statistics information a pain. Now, we have more capability through dm_db_stats_histogram. dm_db_stats_histogram To access the information in dm_db_stats_histogram, you just have to pass in the object_id and the statistics_id values for the statistics you're interested in like this: [crayon-5b51bb5f63439334512942/] It's very straight forward to use. The results look like this: Handy right? Now you can query the histogram directly. Yeah, I hear a few of you saying... and this helps me... how? Here's an example. This query will quickly find the rang_hi_key value…
Read More

Why PASS?

PASS
In case this is your first time hearing of it, PASS is the single largest community of Microsoft Data Platform professionals on the planet. It consists of local groups, virtual groups, multiple online events, SQLSaturday, and, to pay for it all, PASS Summit. However, that's not true. It consists of a whole bunch of our peers, people, data pros and developers, trying to do better and be better. PASS I'm currently serving, as an unpaid volunteer, on the Board of Directors of the PASS organization. Actually, truth be told, I'm sitting as president of the board. That means that I'm responsible for the whole shooting match. Our goals are really simple. We want to create as many possible ways for you, me, and all our peers to connect, share and…
Read More