Can You See Who Forced a Plan

SQL Server
I had an excellent group of people in Gothenburg Sweden when I taught there and I was asked: Can You See Who Forced a Plan? I didn't know the answer for certain, so I said what I always say: I don't know, but I'll see if I can find out. Query Store System Views One of the first places I'd look to see who forced a plan is the system views in Query Store. No, I don't think it'll be there, but it's worth a look. The obvious place it could be is sys.query_store_plan. After all, that's where a plan will be marked as is_forced. But you look through that and there's nothing about who forced a plan. And looking through the other views, there's nothing showing that. So, this…
Read More

Missing Columns in Extended Events Live Data Explorer

SQL Server
Let me be extremely clear up front, this is not my original work. I saw this post on DBA.StackExchange.com and I wanted to share and promote it. Nice work FevziKartal. The rest of this post is just me replicating work already done by others. I just want to see it in action. Columns in Live Data Explorer Back when I wrote the 2017 version of my query performance tuning book (no link, a) get the 2022 version for reasons I'm about to explain, b) this post is just about testing FevziKartal's work, not self-promotion), I was on board with #TeamXE. Jonathan Kehayias had taken me under his wing and explained the virtues of Extended Events and I was sold. I was also grossly ignorant. I thought that the way you…
Read More

AWS RDS PostgreSQL Restore to a Point in Time

AWS, PostgreSQL, RDS
One of the single biggest reasons to go with a Platform as a Service (PaaS) offering like AWS RDS are the things it does for you, like making it really easy to restore to a point in time. Let's take a look at it. Restore to a Point in Time When connect up to the console and look at your databases, all you have to do is select the "Maintenance and Backups" tab to get details on what backups are being taken: That's the basics of what's happening with your backups. However, you can get more detail by choosing the "Automated Backups" page on the left: And now you see all the information about the backups. But the real magic to restore to a point in time is over on…
Read More

What Are the Most Common Blockers to Adopting SQL Server Extended Events?

SQL Server
Yeah, stupid long title. It's a question I put to several different AI engines. I'm curious what the aggregated knowledge of the internet has to say on the topic of blockers to Extended Events adoption. I'll leave it to you to do the search on your favorite engine and get the wordy, long-winded, answers. However, I want to bring up some of the points that were raised in order to talk about them. First, we'll talk about some of the odd answers. Then, we'll talk about the consensus. Also, one engine gave me a blatantly poor example Session, so I want to point that out. Note: I'm not dinging on AIs. I'm growing to like the little monsters. We're going to address valid points that they bring up. However, I…
Read More

State of the Database Landscape Survey 2024

Professional Development
Hello all! This post is nothing but a simple request. Please, if you have a few spare minutes, meander on over to this link and fill out the State of the Database Landscape Survey for 2024. Yeah, it's for Redgate Software, my employer. But, really, it's for everyone. Why is it for everyone? Because, every time we do one of these surveys, we don't sit on the data, we share it. Here are the results from the 2023 survey, published earlier this year. Yeah, but, I hear you opining, what does this really do for me? Well, let's talk about it. Consuming Survey Results On the one hand, who cares. Gotta get to work. Reading about what other people are doing has no bearing on me. True. To a degree.…
Read More

Observing Extended Events

SQL Server, You Can't Do That In Profiler
Sure, you can right click on a running session for Extended Events and open the Live Data window, but are there other ways of observing what Extended Events is capturing? Yes. Extended Events Output Let me just get out of the way immediately, there's probably a way to do this programmatically with DBATools. I need to dig in there, and I'll post what I find. But what can we do right now? SQL Server Management Studio (SSMS). Here are all the sessions currently on my test/demo machine: Some of these are built in, system_health for example. Most of the rest are mine. So, how can we see what they do? Well, notice that every one has a little plus sign next to it: If we click on the plus sign,…
Read More

PostgreSQL and Instrumentation

PostgreSQL
I'm still learning PostgreSQL and one of the things I've been looking at a lot lately is instrumentation. What do I mean? Well, if you're in SQL Server, think, Dynamic Management Views (DMV), Extended Events, Query Store, <hack, spit> Trace <spit>. How do we know how long a query took to run? PostgreSQL can tell you, but, and this is one of those wild, cool, but, honestly, slightly frustrating things about PostgreSQL, not natively. Let's talk about it. Instrumentation If you connect up to a PostgreSQL database, you actually do have the equivalent of DMVs. It's called the Cumulative Statistics System. And yeah, it's a bunch of views on a bunch of functions. It displays all sorts of data about IO, tables, indexes, etc.. It will even show you acive…
Read More

Kilt Day!

Uncategorized
This is a quick blog post to announce that I am reviving Kilt Day at PASS Data Community Summit. Over the last few years... ah hell, let's just say it. I'm old. Without equivocation, no reserve, I love PASS Summit. But holy smokes it's exhausting. Especially the last few years. What's changed? Me. I'm getting old. So, I looked around at things I could trim, stuff I could avoid, ways I could be both be a bit more comfortable and just take some load off my shoulders. Kilt Day. I tried to get others to "run" it. No one did. It's a bit inexplicable because, there's nothing to it. Announce it. Advertise it (this is the "hard" part). Keep advertising it. Show up in a kilt. That's pretty much it.…
Read More

Use Your Voice

Professional Development
If you want more of a career and less of a job, one thing you will have to do is learn to use your voice. I mean this on multiple levels, so let's talk about it. Volume, Tone & All That Stuff When I say "learn to use your voice," one of the things I mean is that you will need to spend some time learning how to literally, physically, speak. It takes some practice to understand how to increase your volume so people can hear it you without actually shouting. If you have to speak for an hour or more, controlling tone and volume does take time to learn. I know people who can't talk long without hurting their vocal cords. If you're one of those people, track down…
Read More

Only Capture Extended Events For a Given Time

SQL Server
It's a great question. Let's say you want to capture stored procedure completions. But, you only want to capture them between 3AM and 4AM. Can you do it? Output of rpc_completed Let's create a really simple event: CREATE EVENT SESSION [RPCTimeBoxed] ON SERVER ADD EVENT sqlserver.rpc_completed(SET collect_statement=(1) WHERE ([sqlserver].[database_name]=N'AdventureWorks')); If we start this event, run some code, the output within the Data Explorer window looks like this: Just a couple of points here. Notice the fields in the event. None of them are dates or times. However, up above, we get the timestamp column. Done, right? Let's use that. But first, what does AI, through CoPilot tell me? CoPilot To The Rescue? I asked CoPilot. It took a couple of refinements to get it on board with the idea that…
Read More