Last Week’s Almost Definitely Not Office Hours: March 15

ICYMI


Last week’s thrilling, stunning, flawless episode of whatever-you-wanna-call-it.

Thanks for watching!

Video Summary

In this video, I decided to take a break from the usual technical content and share some of my more… colorful experiences. As you might have noticed, things got a bit chaotic as we went along—lost rubber bands, dropped microphones, and an unexpected vocal change or two! But amidst all the chaos, there were some interesting discussions on topics like SQL Server 2019, NoSQL databases, and the differences between consulting work and working for a single company. I also tackled some more technical questions, such as troubleshooting DB mail notifications and discussing page splits in indexes. It’s been quite an adventure, and while it wasn’t entirely smooth sailing, it certainly kept things interesting! If you’re curious about how SQL Server 2019 might impact your work or just want to hear a bit of off-the-cuff tech talk, this video is for you. Enjoy the ride!

Full Transcript

Oh, Jesus, live. Live, live, live. Live, live, live, live. Live. I was to do the thing where I put the browser. No, in the middle. I just shrunk my whole thing down. That was terrible. There we go. There are people. Hello, people. Why did you keep shrinking? Stop shrinking. Stop shrinking. I don’t want you to shrink. I just want you to move. Keep doing it. Oh, you dumb dummy. Yes. Yes. The joys of moving a window and windows. Slowly, slowly. If you do it too fast, it’ll shrink. If you do it too fast, it just shrinks. Oh, I did it too fast. Sucks. Whatever. This is good enough. This’ll work for me. Three of you, huh? Three. I shaved just for you and there are only three of you. Monsters. Monsters. Two of you now.

Hmm. Hmm. Hmm. Hmm. Hmm. Oh, now we’re back up to three. Yes, Julie, you are the best of the best. I don’t care what the other two people here say about you. You’re the best. I hear, uh, Paul White’s supposed to show up today to try to make me apologize to spools, but I’m not going to do that. He’s going to be very disappointed. Now there’s four people here.

When, when we hit, Oh, five people. All right. Five people. So now I have to announce this week’s sponsors. Um, no, I’m not apologizing. This pools. You’re curmudgeon. So this week, uh, this webcast is sponsored by two red rubber bands and a roll of athletic tape that has some stuff on it.

Cause it fell on the floor. So I want everyone to thank our generous and gracious sponsors. Uh, I don’t get paid to apologize to spools. I’ll never apologize to those things. How about, how about this? How about you get someone to apologize to me for entity framework? And then I’ll apologize to spools. Because that’s the only way that’s going down. Cause every time I see a spool in an, any, any framework query, it is the pits.

Don’t I get paid for fixed? I wish I got paid by the spool by this, by the corrected spool. I would, I would, uh, I would be having a much, much nicer office. Okay. I could stop being in a gang. It would be awesome. It’s all sorts of things in my life that would, that would, that would improve. Yeah. Well, you know, the check would be in the mail.

Yeah. So Josh, you apologize for entity framework. All of it, the entire history of entity framework. I want you to apologize for. By the way, don’t let, don’t let these characters overwhelm you. If you have an actual SQL Server question, you’re not just here because you’re on drunk New Zealand time and you want to harass me.

Please ask them. Paula is down to 1% of a wine bottle left. Isn’t today sponsored by blue badges? These blue badges? Cause these are the only blue badges I have.

Today is sponsored by lazy New Zealand couriers who apparently can’t deliver anything within five days of getting a package. It’s a good time. Always fun. It’s just too much traffic, too much traffic.

No one can show up. Boy. Oh boy. All right. Well, someone, if someone doesn’t ask me, if it’s just me arguing with Paul about spools is everyone’s going to be really bored. So Paul asks, have you ever globally enabled trace flag 8690 at a customer?

And I’m this close to doing it this close. And when I do, I’ll have the last laugh and you’ll be apologizing to me for defending spools because they’re indefensible. Indefensible. Indefensible. Except in that one query. Indefensible.

Darren says, why are front squats so much harder than back squats? Cause you don’t do as many front squats. If you did more front squats, they would get easier.

Then the mechanics of a front squat are kind of weird. Like doing the hold or the hold like this and different back angle, too. You have to stay much more upright with a front squat.

Tough to stay that upright. Keep the head in good position. Back squats. Natural. Kind of a natural position to be in. Front squats just feel weird.

I’m going to… Excuse me. There’s apparently a truck race going on outside right now. But Paul just apologized to me.

So I’m going to pause to take a screen cap of that. There we go. First time for everything. I also have a screen cap of the one time Paul said he thought one of my jokes was funny.

I have that. I have that hanging up on my wall. I got a big head of it. Paul’s big head with a bird bubble.

It’s an incomplete sentence. Incomplete sentence. Oh.

You know, actually, I just got a very smart advertising email from a cab company, a cab app called Arrow, wishing me a happy St. Patrick’s Day. And you know what that means?

As they’re getting ahead of the drunk crowd saying, don’t drive to the bar. Call Arrow and be drunk and abusive to one of our drivers on the way home. That’s a good idea.

I’m sorry Paul doesn’t understand why spools are bad. That’s what makes me sorry. A guy as smart as Paul, a guy as good looking as Paul, sees a spool and falls in love with it.

Sad. Very sad. Makes me upset. Paul is in love with this thing so far below his league.

Bums me out. Paul came here to win. No, he didn’t.

Paul came here because he’s drunk. And it’s New Zealand Friday. I don’t even know what time. So you can only imagine how many empty bottles there are. Storn about his bare feet.

Do, do, do, do, do, do, do, do, do, do, do, do, do. Flipping around 5.08 a.m. You madman.

It’s a good thing you don’t have a job either. Otherwise, when would we speak? I’m so glad that we’re both unemployed and we can just hang out at computers whenever we want. It’s the life.

I’m telling you. It’s the life. It doesn’t get any better than that. It’s like every day I wake up in the morning, there’s Paul.

I go to bed at night, there’s Paul. I accidentally drink too much at 2 in the afternoon, there’s Paul. It’s wonderful.

It’s absolutely fantastic. Just two bums hanging out. Doing bummy stuff. Talking about goth music. Paul pretending he listens to the songs I send him.

It’s fun. Josh asked me what I think about Power BI. Nothing. I don’t use it. I’m more of a video guy.

If Power BI starts doing stuff with video, I’d be happy to give it another shot. I’m a video artist. I don’t deal with dashboards and charts and graphs. You know what my problem is?

I’m not in the crowd with the charts and graphs jokes is the real problem. Everyone has these funny jokes that they make that everyone else who deals with charts and graphs immediately gets. It’s about pie charts and bar charts and stacked 3D bar charts.

Everyone else who deals with charts and graphs is like, ha, ha, ha, good one. Yeah, that’s funny. It’s a cute joke.

Me, I’m like, I don’t know. I can’t read that thing anyway. I can barely read an analog clock. Why do you want me to read a chart or graph? You out of your mind? Just tell me what you want to say. Why do I have to sit there and figure out your chart and graph and your X and Y axis and your Z axis and your color coding?

It sucks, too, because this is always like seven graphs in one. Make it simple for a dummy to read. I can’t deal with it.

Darren says, why do NoSQL DB companies always think they have to promote it as a replacement for relational DBs? Because over time, they are adding more and more relational database stuff like transactions and schemas and keys. And NoSQL is becoming SQL so slowly.

I hardly even noticed. Just trickles in over time. Like, oh, yeah, we need to do that. You can’t use NoSQL for that because we need this thing.

And they’re like, oh, we can add that. No problem. And all of a sudden, you’ve just got another relational database. That being said, I’ve heard a couple people who are pretty smart say that Snowflake is really cool as a database. So I don’t know.

I had no angle on that. Snowflake is not a sponsor. Again, this week’s sponsor is some athletic tape. And I think I dropped the rubber bands on the ground.

I’m so sorry. No longer a sponsor. Farah says, what are typical differences in skill sets between those who do consulting work and those who work for a single company? I think it’s less of a technical skill and more of a personal skill.

And that people who do consulting have to be a bit more extroverted and have to get out there a little bit more and make a name for themselves and be a presence and sell themselves and what they do and what they know. Whereas people who get into a company, you know, you have an interview and you just go from there. Like you have that you have one interview and you just keep showing up after that consulting.

You have to keep interviewing every single damn day of your life. I don’t think there’s a whole lot of technical. There are full time people who are, I mean, obviously far more technically proficient than I am who know a lot more about stuff, whether it’s, you know, AGs or whatever.

But, you know, got to sell the sizzle. Sometimes the sizzle is better than the steak. Like if you’ve ever had steakums, you know, sometimes the sizzle is better than the steak.

But selling that sizzle is part of what I think people who do consulting have to do that. People who are full time employees don’t. Like every once in a while you have to like, you know, convince someone in a company that you’re right.

But every time, isn’t this funny? Because every time I see someone technical talking about, talking publicly about trying to discuss something at work with someone who is not technical, they seem very frustrated and they always lose the argument. So that’s a difference too.

Julie says, I have job notifications set up for a SQL agent job. The job fails. No email is sent.

Note, failed to notify DBA support via email is in the log. How can this be fixed? Hard to say from just that. There’s a pretty good blog post from a while back by Kenneth Fisher who had a bunch of queries to help troubleshoot DB mail.

And I think you have more of a database mail problem than a SQL agent problem. At least in my experience when I haven’t gotten emails. It hasn’t been because SQL agent did something wrong.

It’s been because something went wrong with DB mail. And I don’t know. That’s where I started doing my troubleshooting. Paul says, will 2019 make DBAs and consultants redundant?

Gee, I hope so. Because I really want to do something else with my life. I just need an excuse to do it. My wife won’t let me out of this office until we stop getting paid for SQL Server. So, you know, I hope so.

Microsoft doing cool. The thing is that I think that as long as we still have parameter sniffing, there will still be consultants and DBAs around. They got to get on that ball.

So, I don’t know. No, but seriously, like, so what I’ve been doing recently is because CTP 2.3 seems like a pretty good step forward in, like, stuff that’s going to be in RTM. I’ve been taking all my demos that I do right now on 2017.

And I’ve been running through them on 2019. And, like, there’s some stuff that changes and there’s, like, some promising things that happen. Like, some demos.

I’ll put it this way. Like, if you have a lot of, like, through the Ringer demos that you’ve been leaning on for a long time with, like, functions and table variables and multi-statement table valued functions and sort of, like, boring, like, you know, like the real, like, DBA 101 stuff like that, you’re going to have to start thinking a little bit harder when it comes to newer, like, SQL Server 2019. You’re going to have to start thinking about some more interesting stuff that happens in execution plans.

If you don’t, you’re just going to not have material pretty soon. I mean, it’ll be a while before people start adopting 2019 in, like, a meaningful way. But there’s a whole lot of good reasons to adopt 2019 for people who have tough times with workloads, either because they can’t afford to put development time into them or they have a third-party vendor app that is just not going to see any tuning.

Who knows? Like, I see people who… So, like, it’s the craziest thing.

Like, I know people who use third-party vendor apps. The third-party vendor has been out of business for, like, years. And I’m not talking about AdventureWorks.

I promise I’m not talking about AdventureWorks. But, like, people who have, like, third-party vendor apps have been out for years and they won’t change anything. You know, like, well, we can’t change the code and we don’t want to, like, do anything with the indexes. I’m like, well, why?

It’s not like you’re going to lose support. It’s not like there’s a support contract to be worried about. But for those people and people who are in sort of similar situations, you know, 2019 will be nice because you can just plunk stuff in there and certain things that have been awful for years could stop being awful. So it’s certainly something to consider.

Jazz voice at some point. I didn’t mean to get breathy on you there. I just ran out of breath. Let’s see.

Dan says, do page splits really matter? How can I prove, disprove the performance impact of page splits? So the page splits, it’s been a long time since, like, page splits mattered a bit when you were on, again, like, page splits. Page splits to me go right along with, like, index fragmentation where it’s like, you know, if you had, if you have really, really bad, crappy IO, yeah, a lot of page splits could gang up on you.

If you have decent IO, page splits aren’t going to be all that big a deal. What really sucks is the way SQL Server tracks page splits is it counts new pages towards that. So if you just put data into a table, even if a page doesn’t split, if you add a page, SQL Server counts a page split.

It’s kind of weird. And it counts page splits everywhere. People made a real big deal out of it for a long time.

But, you know, anytime, anytime. Anytime someone’s like, I have a lot of page splits, I’m like, good. Good.

You have data. You should have page splits. As far as proving or disproving, I don’t know. Like, if you have an absence of page splits, like, how do you prove an absence of page splits?

If you set fill factor real low, if you set fill factor real low. Say, like, if you set fill factor into, like, 50%, right? So every time you rebuild your indexes, you have pages that are only half filled with data.

Not only your index will be 50% bigger, and all your read queries will have to do twice as much work. But those pages will eventually fill up and split again. Fill factor doesn’t get honored on modification.

Fill factor only gets honored when you rebuild or reorg your indexes. So you’re constantly just having to make more empty space for more stuff coming in. It’s a losing battle.

I would just, I would avoid that battle. I have people making a big deal about why? Why?

What did the page split ever do to them? Let’s see. Peter says, how come you move the time slot back an hour? Did I miss that earlier on? Do you live in a country that doesn’t honor daylight savings time?

Because when I look at my clock, I am still doing this at noon, like every other day. Like every other Friday. Except the Friday I was at SQL Bits.

Every other Friday, though. There’s a Friday I might miss coming up, and I’ll be in Wisconsin. Well, actually, I’m definitely going to miss it, because I’m going to be in Wisconsin. Madison, Wisconsin.

While Joe Obish shakes his head at me. It’ll be fun. Paul says, automatic tuning seems like a promising idea. SQL Server saving multiple plans for different parameter values. Speculatively adding useful looking indexes.

Dropping them if they don’t help, et cetera. Yeah, that does seem interesting. I think my main problem is that it assumes that any one of those plans is actually good. Plus, you know, I’ve seen some of the missing index requests.

But I’ve seen some of the speculative indexes that come out of automatic tuning. And I’m going to be very honest with you in that they don’t seem too much better than what comes out of DTA or the missing index requests that exist now. Even though I’ve been assured it’s a different set of code, they look startlingly similar.

So, it seems promising, yeah. It’s not going that extra step, though. It’s not going to rewrite your code.

It’s not going to test the union versus the union all. As far as I know, it still can’t fix a spool. So, that’s an interesting thing, too.

Is I’ve seen automatic tuning code that does not take really, really big, bad, awful index spools into account when it starts testing things. So, take that. Take that.

Take that, punk. Or what comes out of most of you. Yeah, you’re right. No, that’s totally true. You know, there’s a, what do you call it? It’s a dearth.

Yeah, let’s go with dearth. Because dearth is a good word. There’s a dearth of good advice that comes out of most people. Paul’s advice is always good.

Paul starts with, have you tried restarting it? And Paul starts, and then Paul asks, if you’ve tried getting drunk and ignoring it. And, you know, at some point I would accuse Paul of being American with that attitude.

It’s funny because it’s true. It’s funny and true. It’s the best, best possible outcome. Best possible outcome.

Oh, my God. Oh, my God. We’ve been OMG’d by Mr. White himself. What’s coming next?

By the way, I want to remind everyone that this week’s sponsor is a roll of athletic tape that fell on the floor. Rubber bands are still down there. Rubber bands fell on the floor and didn’t get picked up again.

If I bend over on camera, I might not get back up. It’d be a rough day. Rough, rough day. Let’s see.

Nothing good going on there. Nothing good going on there. Ah. Yeah, I know. Sponsored. Drinking already. Always. If I stop, I’ll just be so shaky on camera.

You don’t want that. You don’t want to see me getting all twitchy and shaky and scratch. You don’t want to see me not drunk. You know, out of your mind, it’s a terrible thing. Drinking already.

I started drinking in 1993, Peter. I think it’s funny. I think you’re funny. Yeah.

I don’t know. A lot of people accused my grandmother of being an alcoholic, but she wasn’t. She only drank in the morning. Good for her. She was able to stop at some point. Mostly by going to bed.

You’re lucky you’re not having to wait for a courier to deliver your next bottle of wine. That’s not, by the way, that’s not a bottle, my friend.

I would never send one bottle of anything. Unlike some other people, I would never send one bottle of anything. I’ll get you set up for a little bit.

You will have like 6,000% wine for a minute. But I have faith in you. I have faith.

Yes. Unlike some people we could mention who send one bottle at a time. I would never do that.

You know why? Because there’s no such thing as one drink. There’s no such… One drink never treated me well. And I’ve never gone out and been like, I’m going to have a drink.

And been like, yeah, that was it. That was it for me. Peter says, can you give some examples of non-physical objects you can lock with SPAPA? So, yeah, so it’s more like a…

You can only… Like, you can lock anything. You can name it whatever you want. It’s an imaginary resource. It doesn’t physically exist anywhere.

It’s just a reference to a thing. The SQL service says, nah, only one of you can use it. There are different ways to use SP get app lock. Like, you can… It’s weird because you can take shared locks and you can take intent locks with it.

And that’s like, okay, but… Then other things can use it. So…

I’m not 100% sure on the usage of the shared and intent locks there. But you can take update or exclusive locks that will block other things from doing it. So, really, it’s to help… So, like, you know, thinking about the example that I gave, I didn’t flesh it out enough, but I wanted to keep the video short.

But think about a situation if you have a store procedure that you only… Like, you don’t… Like, the typical scenario, you have a big, long store procedure where you do begin tran and you do a whole bunch of work in between here and there.

You update a bunch of tables, you get data from a bunch of tables, you modify stuff, you go through, and you hold locks on all those objects the entire time that you’re doing begin tran. With SP get app lock, you can… Like, you can…

Like, say… You can serialize that process. So, you can say, only one of these store procedures can run at a time. And that has the same effect of you… But without all the crappy, like, table locks that hold on from begin tran to commit or rollback, you can just say, you can’t use any of this code until this code is finished.

So, it’s great for serializing a process rather than serializing data access. So, you can serialize the entire process. You can say, no other process can come in and use this process until this one completes because if another process comes in and uses something in here, then they could mess each other up.

It could be like a weird race condition. But you can say, nope, you can go in here. Like, this proc can run and can modify a thousand tables without having to hold begin tran and commit locks on all those thousand tables.

And another process will just be like sitting there waiting, like, well, I’ve got to wait for this one to finish. But that sucks because then, like, every other query in the database, you might be walking, like, a bunch of tables in that procedure. And you would hold that from, like, everyone else.

When really all you want to do is isolate, when really all you want to do is serialize code rather than serialize everyone’s access to the underlying objects. Let’s see. Paul says, so, seriously on the spool thing, would you say spools were a sign that SQL Server is trying to help a fundamentally poor query?

Are they useful at least as a light red flag? Yeah. I mean, I get why they’re there. And in certain conditions, they can help sort of batch work in the same way that cross-supply can help batch work.

Where you were like, so, like, in an example that I’ve seen where union versus union all going into a spool was much, much different. Or rather, where the spool broke down, like, the size of a sort. So, without the spool, you would have to sort, like, a kabillion rows at once.

But with the sort, much like with cross-supply, you can break that sort into smaller chunks. So, spools can certainly be helpful. I’ve never – well, actually, yes, I have.

I have condemned all spools for all eternity. But here’s the thing. I think eager index spools specifically are a huge red flag and should always be looked at. Whether you end up creating an index or just decide to live with them based on the size of the spool and its effect on the plan, because remember that those spools are built serially, or if you’re constantly building gigantic index spools, like, 8, 9, 10 million rows every single time, or if they’re, like, a bunch of them in the plan and they all have the same sort of, like – and they all have the same index definition in the spool, then it’s really, really worth going after them.

But with table spools, it’s a little bit different. With table spools, it’s a sign that you have something to – you have something to test. So table spools, well, you know, they may very well be better than the alternative plan that you get without the spool.

Fixing the condition that caused the spool is really what you should be going after. So there’s, like, three levels of bad. There’s the spool plan without the spool that would suck.

There’s a spool plan with the spool that does better than this one. But then the third one is the plan that never needed a spool to begin with. And that, that’s where you make your money.

I listened to a DMX interview before I was on here. So if I bark at you, I’m sorry. Peter asks if SP AppLock is just queuing by another term.

Yeah, it’s a lot like queuing. It’s a lot – yeah, it’s a lot like being able to queue a process without having to, like, use a queue table or, you know, set, like, weird isolation lever or something like that. Paul says, AppLocks are underrated and underused.

I agree. When I first saw them, I was terrified by them because I didn’t understand them at all. But this – I mean, it was a long time ago. Since then, I’ve gotten a bit more – I’ve gotten much, much cozier with them. And I feel like they’re cool.

Like, when I first saw SP GetAppLock, I totally misunderstood the purpose of it. I thought that GetAppLock was a way to preemptively take a lock on an object. I didn’t understand that it was, like, this just imaginary resource.

And I was like, oh, my God, you’re locking a table before you need to lock it. What are you doing? But then, like, I read about it. And I was like, oh, that makes sense. That’s pretty cool.

Let’s do that. Yes, I like it. Let’s see. Paul says, eager index pools are often a sign of a missing permanent index but not always. Yeah. And, you know, there are times when you can’t add that index. You already have – I’ve seen cases where, like, you have these gigantic index pools on tables with, like, 30 indexes on them already.

And I’m like, well, I mean, clearly you chose poorly. But before we go and add that 31st index, let’s roll some of these back. Let’s get rid of some of these.

Let’s do some work first. Let’s see. In a similar vein, one could ask if sorts were always usually bad. Well, you know, like most things in life, size is everything.

A small sort is pretty cool. A big sort, less so. An undersized sort, even more so.

So, like, so I think, like, what gets me down about sorts, like most things, is what comes down to parameter sniffing. Right?

So, like, you get a little plan that, like, really underestimates the amount of work a sort is going to take. And then you get a big plan where that sort is going to get put to work. That’s where sorts really suck.

A lot of people don’t know to look for sorts in very specific circumstances, too. You know? Like, like the whole thing with windowing functions or window functions, whatever you want to call them.

If people were, like, like, like really on top of when sorts can backfire terribly, I wouldn’t worry so much about them. But then I see people who are, you know, generating a row number over, like, millions and millions of rows without a supporting index.

And they’re like, slow. Window functions are slow. SQL service sucks. Like, man, you didn’t even try. Forrest asks, oh, wait, let’s see here.

You have horror stories about abandoned app blocks. Sean likes to make stuff up so he can sound like he does something at work. Don’t.

Don’t take, don’t think too much of that. He said VMware, too. I don’t trust that. Abandoned transactions in VMware. The hell does that have to do with the other thing?

Like, like someone started creating a VM and then quit? No. Let’s see here. Farah says, so what operator is the strongest indicator of inadequate design and indexing? Left join.

No. That’s a good question. It’s hard to pick a favorite.

I think, you know, the eager index pool is probably the chief amongst them because SQL server is literally creating an index for you. It’s like every time that query runs, it’s like, no, no, here’s an index dummy.

Look, I got one for you. You missed it. I got it. You screw that up. So I think, I think the eager index pool is going to have to win that just based on the fact that there’s like an actual factual index creation in the plan every time it runs.

Sean lives in a state that legalized weed. Yes, but he is allergic to weed. So it does him no good.

Paul says the knee jerk reaction would be scans and hashes. That’s a good point. That’s a good point.

Most people really don’t pay much attention to what their index is until they see an index scan and then they, then they lose their damn minds. Hashes I agree with to a certain extent, but you know, sounds like an OLTP problem to me.

Good. You’re worried about hash joins. You got OLTP problems. Other than that, let’s see, you know, sorts could be one of them.

Ooh, sort merge. So like if you have a, like if you have a plan where SQL Server is like consistently doing like a sort to support a merge, merge join, I think that’s another good example that you’ve done something weird to your indexes because, you know, that sucks too.

SQL Server is choosing to inject a sort operator, much like it, like it chooses to inject an eager index spool in order to support a specific join operation. So you could, you could go, you could, you might be able to go so far as to say that a sort before a stream aggregate might be another sign that a SQL Server is asking you for an index.

Paul says the most reliable sign is probably queries that take longer than is acceptable. Yeah. But that could, that could go beyond indexing. That could be a situation that I’ve seen a few times where, um, app designers didn’t know that you could have a where clause that would prevent all the rows in the table from being funneled to an application.

I’ve also seen where people just didn’t know how many rows were getting sent out. This is sort of like weird, like, I don’t, I don’t, I don’t, I don’t even know what to call it.

I don’t, I don’t think it’s a misunderstanding. Josh says the entity framework, entity framework is certainly guilty of it, but regular, like, so, you know, and I think entity framework is, at least makes things, makes things like the top operator accessible to developers who otherwise would have no idea to use a top, top when they might need one.

But aside from, like, you know, queries that I’ve seen that just were straight up missing a where clause, uh, some people just don’t know that now 500,000 rows are getting shoveled off to the application.

Some people just don’t know that their application, that it’s not SQL Server that’s being slow about it, that it’s their application consuming those 500,000 rows. It’s, that’s slow.

So there’s stuff to, there’s, there’s stuff in there that, that indicates a design problem that’s not necessarily a SQL Server design problem. Also, if I could do one thing to help the world, it would probably be to limit the textual size of queries.

Yeah, I’m, you know what? That, that’s a good idea. A lot of people, when they start writing a query, they, they fall in love with the idea of doing it all in one fail swoop.

And that, the longer and crazier those queries get. I saw, I saw someone the other day who chained, God, like eight or nine CTE together, was joining the, the CTE inside the other CTE.

And then finally had like this other query that joined the results of those CTE and other ones. And it was just like, the plan just never, like it, it took plan explorer. I want to say about eight minutes to render the plan.

It was like unreadable. I’m like, why? You don’t need to do that to yourself. Like, and, and, and, and the, and the other, the other terrible thing about that is, you know, people will, inside a CTE, come up with this completely, this, like the string of like non-sargable calculations.

And that’ll be like the basis of the where clause in the next CTE. And it’s like, man, you ain’t helping no one. Like, that’s just, that’s just messed up that you’re asking SQL Server to do all that. You know, one thing, one thing that I try to instill in people is that if a, if a query plan is big and confusing to you, the optimizer probably didn’t think that much more of it.

The only way to get smaller plans is to have smaller sets of queries. I’d rather, I’d much rather troubleshoot like 20 small query plans than one gigantic query plan.

The more we can break this stuff up, the better. At least I think so. I’ve had very good luck breaking things up into smaller chunks of logic. I’d much rather fight with SQL Server over like the plan choice of a plan that has like two or three joins in it than the plan choice of a query that has like 40 joins in it.

Because it seems, it seems to me like I could, I could, I could have more of a say in what SQL Server is going to do with a two or three join query than I could with a 30 or 40 join query.

That just, that, that just seems like common sense to me, but you know, I don’t know. I’m just a bouncer. What do I know about this stuff anyway? Josh says, I’m thinking of when people accidentally use an eager operator and their EF prior to adding the where part.

So the query runs and then they filter in memory. Ooh. Ooh. Why would you do that to yourself? It’s an in-memory filter. I’ve seen people do that with paging queries though.

And I’ve seen them specifically do that with paging queries where let’s say you have someone selecting column one and column two, but then you need to like filter or order by column three.

And their choice would be to read everything into memory and sort by column three or do like, or like sort and or like filter on column three or, or do that in the database. When they do it in the database, SQL Server becomes painfully slow and unusable.

But when they do it in any framework, SQL Server seems to be okay, but it’s slow, but only because of the app servers. And it’s a lot cheaper to give more CPUs to an app server than it is to give more CPUs to SQL Server.

Imagine a world where we could give 24 cores to SQL Server for the same, for the same amount of money that you can give 24 cores to an app server. Or you can, you can give 512 gigs of RAM to an app server for free without, without the, that magical sprinkling that enterprise licensing does to your CPUs where it makes the same damn CPU that’s worth $2,000 in one place or $7,000 in another place.

Licensing is magic, magic, magic. Let’s see. Josh says, I think Stack Overflow mostly uses a micro RM called Dapper.

I have no idea. Paul says, what’s your view of columnstore batch mode adapt, adoption rates? Too small.

I mean, 2019 is going to make the batch mode stuff quicker, but columnstore is still going to be, I think, pretty niche, unfortunately. That’s why Joe can never get another job. Only like three people in the world use columnstore.

Professionally. No, I wish, I wish there was more of it. I wish I saw more. I frequently work with people who I see would benefit from it, but they’re on like 2012. Well, good news and bad news.

Bad news is you’re going to, you have, you have an upgrade project to complete. But, you know, I wish there was more. I am vaguely hopeful that 2019 will see improvements to batch mode that prior versions haven’t seen.

Specifically to batch sorts. And, and, and more operator adoption. Of.

Batch mode processing. I swear to God, if, if I ever see batch mode nested loops, that’s not just a bug in the plan XML. Someone at Microsoft is getting a fatal hug. Like that would be, that would be crazy.

See, Paul says, you’re absolutely right about tuning small queries. Even if you eventually combine some of them into a larger query in an informed way, it’s a better approach. Yeah.

You could even stick them in a CTE with a top to make them optimizer proof. Right? Sorry. Peter says, Nick Craver was all over EF Core on Twitter a while back.

Guess I just assumed. I think he’s doing .NET Core. I don’t think EF Core is necessarily what he’s talking about. But I don’t know.

I don’t know specifically. The only time Nick has actually responded to me on Twitter was when I posted the thing about the Windows key in period and Management Studio. And that was just to call me a monster.

Paul says, as long as top uses parentheses, I’m happy. Yes. You love to give your top expressions hugs. You’re a very, you’re a sweet and tender man.

And I hope that if there’s one thing that comes out of this webcast sponsored by a roll of athletic tape is that the world knows that Paul White is a sweet and tender man who deserves many more cases of wine than I could ever send him. But I’ll try. I will die consulting.

I mean, I’ll die consulting, trying to. Yeah, you get it. That thing. Yes. Heart with.

And you know what? I think that’s the perfect message to leave this webcast off on. Paul’s select top heart message. So thank you for coming. Thank you for putting up with me. And thank you to this roll of athletic tape that fell on the floor for sponsoring this week’s webcast.

See you next time. Amen.

Video Summary

In this video, I decided to take a break from the usual technical content and share some of my more… colorful experiences. As you might have noticed, things got a bit chaotic as we went along—lost rubber bands, dropped microphones, and an unexpected vocal change or two! But amidst all the chaos, there were some interesting discussions on topics like SQL Server 2019, NoSQL databases, and the differences between consulting work and working for a single company. I also tackled some more technical questions, such as troubleshooting DB mail notifications and discussing page splits in indexes. It’s been quite an adventure, and while it wasn’t entirely smooth sailing, it certainly kept things interesting! If you’re curious about how SQL Server 2019 might impact your work or just want to hear a bit of off-the-cuff tech talk, this video is for you. Enjoy the ride!

Full Transcript

Oh, Jesus, live. Live, live, live. Live, live, live, live. Live. I was to do the thing where I put the browser. No, in the middle. I just shrunk my whole thing down. That was terrible. There we go. There are people. Hello, people. Why did you keep shrinking? Stop shrinking. Stop shrinking. I don’t want you to shrink. I just want you to move. Keep doing it. Oh, you dumb dummy. Yes. Yes. The joys of moving a window and windows. Slowly, slowly. If you do it too fast, it’ll shrink. If you do it too fast, it just shrinks. Oh, I did it too fast. Sucks. Whatever. This is good enough. This’ll work for me. Three of you, huh? Three. I shaved just for you and there are only three of you. Monsters. Monsters. Two of you now.

Hmm. Hmm. Hmm. Hmm. Hmm. Oh, now we’re back up to three. Yes, Julie, you are the best of the best. I don’t care what the other two people here say about you. You’re the best. I hear, uh, Paul White’s supposed to show up today to try to make me apologize to spools, but I’m not going to do that. He’s going to be very disappointed. Now there’s four people here.

When, when we hit, Oh, five people. All right. Five people. So now I have to announce this week’s sponsors. Um, no, I’m not apologizing. This pools. You’re curmudgeon. So this week, uh, this webcast is sponsored by two red rubber bands and a roll of athletic tape that has some stuff on it.

Cause it fell on the floor. So I want everyone to thank our generous and gracious sponsors. Uh, I don’t get paid to apologize to spools. I’ll never apologize to those things. How about, how about this? How about you get someone to apologize to me for entity framework? And then I’ll apologize to spools. Because that’s the only way that’s going down. Cause every time I see a spool in an, any, any framework query, it is the pits.

Don’t I get paid for fixed? I wish I got paid by the spool by this, by the corrected spool. I would, I would, uh, I would be having a much, much nicer office. Okay. I could stop being in a gang. It would be awesome. It’s all sorts of things in my life that would, that would, that would improve. Yeah. Well, you know, the check would be in the mail.

Yeah. So Josh, you apologize for entity framework. All of it, the entire history of entity framework. I want you to apologize for. By the way, don’t let, don’t let these characters overwhelm you. If you have an actual SQL Server question, you’re not just here because you’re on drunk New Zealand time and you want to harass me.

Please ask them. Paula is down to 1% of a wine bottle left. Isn’t today sponsored by blue badges? These blue badges? Cause these are the only blue badges I have.

Today is sponsored by lazy New Zealand couriers who apparently can’t deliver anything within five days of getting a package. It’s a good time. Always fun. It’s just too much traffic, too much traffic.

No one can show up. Boy. Oh boy. All right. Well, someone, if someone doesn’t ask me, if it’s just me arguing with Paul about spools is everyone’s going to be really bored. So Paul asks, have you ever globally enabled trace flag 8690 at a customer?

And I’m this close to doing it this close. And when I do, I’ll have the last laugh and you’ll be apologizing to me for defending spools because they’re indefensible. Indefensible. Indefensible. Except in that one query. Indefensible.

Darren says, why are front squats so much harder than back squats? Cause you don’t do as many front squats. If you did more front squats, they would get easier.

Then the mechanics of a front squat are kind of weird. Like doing the hold or the hold like this and different back angle, too. You have to stay much more upright with a front squat.

Tough to stay that upright. Keep the head in good position. Back squats. Natural. Kind of a natural position to be in. Front squats just feel weird.

I’m going to… Excuse me. There’s apparently a truck race going on outside right now. But Paul just apologized to me.

So I’m going to pause to take a screen cap of that. There we go. First time for everything. I also have a screen cap of the one time Paul said he thought one of my jokes was funny.

I have that. I have that hanging up on my wall. I got a big head of it. Paul’s big head with a bird bubble.

It’s an incomplete sentence. Incomplete sentence. Oh.

You know, actually, I just got a very smart advertising email from a cab company, a cab app called Arrow, wishing me a happy St. Patrick’s Day. And you know what that means?

As they’re getting ahead of the drunk crowd saying, don’t drive to the bar. Call Arrow and be drunk and abusive to one of our drivers on the way home. That’s a good idea.

I’m sorry Paul doesn’t understand why spools are bad. That’s what makes me sorry. A guy as smart as Paul, a guy as good looking as Paul, sees a spool and falls in love with it.

Sad. Very sad. Makes me upset. Paul is in love with this thing so far below his league.

Bums me out. Paul came here to win. No, he didn’t.

Paul came here because he’s drunk. And it’s New Zealand Friday. I don’t even know what time. So you can only imagine how many empty bottles there are. Storn about his bare feet.

Do, do, do, do, do, do, do, do, do, do, do, do, do. Flipping around 5.08 a.m. You madman.

It’s a good thing you don’t have a job either. Otherwise, when would we speak? I’m so glad that we’re both unemployed and we can just hang out at computers whenever we want. It’s the life.

I’m telling you. It’s the life. It doesn’t get any better than that. It’s like every day I wake up in the morning, there’s Paul.

I go to bed at night, there’s Paul. I accidentally drink too much at 2 in the afternoon, there’s Paul. It’s wonderful.

It’s absolutely fantastic. Just two bums hanging out. Doing bummy stuff. Talking about goth music. Paul pretending he listens to the songs I send him.

It’s fun. Josh asked me what I think about Power BI. Nothing. I don’t use it. I’m more of a video guy.

If Power BI starts doing stuff with video, I’d be happy to give it another shot. I’m a video artist. I don’t deal with dashboards and charts and graphs. You know what my problem is?

I’m not in the crowd with the charts and graphs jokes is the real problem. Everyone has these funny jokes that they make that everyone else who deals with charts and graphs immediately gets. It’s about pie charts and bar charts and stacked 3D bar charts.

Everyone else who deals with charts and graphs is like, ha, ha, ha, good one. Yeah, that’s funny. It’s a cute joke.

Me, I’m like, I don’t know. I can’t read that thing anyway. I can barely read an analog clock. Why do you want me to read a chart or graph? You out of your mind? Just tell me what you want to say. Why do I have to sit there and figure out your chart and graph and your X and Y axis and your Z axis and your color coding?

It sucks, too, because this is always like seven graphs in one. Make it simple for a dummy to read. I can’t deal with it.

Darren says, why do NoSQL DB companies always think they have to promote it as a replacement for relational DBs? Because over time, they are adding more and more relational database stuff like transactions and schemas and keys. And NoSQL is becoming SQL so slowly.

I hardly even noticed. Just trickles in over time. Like, oh, yeah, we need to do that. You can’t use NoSQL for that because we need this thing.

And they’re like, oh, we can add that. No problem. And all of a sudden, you’ve just got another relational database. That being said, I’ve heard a couple people who are pretty smart say that Snowflake is really cool as a database. So I don’t know.

I had no angle on that. Snowflake is not a sponsor. Again, this week’s sponsor is some athletic tape. And I think I dropped the rubber bands on the ground.

I’m so sorry. No longer a sponsor. Farah says, what are typical differences in skill sets between those who do consulting work and those who work for a single company? I think it’s less of a technical skill and more of a personal skill.

And that people who do consulting have to be a bit more extroverted and have to get out there a little bit more and make a name for themselves and be a presence and sell themselves and what they do and what they know. Whereas people who get into a company, you know, you have an interview and you just go from there. Like you have that you have one interview and you just keep showing up after that consulting.

You have to keep interviewing every single damn day of your life. I don’t think there’s a whole lot of technical. There are full time people who are, I mean, obviously far more technically proficient than I am who know a lot more about stuff, whether it’s, you know, AGs or whatever.

But, you know, got to sell the sizzle. Sometimes the sizzle is better than the steak. Like if you’ve ever had steakums, you know, sometimes the sizzle is better than the steak.

But selling that sizzle is part of what I think people who do consulting have to do that. People who are full time employees don’t. Like every once in a while you have to like, you know, convince someone in a company that you’re right.

But every time, isn’t this funny? Because every time I see someone technical talking about, talking publicly about trying to discuss something at work with someone who is not technical, they seem very frustrated and they always lose the argument. So that’s a difference too.

Julie says, I have job notifications set up for a SQL agent job. The job fails. No email is sent.

Note, failed to notify DBA support via email is in the log. How can this be fixed? Hard to say from just that. There’s a pretty good blog post from a while back by Kenneth Fisher who had a bunch of queries to help troubleshoot DB mail.

And I think you have more of a database mail problem than a SQL agent problem. At least in my experience when I haven’t gotten emails. It hasn’t been because SQL agent did something wrong.

It’s been because something went wrong with DB mail. And I don’t know. That’s where I started doing my troubleshooting. Paul says, will 2019 make DBAs and consultants redundant?

Gee, I hope so. Because I really want to do something else with my life. I just need an excuse to do it. My wife won’t let me out of this office until we stop getting paid for SQL Server. So, you know, I hope so.

Microsoft doing cool. The thing is that I think that as long as we still have parameter sniffing, there will still be consultants and DBAs around. They got to get on that ball.

So, I don’t know. No, but seriously, like, so what I’ve been doing recently is because CTP 2.3 seems like a pretty good step forward in, like, stuff that’s going to be in RTM. I’ve been taking all my demos that I do right now on 2017.

And I’ve been running through them on 2019. And, like, there’s some stuff that changes and there’s, like, some promising things that happen. Like, some demos.

I’ll put it this way. Like, if you have a lot of, like, through the Ringer demos that you’ve been leaning on for a long time with, like, functions and table variables and multi-statement table valued functions and sort of, like, boring, like, you know, like the real, like, DBA 101 stuff like that, you’re going to have to start thinking a little bit harder when it comes to newer, like, SQL Server 2019. You’re going to have to start thinking about some more interesting stuff that happens in execution plans.

If you don’t, you’re just going to not have material pretty soon. I mean, it’ll be a while before people start adopting 2019 in, like, a meaningful way. But there’s a whole lot of good reasons to adopt 2019 for people who have tough times with workloads, either because they can’t afford to put development time into them or they have a third-party vendor app that is just not going to see any tuning.

Who knows? Like, I see people who… So, like, it’s the craziest thing.

Like, I know people who use third-party vendor apps. The third-party vendor has been out of business for, like, years. And I’m not talking about AdventureWorks.

I promise I’m not talking about AdventureWorks. But, like, people who have, like, third-party vendor apps have been out for years and they won’t change anything. You know, like, well, we can’t change the code and we don’t want to, like, do anything with the indexes. I’m like, well, why?

It’s not like you’re going to lose support. It’s not like there’s a support contract to be worried about. But for those people and people who are in sort of similar situations, you know, 2019 will be nice because you can just plunk stuff in there and certain things that have been awful for years could stop being awful. So it’s certainly something to consider.

Jazz voice at some point. I didn’t mean to get breathy on you there. I just ran out of breath. Let’s see.

Dan says, do page splits really matter? How can I prove, disprove the performance impact of page splits? So the page splits, it’s been a long time since, like, page splits mattered a bit when you were on, again, like, page splits. Page splits to me go right along with, like, index fragmentation where it’s like, you know, if you had, if you have really, really bad, crappy IO, yeah, a lot of page splits could gang up on you.

If you have decent IO, page splits aren’t going to be all that big a deal. What really sucks is the way SQL Server tracks page splits is it counts new pages towards that. So if you just put data into a table, even if a page doesn’t split, if you add a page, SQL Server counts a page split.

It’s kind of weird. And it counts page splits everywhere. People made a real big deal out of it for a long time.

But, you know, anytime, anytime. Anytime someone’s like, I have a lot of page splits, I’m like, good. Good.

You have data. You should have page splits. As far as proving or disproving, I don’t know. Like, if you have an absence of page splits, like, how do you prove an absence of page splits?

If you set fill factor real low, if you set fill factor real low. Say, like, if you set fill factor into, like, 50%, right? So every time you rebuild your indexes, you have pages that are only half filled with data.

Not only your index will be 50% bigger, and all your read queries will have to do twice as much work. But those pages will eventually fill up and split again. Fill factor doesn’t get honored on modification.

Fill factor only gets honored when you rebuild or reorg your indexes. So you’re constantly just having to make more empty space for more stuff coming in. It’s a losing battle.

I would just, I would avoid that battle. I have people making a big deal about why? Why?

What did the page split ever do to them? Let’s see. Peter says, how come you move the time slot back an hour? Did I miss that earlier on? Do you live in a country that doesn’t honor daylight savings time?

Because when I look at my clock, I am still doing this at noon, like every other day. Like every other Friday. Except the Friday I was at SQL Bits.

Every other Friday, though. There’s a Friday I might miss coming up, and I’ll be in Wisconsin. Well, actually, I’m definitely going to miss it, because I’m going to be in Wisconsin. Madison, Wisconsin.

While Joe Obish shakes his head at me. It’ll be fun. Paul says, automatic tuning seems like a promising idea. SQL Server saving multiple plans for different parameter values. Speculatively adding useful looking indexes.

Dropping them if they don’t help, et cetera. Yeah, that does seem interesting. I think my main problem is that it assumes that any one of those plans is actually good. Plus, you know, I’ve seen some of the missing index requests.

But I’ve seen some of the speculative indexes that come out of automatic tuning. And I’m going to be very honest with you in that they don’t seem too much better than what comes out of DTA or the missing index requests that exist now. Even though I’ve been assured it’s a different set of code, they look startlingly similar.

So, it seems promising, yeah. It’s not going that extra step, though. It’s not going to rewrite your code.

It’s not going to test the union versus the union all. As far as I know, it still can’t fix a spool. So, that’s an interesting thing, too.

Is I’ve seen automatic tuning code that does not take really, really big, bad, awful index spools into account when it starts testing things. So, take that. Take that.

Take that, punk. Or what comes out of most of you. Yeah, you’re right. No, that’s totally true. You know, there’s a, what do you call it? It’s a dearth.

Yeah, let’s go with dearth. Because dearth is a good word. There’s a dearth of good advice that comes out of most people. Paul’s advice is always good.

Paul starts with, have you tried restarting it? And Paul starts, and then Paul asks, if you’ve tried getting drunk and ignoring it. And, you know, at some point I would accuse Paul of being American with that attitude.

It’s funny because it’s true. It’s funny and true. It’s the best, best possible outcome. Best possible outcome.

Oh, my God. Oh, my God. We’ve been OMG’d by Mr. White himself. What’s coming next?

By the way, I want to remind everyone that this week’s sponsor is a roll of athletic tape that fell on the floor. Rubber bands are still down there. Rubber bands fell on the floor and didn’t get picked up again.

If I bend over on camera, I might not get back up. It’d be a rough day. Rough, rough day. Let’s see.

Nothing good going on there. Nothing good going on there. Ah. Yeah, I know. Sponsored. Drinking already. Always. If I stop, I’ll just be so shaky on camera.

You don’t want that. You don’t want to see me getting all twitchy and shaky and scratch. You don’t want to see me not drunk. You know, out of your mind, it’s a terrible thing. Drinking already.

I started drinking in 1993, Peter. I think it’s funny. I think you’re funny. Yeah.

I don’t know. A lot of people accused my grandmother of being an alcoholic, but she wasn’t. She only drank in the morning. Good for her. She was able to stop at some point. Mostly by going to bed.

You’re lucky you’re not having to wait for a courier to deliver your next bottle of wine. That’s not, by the way, that’s not a bottle, my friend.

I would never send one bottle of anything. Unlike some other people, I would never send one bottle of anything. I’ll get you set up for a little bit.

You will have like 6,000% wine for a minute. But I have faith in you. I have faith.

Yes. Unlike some people we could mention who send one bottle at a time. I would never do that.

You know why? Because there’s no such thing as one drink. There’s no such… One drink never treated me well. And I’ve never gone out and been like, I’m going to have a drink.

And been like, yeah, that was it. That was it for me. Peter says, can you give some examples of non-physical objects you can lock with SPAPA? So, yeah, so it’s more like a…

You can only… Like, you can lock anything. You can name it whatever you want. It’s an imaginary resource. It doesn’t physically exist anywhere.

It’s just a reference to a thing. The SQL service says, nah, only one of you can use it. There are different ways to use SP get app lock. Like, you can… It’s weird because you can take shared locks and you can take intent locks with it.

And that’s like, okay, but… Then other things can use it. So…

I’m not 100% sure on the usage of the shared and intent locks there. But you can take update or exclusive locks that will block other things from doing it. So, really, it’s to help… So, like, you know, thinking about the example that I gave, I didn’t flesh it out enough, but I wanted to keep the video short.

But think about a situation if you have a store procedure that you only… Like, you don’t… Like, the typical scenario, you have a big, long store procedure where you do begin tran and you do a whole bunch of work in between here and there.

You update a bunch of tables, you get data from a bunch of tables, you modify stuff, you go through, and you hold locks on all those objects the entire time that you’re doing begin tran. With SP get app lock, you can… Like, you can…

Like, say… You can serialize that process. So, you can say, only one of these store procedures can run at a time. And that has the same effect of you… But without all the crappy, like, table locks that hold on from begin tran to commit or rollback, you can just say, you can’t use any of this code until this code is finished.

So, it’s great for serializing a process rather than serializing data access. So, you can serialize the entire process. You can say, no other process can come in and use this process until this one completes because if another process comes in and uses something in here, then they could mess each other up.

It could be like a weird race condition. But you can say, nope, you can go in here. Like, this proc can run and can modify a thousand tables without having to hold begin tran and commit locks on all those thousand tables.

And another process will just be like sitting there waiting, like, well, I’ve got to wait for this one to finish. But that sucks because then, like, every other query in the database, you might be walking, like, a bunch of tables in that procedure. And you would hold that from, like, everyone else.

When really all you want to do is isolate, when really all you want to do is serialize code rather than serialize everyone’s access to the underlying objects. Let’s see. Paul says, so, seriously on the spool thing, would you say spools were a sign that SQL Server is trying to help a fundamentally poor query?

Are they useful at least as a light red flag? Yeah. I mean, I get why they’re there. And in certain conditions, they can help sort of batch work in the same way that cross-supply can help batch work.

Where you were like, so, like, in an example that I’ve seen where union versus union all going into a spool was much, much different. Or rather, where the spool broke down, like, the size of a sort. So, without the spool, you would have to sort, like, a kabillion rows at once.

But with the sort, much like with cross-supply, you can break that sort into smaller chunks. So, spools can certainly be helpful. I’ve never – well, actually, yes, I have.

I have condemned all spools for all eternity. But here’s the thing. I think eager index spools specifically are a huge red flag and should always be looked at. Whether you end up creating an index or just decide to live with them based on the size of the spool and its effect on the plan, because remember that those spools are built serially, or if you’re constantly building gigantic index spools, like, 8, 9, 10 million rows every single time, or if they’re, like, a bunch of them in the plan and they all have the same sort of, like – and they all have the same index definition in the spool, then it’s really, really worth going after them.

But with table spools, it’s a little bit different. With table spools, it’s a sign that you have something to – you have something to test. So table spools, well, you know, they may very well be better than the alternative plan that you get without the spool.

Fixing the condition that caused the spool is really what you should be going after. So there’s, like, three levels of bad. There’s the spool plan without the spool that would suck.

There’s a spool plan with the spool that does better than this one. But then the third one is the plan that never needed a spool to begin with. And that, that’s where you make your money.

I listened to a DMX interview before I was on here. So if I bark at you, I’m sorry. Peter asks if SP AppLock is just queuing by another term.

Yeah, it’s a lot like queuing. It’s a lot – yeah, it’s a lot like being able to queue a process without having to, like, use a queue table or, you know, set, like, weird isolation lever or something like that. Paul says, AppLocks are underrated and underused.

I agree. When I first saw them, I was terrified by them because I didn’t understand them at all. But this – I mean, it was a long time ago. Since then, I’ve gotten a bit more – I’ve gotten much, much cozier with them. And I feel like they’re cool.

Like, when I first saw SP GetAppLock, I totally misunderstood the purpose of it. I thought that GetAppLock was a way to preemptively take a lock on an object. I didn’t understand that it was, like, this just imaginary resource.

And I was like, oh, my God, you’re locking a table before you need to lock it. What are you doing? But then, like, I read about it. And I was like, oh, that makes sense. That’s pretty cool.

Let’s do that. Yes, I like it. Let’s see. Paul says, eager index pools are often a sign of a missing permanent index but not always. Yeah. And, you know, there are times when you can’t add that index. You already have – I’ve seen cases where, like, you have these gigantic index pools on tables with, like, 30 indexes on them already.

And I’m like, well, I mean, clearly you chose poorly. But before we go and add that 31st index, let’s roll some of these back. Let’s get rid of some of these.

Let’s do some work first. Let’s see. In a similar vein, one could ask if sorts were always usually bad. Well, you know, like most things in life, size is everything.

A small sort is pretty cool. A big sort, less so. An undersized sort, even more so.

So, like, so I think, like, what gets me down about sorts, like most things, is what comes down to parameter sniffing. Right?

So, like, you get a little plan that, like, really underestimates the amount of work a sort is going to take. And then you get a big plan where that sort is going to get put to work. That’s where sorts really suck.

A lot of people don’t know to look for sorts in very specific circumstances, too. You know? Like, like the whole thing with windowing functions or window functions, whatever you want to call them.

If people were, like, like, like really on top of when sorts can backfire terribly, I wouldn’t worry so much about them. But then I see people who are, you know, generating a row number over, like, millions and millions of rows without a supporting index.

And they’re like, slow. Window functions are slow. SQL service sucks. Like, man, you didn’t even try. Forrest asks, oh, wait, let’s see here.

You have horror stories about abandoned app blocks. Sean likes to make stuff up so he can sound like he does something at work. Don’t.

Don’t take, don’t think too much of that. He said VMware, too. I don’t trust that. Abandoned transactions in VMware. The hell does that have to do with the other thing?

Like, like someone started creating a VM and then quit? No. Let’s see here. Farah says, so what operator is the strongest indicator of inadequate design and indexing? Left join.

No. That’s a good question. It’s hard to pick a favorite.

I think, you know, the eager index pool is probably the chief amongst them because SQL server is literally creating an index for you. It’s like every time that query runs, it’s like, no, no, here’s an index dummy.

Look, I got one for you. You missed it. I got it. You screw that up. So I think, I think the eager index pool is going to have to win that just based on the fact that there’s like an actual factual index creation in the plan every time it runs.

Sean lives in a state that legalized weed. Yes, but he is allergic to weed. So it does him no good.

Paul says the knee jerk reaction would be scans and hashes. That’s a good point. That’s a good point.

Most people really don’t pay much attention to what their index is until they see an index scan and then they, then they lose their damn minds. Hashes I agree with to a certain extent, but you know, sounds like an OLTP problem to me.

Good. You’re worried about hash joins. You got OLTP problems. Other than that, let’s see, you know, sorts could be one of them.

Ooh, sort merge. So like if you have a, like if you have a plan where SQL Server is like consistently doing like a sort to support a merge, merge join, I think that’s another good example that you’ve done something weird to your indexes because, you know, that sucks too.

SQL Server is choosing to inject a sort operator, much like it, like it chooses to inject an eager index spool in order to support a specific join operation. So you could, you could go, you could, you might be able to go so far as to say that a sort before a stream aggregate might be another sign that a SQL Server is asking you for an index.

Paul says the most reliable sign is probably queries that take longer than is acceptable. Yeah. But that could, that could go beyond indexing. That could be a situation that I’ve seen a few times where, um, app designers didn’t know that you could have a where clause that would prevent all the rows in the table from being funneled to an application.

I’ve also seen where people just didn’t know how many rows were getting sent out. This is sort of like weird, like, I don’t, I don’t, I don’t, I don’t even know what to call it.

I don’t, I don’t think it’s a misunderstanding. Josh says the entity framework, entity framework is certainly guilty of it, but regular, like, so, you know, and I think entity framework is, at least makes things, makes things like the top operator accessible to developers who otherwise would have no idea to use a top, top when they might need one.

But aside from, like, you know, queries that I’ve seen that just were straight up missing a where clause, uh, some people just don’t know that now 500,000 rows are getting shoveled off to the application.

Some people just don’t know that their application, that it’s not SQL Server that’s being slow about it, that it’s their application consuming those 500,000 rows. It’s, that’s slow.

So there’s stuff to, there’s, there’s stuff in there that, that indicates a design problem that’s not necessarily a SQL Server design problem. Also, if I could do one thing to help the world, it would probably be to limit the textual size of queries.

Yeah, I’m, you know what? That, that’s a good idea. A lot of people, when they start writing a query, they, they fall in love with the idea of doing it all in one fail swoop.

And that, the longer and crazier those queries get. I saw, I saw someone the other day who chained, God, like eight or nine CTE together, was joining the, the CTE inside the other CTE.

And then finally had like this other query that joined the results of those CTE and other ones. And it was just like, the plan just never, like it, it took plan explorer. I want to say about eight minutes to render the plan.

It was like unreadable. I’m like, why? You don’t need to do that to yourself. Like, and, and, and, and the, and the other, the other terrible thing about that is, you know, people will, inside a CTE, come up with this completely, this, like the string of like non-sargable calculations.

And that’ll be like the basis of the where clause in the next CTE. And it’s like, man, you ain’t helping no one. Like, that’s just, that’s just messed up that you’re asking SQL Server to do all that. You know, one thing, one thing that I try to instill in people is that if a, if a query plan is big and confusing to you, the optimizer probably didn’t think that much more of it.

The only way to get smaller plans is to have smaller sets of queries. I’d rather, I’d much rather troubleshoot like 20 small query plans than one gigantic query plan.

The more we can break this stuff up, the better. At least I think so. I’ve had very good luck breaking things up into smaller chunks of logic. I’d much rather fight with SQL Server over like the plan choice of a plan that has like two or three joins in it than the plan choice of a query that has like 40 joins in it.

Because it seems, it seems to me like I could, I could, I could have more of a say in what SQL Server is going to do with a two or three join query than I could with a 30 or 40 join query.

That just, that, that just seems like common sense to me, but you know, I don’t know. I’m just a bouncer. What do I know about this stuff anyway? Josh says, I’m thinking of when people accidentally use an eager operator and their EF prior to adding the where part.

So the query runs and then they filter in memory. Ooh. Ooh. Why would you do that to yourself? It’s an in-memory filter. I’ve seen people do that with paging queries though.

And I’ve seen them specifically do that with paging queries where let’s say you have someone selecting column one and column two, but then you need to like filter or order by column three.

And their choice would be to read everything into memory and sort by column three or do like, or like sort and or like filter on column three or, or do that in the database. When they do it in the database, SQL Server becomes painfully slow and unusable.

But when they do it in any framework, SQL Server seems to be okay, but it’s slow, but only because of the app servers. And it’s a lot cheaper to give more CPUs to an app server than it is to give more CPUs to SQL Server.

Imagine a world where we could give 24 cores to SQL Server for the same, for the same amount of money that you can give 24 cores to an app server. Or you can, you can give 512 gigs of RAM to an app server for free without, without the, that magical sprinkling that enterprise licensing does to your CPUs where it makes the same damn CPU that’s worth $2,000 in one place or $7,000 in another place.

Licensing is magic, magic, magic. Let’s see. Josh says, I think Stack Overflow mostly uses a micro RM called Dapper.

I have no idea. Paul says, what’s your view of columnstore batch mode adapt, adoption rates? Too small.

I mean, 2019 is going to make the batch mode stuff quicker, but columnstore is still going to be, I think, pretty niche, unfortunately. That’s why Joe can never get another job. Only like three people in the world use columnstore.

Professionally. No, I wish, I wish there was more of it. I wish I saw more. I frequently work with people who I see would benefit from it, but they’re on like 2012. Well, good news and bad news.

Bad news is you’re going to, you have, you have an upgrade project to complete. But, you know, I wish there was more. I am vaguely hopeful that 2019 will see improvements to batch mode that prior versions haven’t seen.

Specifically to batch sorts. And, and, and more operator adoption. Of.

Batch mode processing. I swear to God, if, if I ever see batch mode nested loops, that’s not just a bug in the plan XML. Someone at Microsoft is getting a fatal hug. Like that would be, that would be crazy.

See, Paul says, you’re absolutely right about tuning small queries. Even if you eventually combine some of them into a larger query in an informed way, it’s a better approach. Yeah.

You could even stick them in a CTE with a top to make them optimizer proof. Right? Sorry. Peter says, Nick Craver was all over EF Core on Twitter a while back.

Guess I just assumed. I think he’s doing .NET Core. I don’t think EF Core is necessarily what he’s talking about. But I don’t know.

I don’t know specifically. The only time Nick has actually responded to me on Twitter was when I posted the thing about the Windows key in period and Management Studio. And that was just to call me a monster.

Paul says, as long as top uses parentheses, I’m happy. Yes. You love to give your top expressions hugs. You’re a very, you’re a sweet and tender man.

And I hope that if there’s one thing that comes out of this webcast sponsored by a roll of athletic tape is that the world knows that Paul White is a sweet and tender man who deserves many more cases of wine than I could ever send him. But I’ll try. I will die consulting.

I mean, I’ll die consulting, trying to. Yeah, you get it. That thing. Yes. Heart with.

And you know what? I think that’s the perfect message to leave this webcast off on. Paul’s select top heart message. So thank you for coming. Thank you for putting up with me. And thank you to this roll of athletic tape that fell on the floor for sponsoring this week’s webcast.

See you next time. Amen.

Going Further


If this is the kind of SQL Server stuff you love learning about, you’ll love my training. Blog readers get 25% off the Everything Bundle — over 100 hours of performance tuning content. Need hands-on help? I offer consulting engagements from targeted investigations to ongoing retainers. Want a quick sanity check before committing to a full engagement? Schedule a call — no commitment required.

Last Week’s Almost Definitely Not Office Hours: March 8

ICYMI


Last week’s thrilling, stunning, flawless episode of whatever-you-wanna-call-it.

Thanks for watching!

Going Further


If this is the kind of SQL Server stuff you love learning about, you’ll love my training. Blog readers get 25% off the Everything Bundle — over 100 hours of performance tuning content. Need hands-on help? I offer consulting engagements from targeted investigations to ongoing retainers. Want a quick sanity check before committing to a full engagement? Schedule a call — no commitment required.

Last Week’s Almost Definitely Not Office Hours: March 1

ICYMI


Last week’s thrilling, stunning, flawless episode of whatever-you-wanna-call-it.

Well, uh, I was at SQLBits last week, and I didn’t record one. Perils of a single point of failure.

Thanks for watching!

Going Further


If this is the kind of SQL Server stuff you love learning about, you’ll love my training. Blog readers get 25% off the Everything Bundle — over 100 hours of performance tuning content. Need hands-on help? I offer consulting engagements from targeted investigations to ongoing retainers. Want a quick sanity check before committing to a full engagement? Schedule a call — no commitment required.

Last Week’s Almost Definitely Not Office Hours: February 22

ICYMI


Last week’s thrilling, stunning, flawless episode of whatever-you-wanna-call-it.

Thanks for watching!

Video Summary

In this video, I found myself going down a rabbit hole of technical discussions and personal anecdotes. The conversation started off with some interesting questions about database views and reporting tools, which led to a lively debate on the best practices for minimizing query hops and optimizing performance. As we delved deeper into the topic, it became clear that even simple decisions can have significant impacts on system efficiency.

One of the highlights was when Josh Darnell chimed in with his usual wit and expertise. He shared some insights about creating views directly on the data mart versus using local SQL Server views to access remote data, emphasizing the importance of reducing complexity for better performance. His famous status on Stack Exchange was a bit of a surprise but also a reminder of how much we can learn from each other in this community.

Full Transcript

Scallywags. All you scallywags. All right. Another Friday.

Hard to believe, right? Do-do-do-do-do-do. Oh, my God.

Someone showed up. You must have nothing to do. This is like a preview of what this mustache is going to look like in bits. It’s going to be, it’s going to be horrible. I can’t wait to shave this thing off my face.

I’m so terrified. But the worst part about it is having to explain to my family why I have a mustache. Because, so Joe, I don’t, I don’t know if you’ve, if you’ve been paying attention to certain things, but, at, at, at, at, at, at SQLBits, I am doing, I’m doing a charity thing where I’m dressing up like Freddie Mercury at Live Aid to, to deliver my, my regular session.

And, and he has quite a mustache for that. And so I can’t grow the whole beard because he didn’t have the whole beard. So I am growing the mustache to participate in this charity event.

So that’s my story. And I don’t know. That’s why I don’t have a whole beard.

That’s why I just have a mustache. And that’s why explaining it to my parents is a little, like, like anyone who sees me is a little bit awkward. Today’s my daughter’s birthday. And so there’s like video calls going on and they’re like, what’s on your face?

What’s, what’s, what’s wrong with you? Well, I have been. That’s why I got scruffed, but I got to, I don’t know. Because I, I don’t, because due to England’s weird laws, I’m not terribly confident that I would, I would be able to buy the necessary equipment to shave a beard off on short notice.

I think I might have to, I might have to apply for a license or a permit to, to get like some clippers because they, they have some weird stuff. But then I want to get like busted by the police.

Like, look, we found this weapon. I’m like, I was going to shave my beard. They have weird laws over there, man. They like, like won’t sell eggs and flour to people under 18. Like you can’t buy like plastic knives and stuff.

And the police like go around to like various, like, like, like, like projects in England are called estates. And like, there’s all these like funny Twitter things of like the, the police there going around to various projects.

And like, we did a weapon sweep and look what we found. There’s like bike tires, like a pair of scissors and like a butter knife. It’s nuts. Like, wow.

People are insane. But yeah, I don’t know. Funny stuff. All right.

So does anyone actually have like a SQL Server question? Or do you just come here to hear me babble about other things? It’s fine either way. I can, I can go on for days. I don’t know.

We were getting peril, perilously close to breaking double digits. Yeah. Oh yeah. You had a question last week that I missed because I got embarrassed and turned the camera. Actually, no, there’s nothing from chat was coming in and I felt very strange.

Like, cause this is like silence. Oh boy. All right. So one, I like to use SQL Server non AD logins for linked servers. Is there any reason I should switch to AD users instead?

I can’t think of a good one. You know, for me, the linked server question comes down to a couple of things. One, if you’re on a version of SQL Server prior to 2012, you need SA privileges to be able to use like cross database statistics.

Uh, which can make like running queries kind of awkward. Um, and I’m not saying that you should go and use SA for all your linked servers.

I’m saying that you should probably maybe like get on SQL Server 2012 service pack. One ish, I believe is when they fix it.

Uh, so I would, I would be more concerned with that. Then like, you know, for, for linked servers, you know, um, like just really like bare minimum permissions to get in and get out and like, don’t try to run the query across there, whatever data you have, just go grab it and pull it locally.

Uh, this, this really awful thing that happens with, uh, remote. I forget if it’s updates and deletes too, but this is really horrible thing that happens with remote inserts where SQL Server will behind the scenes, turn it into like a row by row thing.

Instead of like doing the insert all at once, it like, like just sticks a row in at a time. I forget. I think, I think Max Vernon was telling me about it. I’ll go, I’ll go ask him and I don’t know, tell him to blog about it or something.

Cause I, I don’t, I don’t even have enough SQL servers to make a link server. Uh, Julie asked, actually, Julie, I have a question. Did you get the stickers I sent? Cause I sent those out. Kevin said he got his. I wanted to make sure you got yours too.

do I have suggestions for learning visual studio, man? I should, I don’t even know visual studio. All right. Man.

Uh, no, I mean, what do you want to do in visual studio? Are you like using SQL Server in visual studio? Are you like learning or doing C sharp? Like what’s, what do you want to do with visual studio that you want to learn?

Learning visual studios, like how do I learn SSMS? It’s like, I don’t know. Watch shortcuts. Silly, silly stuff.

Okay. Yeah. Those virtual labs are like disappear. Oh, I don’t, I don’t know. I can’t say that they’re disappearing, but, um, the one that I really liked was failover clusters.

And the, uh, the Microsoft virtual lab that I used to go, I used to have like bookmarked for failover cluster stuff disappeared recently.

They’re like, they like got rid of a whole bunch of them. Uh, Julie says, uh, I’m developing SSIS. And Deja.

Oh, wow. Okay. Uh, good question. I, I don’t know. I don’t, I don’t really use SSIS. I hear that bids is what a lot of people open. Um, if you’re on Twitter, I would harass Andy Leonard about that or just like go to his, Andy Leonard’s blog.

Cause he, he writes a lot about that type of thing where I am. I am absolutely useless when it comes to SSIS. I’m like, like demonstrably bad. An SSIS lab.

Wow. Maybe I should go do that. Maybe I’ll become like a really good SSIS consultant and give Andy a run for his money. This can make it. I could never do that. It’s, it’s, it’s too late for me to go learning those tricks.

I gotta, I gotta stick to the tricks. I know at this point. So what do you use SSIS for? I’m curious. Like, I don’t, I don’t think it’s a bad thing.

I, I think SSIS has many wonderful, uh, applications. I’m just curious what, what, what are you guys using it for? ETO.

Yeah, that’s pretty common. Probably, probably better than, PowerShell for ETL, right? Anyone ever tried mangling text files in PowerShell? It is painful.

Oh, profiles from FTP. Wow. Yeah. Uh, I, I used to, I used to do that with TC. Uh, I had, I had a, I had a thing, I had a whole thing set up.

Uh, I did, I did store procedure that would create a cookie. Like it would, it would like create a, it would create a user cookie and it would feed it to curl. And curl would go check this URL for a new file.

And man, that was funny to write. Mostly because it worked. And I have no idea how or why it worked.

Files are created from marketing cloud. Wow. Sounds intense. There was a, I used to remember, I remember I used to have to, I had a, was it seven zip or like one of those zip files.

Well, I had like a, I had a store procedure that would like open up the command line executable for those. And like, like unzip stuff. Brutal.

I don’t know why I never learned like, I don’t know why I, I was like, I got to do this in T SQL. Like, I got to write a store procedure that does this because there are like so many better.

Like languages that would have been good. But at that point it would have been like, Oh crap. I have to learn a whole new language. Like I already knew T SQL. You could just like feed stuff to XP command shell all day long. FileZilla is good for that though.

FileZilla is, I don’t know, the best FTP program. I don’t know. I thought, I thought war FTP was cool when I was younger. I used to run FTP servers off my, off my computer.

And like, I thought it was funny. Cause I would like share MP3s with my friends. And war FTP. That was, that was, that was, I think like the, one of the first client server things I ever got into. The other one was hotline server.

That was crazy. And like the nineties hotline, man, that was a wild West. You could, you could get anything. I remember like when I, when I was, when I was getting my NT certs, that was like, I used hotline and that was like, there was like wares all over the place.

And that’s where I got like, so like I would, I would like pull computers out of the trash for like companies that went out of business. And I set up like a home, home network in my room.

And with like installed stuff from, from hotline. It was like, like all the NT 4.0. I’m probably going to get arrested for like piracy right now. Josh, John L says, hello.

Does Josh have a SQL cloud? I don’t know. Josh is now. DBA. DBA. Stack exchange famous. He answered a question that hit the hot network question list. And now forget it, man.

It’s going to be too good for us soon. It’s going to have a moderator badge. It’s going to be off. It’s going to be very lonely without him. He’s the only web developer I can stand.

And you, you’re a hot network question, man. It’s not fun. No, you can’t lie. You’re going to, people are going to be asking you for autographs. People, people are going to be quoting you in questions.

You’re going to say, Josh Darnell says this, and then they’re going to ask a question about what you said. They’re going to expect you to answer it.

They’re going to just wait for you. SQL dev DB has another good question. I want to give the reporting tool access via views.

Is it better to do this by creating the views directly on the data mart or creating views on the reporting tools, local SQL Server, and have those views go to the views on double.

I would, I think the fewer hops you get into the better. Generally, I prefer fewer hops. The more hops there are, the more complicated things get.

It’s not, and not even from like, like a, like a tech, like a, like a technical perspective, but just like the poor optimizer now has to like, like unravel a view and then go across to another server and unravel a view.

And you’re just going to give that optimizer a break, man. Give it, give it a rest. Just let, let it, let it just do things once. Josh is so famous.

He just said, LOL famous and left. If anyone needs WordPress consulting, you should talk to Josh. He’s very, he’s very good at CSS. He helped me tremendously on my site.

Uh, it would look awful if it weren’t for him. Everything would be misaligned and out of whack. And like, uh, like all, all of the form text would be the same color as the background.

It would be, it would be a disaster. So if, if, if I ever make a million dollars, the first thing I’m going to do is hire Josh to just hang out and do nothing for a few months.

Pretend he’s working on my WordPress site. The rest of the million dollars is going to go to booze and women though. Forget it.

Glad to help. See what, what, what I should have done is, is gamified it. And I should have, uh, I should have, I should have like asked a question on like web dev.

Is there, is there like a web dev stack? Exchange or is it just stack overflow? Let’s see. Josh says, I needed to add a filter to an index view that required a left join the other day.

Do you ever run into that? How do you work around that restriction? Uh, no. Uh, and that’s one of the unfortunate things about index views. And actually, I think, let me go look.

Cause I sort of remember, hold on. Uh, uh, index. You. Cause I remember that it was a lot of weird stuff. You can’t do in an index view, but I can’t remember.

Yeah. So you can use not exists. I think, I think not exists would be your friend there.

I would, I would, I would, instead of messing around with more joins, if you need to find something that exists or doesn’t exist, I would, I would do that.

I don’t know. Maybe, maybe I’m, maybe I’m just, maybe, maybe I’m wrong though. Uh, let’s see. Louie says, SP who is active, get locks equals one. The lock column has lots of info on it. How is best to decipher it?

Uh, it shouldn’t have a lot of information in it. Uh, when that happens, I, I, I think that something might be a bit of muck.

So like, I know it’s like sometimes when you run a modification query and you do get locks equals one, uh, you might end up seeing a bunch of information from like system tables.

And I generally tend to ignore that. Uh, when I, I, and like focus on the user tables at hand.

Cause when I see that stuff, I think like something is something, something weird happened in the XML. Um, another good way to see, uh, locks that is actually. So, uh, I, I, uh, a while back when I was talking, to Adam, like, like I haven’t, I don’t talk to Adam, but I, I was talking to Adam specifically about SP who is active and actually over on the documentation page.

Uh, I don’t know if he mentions explicitly that get locks equals one is, uh, can be kind of tough on the server when there’s a lot of locking activity going on, but he told me about a couple, uh, commands in the, in the documentation.

I said, put the link into chat there. So if you want an SP who is active with get task info equals two and get additional info equals one, you can, you get this additional info. Obviously you get this additional info column that gives you, uh, more summarized lock information that can be helpful in troubleshooting stuff too.

Let’s see. Darren says, I’ve seen this error before and I get the basic premise, the query processor ran out of internal resources, cannot produce a query plan. Uh, blah, blah, blah, blah.

Uh, no, well, no. So the reason that that comes up is that, uh, someone has passed in a very, so whenever I, so I’m going to say, let me, let me rewind that a little.

When I’ve seen that, when that’s happened to me, uh, it was back when I was working with relativity and the way that the GUI worked, maybe at the time, maybe it’s changed, but people could pass in these very, people could pass in like a list of IDs.

And what they would do is they would run a saved search. This like very long list of IDs would show up as the results. Then they would copy and paste that into the search box for a search.

And they would say like where ID in or not in or whatever. And there would be like a hundred thousand IDs pasted in or something. And, uh, that’s usually when I’ve seen the query processor barf is when there’s just a very long list of ends or ors or something that, um, um, has just made things far too difficult for it to, to carry on.

Yeah, exactly. Carry like a, putting like a bunch of stuff in an in cause can definitely, uh, ruin the optimizer’s day. So there’s really no way to force that except to tell your users to stop being ding dongs and write more saying queries.

If someone, if someone truly needs to like a 10,000 or 30,000 or 40,000 item in cause, just get a temp table, man, get a room.

it’s, it’s mean, it’s mean to do that. It’s mean to do that to people, especially the optimizer, that delicate, fragile optimizer, right?

Man, that thing’s crazy. So, uh, I was excited kind of because over on, on Twitter, I made a couple of polls about, uh, versions of SQL Server that people were planning on moving to because 2008 and 2008 are two are going to be end of life in like five months, like four or five months, like this summer.

This is gonna be a, I’m going to throw, I’m going to throw my own personal summer jam. When that happens, that’s, I can’t wait to not look at those things anymore. But, um, uh, I was excited because I put up polls about little people moving to.

And the first funny thing that happened is, uh, twice as many people said that they were going to 2014 as 2012, which, uh, Oh, sorry.

Going to 2012 was 2014, which cracked me up. It was like 11% to 2012 and 5% to 2014. That was really funny. Uh, a lot of the, the 2017 was the big winner there, but then I put up another one that included 2019.

A lot of people said that they were moving to 2019. So I think, I think Microsoft might have a hit on their hands at this one. I think, I think they might go platinum with 2019.

That’s going to be, that’s going to be fun to watch, especially if like, um, you know, people aren’t just like bull bull crapping me about adoption. I don’t, I don’t want to swear.

Cause I think like YouTube’s algorithm might flag me as adult content, but if people aren’t like really moving to people are really moving to 2019, that’s going to be fun. Cause like from, from a consulting point of view, I, I, I feel like kind of groundhog day with this, with this stuff that I have to keep telling people about and fixing.

And Microsoft is finally like taking the groundhog day stuff out of that. And I get to focus on cooler problems. Like, like this week I’ve been, uh, I’ve been, I’ve been helping out some, my, my, my friend, Mike Walsh over at straight path, uh, with some query tuning stuff.

And there were just like some amazingly long running queries. It just needed like one or two tiny little tweaks that weren’t like, like, you know, groundhog day stuff to tweak.

And it was just so nice to be like, no, look, it’s crazy. You’ve got these two index pools over here. When we create these indexes, it takes a minute instead of an hour. Or like, uh, when we like, you know, go from trying to like self-reference this table variable update and like dump things into a temp table first.

Instead, uh, we can get things from 18 hours to like a few minutes. And there was some really, really nice things. And, I found some like other fun queries were like, there was a total, like totally unnecessary distinct was causing stuff to run for like five to 10 seconds.

And without the distinct, it was like blazing fast. And then I found some other stuff where, uh, these, these, uh, things called performance spools, table spools were making queries run for like 10, 12 seconds.

And without them, they finish in like under a second. So it’s really, it’s really fun to like, you know, realize it’s really fun to like get kind of back in the trenches a little bit and be like, Oh wow. Like, uh, the stuff that I talk about, isn’t just malarkey that works in stack overflow.

It’s like generally applicable to people’s stuff too. So it’s been fun. Uh, let’s see. Uh, do you have any plans to expand your services into BI? And absolutely not.

Uh, no. Um, that’s just not my jam. Uh, I, I wish that I could find a way to like that stuff, but I don’t know.

It’s like, American whiskey. I just, I can, I can drink it if I’m drunk, but it’s, it’s never going to be, never going to be my sipper. You know what I mean?

How often do you see query store use in the wild? Uh, you know, not enough when I really want it. And too often when I shouldn’t.

So, uh, it’s, it’s, first of all, I love the idea of query store, but man, they’ve made that tough to turn on.

Like by default, it just collects so much crap. And then when it’s on and like, you have a busy system, people are just like, that thing just like, like logging all that information is tough.

That’s just like, that’s some serious observer overhead. You’re collecting query plans. You’re collecting all sorts of metrics and you’re just dumping it into tables. And it’s like, you think that’s free?

Uh, uh, busy system, man. Query store will mess you up, which sucks because it’s like in, in, in theory, it is such a cool idea to have that, like a persisted plan cash, right?

Where like, you can just get like endless reams of information from, that’s like such a cool idea, but then you got to realize anything you do that, that, that is collects that much, like especially that much excess, ML and all the text from your queries, all that hurts.

So I totally understand why people don’t have it turned on, but man, like when they don’t and I see it, I’m like, Oh, I wish I had you. But then I’m like, Oh, I feel bad for people to turn you on. And then their server, that CPU is like smoking and like making grinding noises.

Sorry. Oh man. All right.

Someone say something. Someone say something funny. Tell me, tell me a joke. I could use a good laugh. I wonder if anyone sent me a good email. I got a suggestion that I should take like email and Twitter questions prior to doing this.

Uh, and I’m fine with that because sometimes, you know, it’s, it’s not easy to fill, uh, like a half hour or so void.

And so I, if you want to say, if you like, if anyone’s watching this later and you want to send in like an email question, you can go to your Twitter question.

You can hit me up on, on the Twitter. You can welcome me to like 2005. I’m only getting on there. Or, uh, you can shoot me an email via my website contacting.

If you have a question that you would like answered here, but you just can’t physically show up because you have a, like, I don’t know.

You have work things or time zone things. I think Julie has a joke for me. Thank you, Julie. Why don’t you see elephants hiding in trees? I don’t know. Why don’t you see elephants hiding in trees? This better be good.

Because they are really good at hiding. Damn. That is funny. I didn’t see that coming. I thought there was going to be a trunk joke in there. That was very good though.

Oh, I appreciate that. The longer, the longer I think about it, the more I like it.

That’s very good. Now, now, now I don’t fit. Now I don’t regret sending you stickers, Julie. I’m glad I sent those over to you. And you’ve, you, you’ve made the famous Josh Darnell laugh.

Josh Darnell of, uh, of, of backups crashing SQL Server fame. You’ve made him laugh. So, I don’t know.

Maybe, maybe you’ll be famous too. Now. Maybe, maybe, maybe you can take that on the road. Yeah. You should just go home for the day. Go enjoy. Go enjoy. Go put stickers on stuff. Where did those stickers end up?

Now I’m curious. Hopefully not in the trash. Hopefully he didn’t seem like, oh, he’s ugly. How do we get a sticker?

Uh, you can send me an email. Well, you can contact me in some way that is, is private where you don’t mind sending your address and I will stick some stuff in the mail there. And I will.

So, I, I, I get, I get piles of these. Well, I got, I have, I have, I have a good pile of these things. I have, I have this many. So I can send, I can send out a few before bits.

You know, who knows? I mean, maybe I’ll go out of business, right? Just kidding. Just kidding. All those support contracts are good. Written in stone. Yeah.

Well, we send me a, shoot me an email or a Twitter DM or something. I don’t know. Figure it out. Notice Josh didn’t ask for a sticker. He’s too famous.

What is that poster over my shoulder with the creepy guy? That, that poster is one of the most beloved people in my life. My friend Rue.

And it’s a list of things that Rue is good at. And it’s a list. It was a collaborative list where me and other people who have equal, equal amounts of adoration for this strange man, put together a list of, of comical things that he is very good at.

And I, I have proudly had that in every single office that every, every single home office that I’ve had. So I guess that’s like two, but, but it’s not going away.

That’s my jam. I, I will, I, I, I, I will never show you the, I would never do a closeup of the list.

I’m not going to zoom in on the list, but that’s what it is. Uh, he’s, he’s an odd bird. He’s great though. Uh, would you like me to send you?

Yeah. Do you have stickers? Do you have stickers? If you have stickers, I’ll take stickers right now. The only sticker I have on my laptop is mine. And peel that other one off. Not giving any free promotion anymore.

Yeah. Take your, you know, you, you and, you and Farrah should autograph it.

Then I’ll just hold this. I’ll just hold that over Joe’s head. Make fun of, make fun of Joe Obish for not having as much street credit as me. Raven DB stickers.

Yeah. I know you like Raven DB. They tell you why you don’t need, why indexes don’t get used. Everyone else, SQL Server doesn’t tell you that. SQL Server hides that. How’s that issue going anyway?

Did I mean, did you, do you have like, do you have more votes on that? Is there a way you would detect a server spending too much time compiling queries? Uh, so that would go to two things.

One is resource semaphore query compile as a weight. Uh, if you’re running into that, then you do not have enough memory to adequately compile your queries at once. And the other would be sort of an unfortunate, like a, like a really unfortunate plan cash query.

Uh, so if you look through SP blitz cash, um, there are parts where I pull out the compile time from cash plans. And I, I remember warning on that.

That’s an, it’s an, so a query store has it as just a column value pulled out for you. So if you have query store turned on, you can look in query store. I forget, I forget which view it’s in.

Cause I, I wrote, I wrote the queries once for a reason. So I wouldn’t have to remember, remember all this stuff, but one of the, one of the views in for query store has a compile time pulled out for you. If you just want to look at the plan cash itself, uh, you could shred the compile time thing out of the XML and, I mean, but that would be awful though.

Cause you, that like, like there’s no way to like figure out which ones were bad from the, from like the beginning. But yeah, uh, I think that’s where I would start.

I, so like when I, when I think it’s fun too, cause when I think about that as a problem, I w I’m starting to wonder is like, is it a plan caching issue where like you, like you’re not reusing plans and like you’re, you’re spending a lot of time compiling new plant, like OLTP style comp, like piling new plans as they come in, or like you have gigantic queries coming in and SQL service.

It’s like, whoa, whoa, whoa, whoa, whoa, we’re going to, we’re going to read this one close. So you’re going to print this one out and go, go take a bathroom break.

Big pile of votes. No response. Let’s see. Uh, did I click on that link? No, I just let people see it. Let me go in here. Yeah.

119 votes, man. That’s rough. You know what? I’m going to, I’m going to make it one 20. Don’t tell, don’t tell anyone I double voted. Now, now I have, I have a new voting. I have a new account for, for filing issues.

So I get to double vote on that. Don’t tell 120 votes. Wow. Yeah, that would be cool. Come on, Microsoft. Oh, who am I kidding? No one’s watching this thing anyway.

All right. Uh, I’ve been standing here for a half hour and I need to go do something else for a minute.

Uh, thank you for coming and asking questions and I will see you next week. Actually, I don’t know. I’m trying to figure it. Cause I’m going to be in Manchester for business next week. So I got to figure out how I’m going to do that. Uh, I don’t know if I’m going to try to do it like at 12 Eastern or if I’m going to try to do it at like bits, bits noon.

I haven’t figured it out. I’ll figure it out and I’ll let you know. I will, I will have an update on that. All right. I’ll, I’ll, I’ll catch y’all later. I have to hit this button here. Thanks for coming. Thanks for asking questions.

Yeah. You would make streaming difficult forest.

Video Summary

In this video, I found myself going down a rabbit hole of technical discussions and personal anecdotes. The conversation started off with some interesting questions about database views and reporting tools, which led to a lively debate on the best practices for minimizing query hops and optimizing performance. As we delved deeper into the topic, it became clear that even simple decisions can have significant impacts on system efficiency.

One of the highlights was when Josh Darnell chimed in with his usual wit and expertise. He shared some insights about creating views directly on the data mart versus using local SQL Server views to access remote data, emphasizing the importance of reducing complexity for better performance. His famous status on Stack Exchange was a bit of a surprise but also a reminder of how much we can learn from each other in this community.

Full Transcript

Scallywags. All you scallywags. All right. Another Friday.

Hard to believe, right? Do-do-do-do-do-do. Oh, my God.

Someone showed up. You must have nothing to do. This is like a preview of what this mustache is going to look like in bits. It’s going to be, it’s going to be horrible. I can’t wait to shave this thing off my face.

I’m so terrified. But the worst part about it is having to explain to my family why I have a mustache. Because, so Joe, I don’t, I don’t know if you’ve, if you’ve been paying attention to certain things, but, at, at, at, at, at, at SQLBits, I am doing, I’m doing a charity thing where I’m dressing up like Freddie Mercury at Live Aid to, to deliver my, my regular session.

And, and he has quite a mustache for that. And so I can’t grow the whole beard because he didn’t have the whole beard. So I am growing the mustache to participate in this charity event.

So that’s my story. And I don’t know. That’s why I don’t have a whole beard.

That’s why I just have a mustache. And that’s why explaining it to my parents is a little, like, like anyone who sees me is a little bit awkward. Today’s my daughter’s birthday. And so there’s like video calls going on and they’re like, what’s on your face?

What’s, what’s, what’s wrong with you? Well, I have been. That’s why I got scruffed, but I got to, I don’t know. Because I, I don’t, because due to England’s weird laws, I’m not terribly confident that I would, I would be able to buy the necessary equipment to shave a beard off on short notice.

I think I might have to, I might have to apply for a license or a permit to, to get like some clippers because they, they have some weird stuff. But then I want to get like busted by the police.

Like, look, we found this weapon. I’m like, I was going to shave my beard. They have weird laws over there, man. They like, like won’t sell eggs and flour to people under 18. Like you can’t buy like plastic knives and stuff.

And the police like go around to like various, like, like, like, like projects in England are called estates. And like, there’s all these like funny Twitter things of like the, the police there going around to various projects.

And like, we did a weapon sweep and look what we found. There’s like bike tires, like a pair of scissors and like a butter knife. It’s nuts. Like, wow.

People are insane. But yeah, I don’t know. Funny stuff. All right.

So does anyone actually have like a SQL Server question? Or do you just come here to hear me babble about other things? It’s fine either way. I can, I can go on for days. I don’t know.

We were getting peril, perilously close to breaking double digits. Yeah. Oh yeah. You had a question last week that I missed because I got embarrassed and turned the camera. Actually, no, there’s nothing from chat was coming in and I felt very strange.

Like, cause this is like silence. Oh boy. All right. So one, I like to use SQL Server non AD logins for linked servers. Is there any reason I should switch to AD users instead?

I can’t think of a good one. You know, for me, the linked server question comes down to a couple of things. One, if you’re on a version of SQL Server prior to 2012, you need SA privileges to be able to use like cross database statistics.

Uh, which can make like running queries kind of awkward. Um, and I’m not saying that you should go and use SA for all your linked servers.

I’m saying that you should probably maybe like get on SQL Server 2012 service pack. One ish, I believe is when they fix it.

Uh, so I would, I would be more concerned with that. Then like, you know, for, for linked servers, you know, um, like just really like bare minimum permissions to get in and get out and like, don’t try to run the query across there, whatever data you have, just go grab it and pull it locally.

Uh, this, this really awful thing that happens with, uh, remote. I forget if it’s updates and deletes too, but this is really horrible thing that happens with remote inserts where SQL Server will behind the scenes, turn it into like a row by row thing.

Instead of like doing the insert all at once, it like, like just sticks a row in at a time. I forget. I think, I think Max Vernon was telling me about it. I’ll go, I’ll go ask him and I don’t know, tell him to blog about it or something.

Cause I, I don’t, I don’t even have enough SQL servers to make a link server. Uh, Julie asked, actually, Julie, I have a question. Did you get the stickers I sent? Cause I sent those out. Kevin said he got his. I wanted to make sure you got yours too.

do I have suggestions for learning visual studio, man? I should, I don’t even know visual studio. All right. Man.

Uh, no, I mean, what do you want to do in visual studio? Are you like using SQL Server in visual studio? Are you like learning or doing C sharp? Like what’s, what do you want to do with visual studio that you want to learn?

Learning visual studios, like how do I learn SSMS? It’s like, I don’t know. Watch shortcuts. Silly, silly stuff.

Okay. Yeah. Those virtual labs are like disappear. Oh, I don’t, I don’t know. I can’t say that they’re disappearing, but, um, the one that I really liked was failover clusters.

And the, uh, the Microsoft virtual lab that I used to go, I used to have like bookmarked for failover cluster stuff disappeared recently.

They’re like, they like got rid of a whole bunch of them. Uh, Julie says, uh, I’m developing SSIS. And Deja.

Oh, wow. Okay. Uh, good question. I, I don’t know. I don’t, I don’t really use SSIS. I hear that bids is what a lot of people open. Um, if you’re on Twitter, I would harass Andy Leonard about that or just like go to his, Andy Leonard’s blog.

Cause he, he writes a lot about that type of thing where I am. I am absolutely useless when it comes to SSIS. I’m like, like demonstrably bad. An SSIS lab.

Wow. Maybe I should go do that. Maybe I’ll become like a really good SSIS consultant and give Andy a run for his money. This can make it. I could never do that. It’s, it’s, it’s too late for me to go learning those tricks.

I gotta, I gotta stick to the tricks. I know at this point. So what do you use SSIS for? I’m curious. Like, I don’t, I don’t think it’s a bad thing.

I, I think SSIS has many wonderful, uh, applications. I’m just curious what, what, what are you guys using it for? ETO.

Yeah, that’s pretty common. Probably, probably better than, PowerShell for ETL, right? Anyone ever tried mangling text files in PowerShell? It is painful.

Oh, profiles from FTP. Wow. Yeah. Uh, I, I used to, I used to do that with TC. Uh, I had, I had a, I had a thing, I had a whole thing set up.

Uh, I did, I did store procedure that would create a cookie. Like it would, it would like create a, it would create a user cookie and it would feed it to curl. And curl would go check this URL for a new file.

And man, that was funny to write. Mostly because it worked. And I have no idea how or why it worked.

Files are created from marketing cloud. Wow. Sounds intense. There was a, I used to remember, I remember I used to have to, I had a, was it seven zip or like one of those zip files.

Well, I had like a, I had a store procedure that would like open up the command line executable for those. And like, like unzip stuff. Brutal.

I don’t know why I never learned like, I don’t know why I, I was like, I got to do this in T SQL. Like, I got to write a store procedure that does this because there are like so many better.

Like languages that would have been good. But at that point it would have been like, Oh crap. I have to learn a whole new language. Like I already knew T SQL. You could just like feed stuff to XP command shell all day long. FileZilla is good for that though.

FileZilla is, I don’t know, the best FTP program. I don’t know. I thought, I thought war FTP was cool when I was younger. I used to run FTP servers off my, off my computer.

And like, I thought it was funny. Cause I would like share MP3s with my friends. And war FTP. That was, that was, that was, I think like the, one of the first client server things I ever got into. The other one was hotline server.

That was crazy. And like the nineties hotline, man, that was a wild West. You could, you could get anything. I remember like when I, when I was, when I was getting my NT certs, that was like, I used hotline and that was like, there was like wares all over the place.

And that’s where I got like, so like I would, I would like pull computers out of the trash for like companies that went out of business. And I set up like a home, home network in my room.

And with like installed stuff from, from hotline. It was like, like all the NT 4.0. I’m probably going to get arrested for like piracy right now. Josh, John L says, hello.

Does Josh have a SQL cloud? I don’t know. Josh is now. DBA. DBA. Stack exchange famous. He answered a question that hit the hot network question list. And now forget it, man.

It’s going to be too good for us soon. It’s going to have a moderator badge. It’s going to be off. It’s going to be very lonely without him. He’s the only web developer I can stand.

And you, you’re a hot network question, man. It’s not fun. No, you can’t lie. You’re going to, people are going to be asking you for autographs. People, people are going to be quoting you in questions.

You’re going to say, Josh Darnell says this, and then they’re going to ask a question about what you said. They’re going to expect you to answer it.

They’re going to just wait for you. SQL dev DB has another good question. I want to give the reporting tool access via views.

Is it better to do this by creating the views directly on the data mart or creating views on the reporting tools, local SQL Server, and have those views go to the views on double.

I would, I think the fewer hops you get into the better. Generally, I prefer fewer hops. The more hops there are, the more complicated things get.

It’s not, and not even from like, like a, like a tech, like a, like a technical perspective, but just like the poor optimizer now has to like, like unravel a view and then go across to another server and unravel a view.

And you’re just going to give that optimizer a break, man. Give it, give it a rest. Just let, let it, let it just do things once. Josh is so famous.

He just said, LOL famous and left. If anyone needs WordPress consulting, you should talk to Josh. He’s very, he’s very good at CSS. He helped me tremendously on my site.

Uh, it would look awful if it weren’t for him. Everything would be misaligned and out of whack. And like, uh, like all, all of the form text would be the same color as the background.

It would be, it would be a disaster. So if, if, if I ever make a million dollars, the first thing I’m going to do is hire Josh to just hang out and do nothing for a few months.

Pretend he’s working on my WordPress site. The rest of the million dollars is going to go to booze and women though. Forget it.

Glad to help. See what, what, what I should have done is, is gamified it. And I should have, uh, I should have, I should have like asked a question on like web dev.

Is there, is there like a web dev stack? Exchange or is it just stack overflow? Let’s see. Josh says, I needed to add a filter to an index view that required a left join the other day.

Do you ever run into that? How do you work around that restriction? Uh, no. Uh, and that’s one of the unfortunate things about index views. And actually, I think, let me go look.

Cause I sort of remember, hold on. Uh, uh, index. You. Cause I remember that it was a lot of weird stuff. You can’t do in an index view, but I can’t remember.

Yeah. So you can use not exists. I think, I think not exists would be your friend there.

I would, I would, I would, instead of messing around with more joins, if you need to find something that exists or doesn’t exist, I would, I would do that.

I don’t know. Maybe, maybe I’m, maybe I’m just, maybe, maybe I’m wrong though. Uh, let’s see. Louie says, SP who is active, get locks equals one. The lock column has lots of info on it. How is best to decipher it?

Uh, it shouldn’t have a lot of information in it. Uh, when that happens, I, I, I think that something might be a bit of muck.

So like, I know it’s like sometimes when you run a modification query and you do get locks equals one, uh, you might end up seeing a bunch of information from like system tables.

And I generally tend to ignore that. Uh, when I, I, and like focus on the user tables at hand.

Cause when I see that stuff, I think like something is something, something weird happened in the XML. Um, another good way to see, uh, locks that is actually. So, uh, I, I, uh, a while back when I was talking, to Adam, like, like I haven’t, I don’t talk to Adam, but I, I was talking to Adam specifically about SP who is active and actually over on the documentation page.

Uh, I don’t know if he mentions explicitly that get locks equals one is, uh, can be kind of tough on the server when there’s a lot of locking activity going on, but he told me about a couple, uh, commands in the, in the documentation.

I said, put the link into chat there. So if you want an SP who is active with get task info equals two and get additional info equals one, you can, you get this additional info. Obviously you get this additional info column that gives you, uh, more summarized lock information that can be helpful in troubleshooting stuff too.

Let’s see. Darren says, I’ve seen this error before and I get the basic premise, the query processor ran out of internal resources, cannot produce a query plan. Uh, blah, blah, blah, blah.

Uh, no, well, no. So the reason that that comes up is that, uh, someone has passed in a very, so whenever I, so I’m going to say, let me, let me rewind that a little.

When I’ve seen that, when that’s happened to me, uh, it was back when I was working with relativity and the way that the GUI worked, maybe at the time, maybe it’s changed, but people could pass in these very, people could pass in like a list of IDs.

And what they would do is they would run a saved search. This like very long list of IDs would show up as the results. Then they would copy and paste that into the search box for a search.

And they would say like where ID in or not in or whatever. And there would be like a hundred thousand IDs pasted in or something. And, uh, that’s usually when I’ve seen the query processor barf is when there’s just a very long list of ends or ors or something that, um, um, has just made things far too difficult for it to, to carry on.

Yeah, exactly. Carry like a, putting like a bunch of stuff in an in cause can definitely, uh, ruin the optimizer’s day. So there’s really no way to force that except to tell your users to stop being ding dongs and write more saying queries.

If someone, if someone truly needs to like a 10,000 or 30,000 or 40,000 item in cause, just get a temp table, man, get a room.

it’s, it’s mean, it’s mean to do that. It’s mean to do that to people, especially the optimizer, that delicate, fragile optimizer, right?

Man, that thing’s crazy. So, uh, I was excited kind of because over on, on Twitter, I made a couple of polls about, uh, versions of SQL Server that people were planning on moving to because 2008 and 2008 are two are going to be end of life in like five months, like four or five months, like this summer.

This is gonna be a, I’m going to throw, I’m going to throw my own personal summer jam. When that happens, that’s, I can’t wait to not look at those things anymore. But, um, uh, I was excited because I put up polls about little people moving to.

And the first funny thing that happened is, uh, twice as many people said that they were going to 2014 as 2012, which, uh, Oh, sorry.

Going to 2012 was 2014, which cracked me up. It was like 11% to 2012 and 5% to 2014. That was really funny. Uh, a lot of the, the 2017 was the big winner there, but then I put up another one that included 2019.

A lot of people said that they were moving to 2019. So I think, I think Microsoft might have a hit on their hands at this one. I think, I think they might go platinum with 2019.

That’s going to be, that’s going to be fun to watch, especially if like, um, you know, people aren’t just like bull bull crapping me about adoption. I don’t, I don’t want to swear.

Cause I think like YouTube’s algorithm might flag me as adult content, but if people aren’t like really moving to people are really moving to 2019, that’s going to be fun. Cause like from, from a consulting point of view, I, I, I feel like kind of groundhog day with this, with this stuff that I have to keep telling people about and fixing.

And Microsoft is finally like taking the groundhog day stuff out of that. And I get to focus on cooler problems. Like, like this week I’ve been, uh, I’ve been, I’ve been helping out some, my, my, my friend, Mike Walsh over at straight path, uh, with some query tuning stuff.

And there were just like some amazingly long running queries. It just needed like one or two tiny little tweaks that weren’t like, like, you know, groundhog day stuff to tweak.

And it was just so nice to be like, no, look, it’s crazy. You’ve got these two index pools over here. When we create these indexes, it takes a minute instead of an hour. Or like, uh, when we like, you know, go from trying to like self-reference this table variable update and like dump things into a temp table first.

Instead, uh, we can get things from 18 hours to like a few minutes. And there was some really, really nice things. And, I found some like other fun queries were like, there was a total, like totally unnecessary distinct was causing stuff to run for like five to 10 seconds.

And without the distinct, it was like blazing fast. And then I found some other stuff where, uh, these, these, uh, things called performance spools, table spools were making queries run for like 10, 12 seconds.

And without them, they finish in like under a second. So it’s really, it’s really fun to like, you know, realize it’s really fun to like get kind of back in the trenches a little bit and be like, Oh wow. Like, uh, the stuff that I talk about, isn’t just malarkey that works in stack overflow.

It’s like generally applicable to people’s stuff too. So it’s been fun. Uh, let’s see. Uh, do you have any plans to expand your services into BI? And absolutely not.

Uh, no. Um, that’s just not my jam. Uh, I, I wish that I could find a way to like that stuff, but I don’t know.

It’s like, American whiskey. I just, I can, I can drink it if I’m drunk, but it’s, it’s never going to be, never going to be my sipper. You know what I mean?

How often do you see query store use in the wild? Uh, you know, not enough when I really want it. And too often when I shouldn’t.

So, uh, it’s, it’s, first of all, I love the idea of query store, but man, they’ve made that tough to turn on.

Like by default, it just collects so much crap. And then when it’s on and like, you have a busy system, people are just like, that thing just like, like logging all that information is tough.

That’s just like, that’s some serious observer overhead. You’re collecting query plans. You’re collecting all sorts of metrics and you’re just dumping it into tables. And it’s like, you think that’s free?

Uh, uh, busy system, man. Query store will mess you up, which sucks because it’s like in, in, in theory, it is such a cool idea to have that, like a persisted plan cash, right?

Where like, you can just get like endless reams of information from, that’s like such a cool idea, but then you got to realize anything you do that, that, that is collects that much, like especially that much excess, ML and all the text from your queries, all that hurts.

So I totally understand why people don’t have it turned on, but man, like when they don’t and I see it, I’m like, Oh, I wish I had you. But then I’m like, Oh, I feel bad for people to turn you on. And then their server, that CPU is like smoking and like making grinding noises.

Sorry. Oh man. All right.

Someone say something. Someone say something funny. Tell me, tell me a joke. I could use a good laugh. I wonder if anyone sent me a good email. I got a suggestion that I should take like email and Twitter questions prior to doing this.

Uh, and I’m fine with that because sometimes, you know, it’s, it’s not easy to fill, uh, like a half hour or so void.

And so I, if you want to say, if you like, if anyone’s watching this later and you want to send in like an email question, you can go to your Twitter question.

You can hit me up on, on the Twitter. You can welcome me to like 2005. I’m only getting on there. Or, uh, you can shoot me an email via my website contacting.

If you have a question that you would like answered here, but you just can’t physically show up because you have a, like, I don’t know.

You have work things or time zone things. I think Julie has a joke for me. Thank you, Julie. Why don’t you see elephants hiding in trees? I don’t know. Why don’t you see elephants hiding in trees? This better be good.

Because they are really good at hiding. Damn. That is funny. I didn’t see that coming. I thought there was going to be a trunk joke in there. That was very good though.

Oh, I appreciate that. The longer, the longer I think about it, the more I like it.

That’s very good. Now, now, now I don’t fit. Now I don’t regret sending you stickers, Julie. I’m glad I sent those over to you. And you’ve, you, you’ve made the famous Josh Darnell laugh.

Josh Darnell of, uh, of, of backups crashing SQL Server fame. You’ve made him laugh. So, I don’t know.

Maybe, maybe you’ll be famous too. Now. Maybe, maybe, maybe you can take that on the road. Yeah. You should just go home for the day. Go enjoy. Go enjoy. Go put stickers on stuff. Where did those stickers end up?

Now I’m curious. Hopefully not in the trash. Hopefully he didn’t seem like, oh, he’s ugly. How do we get a sticker?

Uh, you can send me an email. Well, you can contact me in some way that is, is private where you don’t mind sending your address and I will stick some stuff in the mail there. And I will.

So, I, I, I get, I get piles of these. Well, I got, I have, I have, I have a good pile of these things. I have, I have this many. So I can send, I can send out a few before bits.

You know, who knows? I mean, maybe I’ll go out of business, right? Just kidding. Just kidding. All those support contracts are good. Written in stone. Yeah.

Well, we send me a, shoot me an email or a Twitter DM or something. I don’t know. Figure it out. Notice Josh didn’t ask for a sticker. He’s too famous.

What is that poster over my shoulder with the creepy guy? That, that poster is one of the most beloved people in my life. My friend Rue.

And it’s a list of things that Rue is good at. And it’s a list. It was a collaborative list where me and other people who have equal, equal amounts of adoration for this strange man, put together a list of, of comical things that he is very good at.

And I, I have proudly had that in every single office that every, every single home office that I’ve had. So I guess that’s like two, but, but it’s not going away.

That’s my jam. I, I will, I, I, I, I will never show you the, I would never do a closeup of the list.

I’m not going to zoom in on the list, but that’s what it is. Uh, he’s, he’s an odd bird. He’s great though. Uh, would you like me to send you?

Yeah. Do you have stickers? Do you have stickers? If you have stickers, I’ll take stickers right now. The only sticker I have on my laptop is mine. And peel that other one off. Not giving any free promotion anymore.

Yeah. Take your, you know, you, you and, you and Farrah should autograph it.

Then I’ll just hold this. I’ll just hold that over Joe’s head. Make fun of, make fun of Joe Obish for not having as much street credit as me. Raven DB stickers.

Yeah. I know you like Raven DB. They tell you why you don’t need, why indexes don’t get used. Everyone else, SQL Server doesn’t tell you that. SQL Server hides that. How’s that issue going anyway?

Did I mean, did you, do you have like, do you have more votes on that? Is there a way you would detect a server spending too much time compiling queries? Uh, so that would go to two things.

One is resource semaphore query compile as a weight. Uh, if you’re running into that, then you do not have enough memory to adequately compile your queries at once. And the other would be sort of an unfortunate, like a, like a really unfortunate plan cash query.

Uh, so if you look through SP blitz cash, um, there are parts where I pull out the compile time from cash plans. And I, I remember warning on that.

That’s an, it’s an, so a query store has it as just a column value pulled out for you. So if you have query store turned on, you can look in query store. I forget, I forget which view it’s in.

Cause I, I wrote, I wrote the queries once for a reason. So I wouldn’t have to remember, remember all this stuff, but one of the, one of the views in for query store has a compile time pulled out for you. If you just want to look at the plan cash itself, uh, you could shred the compile time thing out of the XML and, I mean, but that would be awful though.

Cause you, that like, like there’s no way to like figure out which ones were bad from the, from like the beginning. But yeah, uh, I think that’s where I would start.

I, so like when I, when I think it’s fun too, cause when I think about that as a problem, I w I’m starting to wonder is like, is it a plan caching issue where like you, like you’re not reusing plans and like you’re, you’re spending a lot of time compiling new plant, like OLTP style comp, like piling new plans as they come in, or like you have gigantic queries coming in and SQL service.

It’s like, whoa, whoa, whoa, whoa, whoa, we’re going to, we’re going to read this one close. So you’re going to print this one out and go, go take a bathroom break.

Big pile of votes. No response. Let’s see. Uh, did I click on that link? No, I just let people see it. Let me go in here. Yeah.

119 votes, man. That’s rough. You know what? I’m going to, I’m going to make it one 20. Don’t tell, don’t tell anyone I double voted. Now, now I have, I have a new voting. I have a new account for, for filing issues.

So I get to double vote on that. Don’t tell 120 votes. Wow. Yeah, that would be cool. Come on, Microsoft. Oh, who am I kidding? No one’s watching this thing anyway.

All right. Uh, I’ve been standing here for a half hour and I need to go do something else for a minute.

Uh, thank you for coming and asking questions and I will see you next week. Actually, I don’t know. I’m trying to figure it. Cause I’m going to be in Manchester for business next week. So I got to figure out how I’m going to do that. Uh, I don’t know if I’m going to try to do it like at 12 Eastern or if I’m going to try to do it at like bits, bits noon.

I haven’t figured it out. I’ll figure it out and I’ll let you know. I will, I will have an update on that. All right. I’ll, I’ll, I’ll catch y’all later. I have to hit this button here. Thanks for coming. Thanks for asking questions.

Yeah. You would make streaming difficult forest.

Going Further


If this is the kind of SQL Server stuff you love learning about, you’ll love my training. Blog readers get 25% off the Everything Bundle — over 100 hours of performance tuning content. Need hands-on help? I offer consulting engagements from targeted investigations to ongoing retainers. Want a quick sanity check before committing to a full engagement? Schedule a call — no commitment required.

Join Me For Free SQL Server Q&A Every Friday At Noon!

Q&A4U


Every Friday at Noon EST, I answer your SQL Server questions live on YouTube.

I understand, not everyone can make it, or YouTube might be blocked at work.

If it is, you can ask via email, but keep in mind I’m going to answer during the webcast, not with a personal response.

If you like Twitter better, drop me a line there.

See you there!

Going Further


If this is the kind of SQL Server stuff you love learning about, you’ll love my training. Blog readers get 25% off the Everything Bundle — over 100 hours of performance tuning content. Need hands-on help? I offer consulting engagements from targeted investigations to ongoing retainers. Want a quick sanity check before committing to a full engagement? Schedule a call — no commitment required.

Last Week’s Almost Definitely Not Office Hours: February 8

ICYMI


Last week’s thrilling, stunning, flawless episode of whatever-you-wanna-call-it.

Thanks for watching!

Video Summary

In this video, I delve into a lively discussion about various database management topics, diving deep into execution plans and offering insights on how to interpret them effectively. Starting off, I share my experience as a DBA and highlight the importance of questioning every aspect of an execution plan—seeking out seeks or scans, understanding join types, and analyzing aggregation methods. The conversation then shifts to more specific scenarios, such as managing log files in data marts and the practicalities of moving from Azure SQL Database to managed instances. I also address the cost-effectiveness of cloud solutions versus on-premises databases, emphasizing that while performance can be challenging to control in the cloud, it’s crucial to weigh the costs against potential benefits. Throughout the session, I encourage viewers to explore resources like Grant Fritchie’s books and my own for a deeper understanding of execution plans and best practices in database management.

Full Transcript

I’m alive and fully mustached. Full, full on mustache. No one is here to admire my mustache. How very sad. Do-do-do. Do-do-do. Do-do-do. One, two. Oh yeah, people are coming in, hanging out. This is wonderful. Wonderful. Makes me feel so not alone. This time, I’m going to have the chat window open so that I don’t have to look at my phone like a scrub.

Welcome Lee, finally made it to one. Is that Luli or Leli? How do you say your name? You’re going to have to give me instructions so I don’t mess it up. Penel is here. Watch out. I might get some weird questions today if Penel is here.

Lou. All right. Lou it is. Yeah. So, for those who don’t know about my antics coming up at BITS, I’m, for charity, not just like to quell some strange desire with me, for charity, I am dressing up like Freddie Mercury to do my index session. And I have this lovely studded belt. All right. So, I got that. I got my macho man armband. All right. This. All right. Got this going on. I have a pair of straight up dad jeans. Check these out straight up. Now you all know what size jeans I wear, which is maybe embarrassing too, but straight up dad jeans that I’m wearing that I got. And of course, I have the white tank top ready to go. So, I have the whole thing. I even have the sneakers, but I didn’t want to look like a noob. Cause I know that like, uh, Manchester is the home of lots of people who wear and take Adidas sneakers very seriously. So, um, I’ve been, I’ve been wearing my, my white Adidas Sambas, breaking, breaking them in a little bit. I don’t want, I don’t want to look get fresh white Adidas Sambas stepping off into Manchester. I might get beat up. Might be some, some soccer fans there who, uh, who just tear me a new one. So I’m getting that going. The mustache is happening. All right. Going to have that full Freddie mustache. I’m not going to have the armpit hair. I can’t do that, but everything else is good to go. Lee, I’m looking forward to seeing you at SQL bits in Manchester. That’s going to be fun. I’ve, uh, I think I have all my material pretty well wrapped up for that. So I’m excited to excited to deliver it. Finally. I also have stickers live. I mean, not really live there. I think they’re, I think they’re dead stickers. So I’ll have stickers for everyone going to bits too. So everyone will, everyone will get something.

Except I don’t know, maybe, maybe not everyone. Maybe some people won’t. I don’t know how that works. So, uh, I don’t know. Does anyone have like questions about SQL Server? What it’s like to have a mustache? Like, I don’t know.

I’ve had, I’ve had sort of a funny day, actually sort of a funny couple of days. Um, I’ve been, uh, let’s see. Julie says, if someone can’t make the SQL bits, how can we get a sticker? Uh, well, Julie, I think, I think since I recognize your name enough, if you want to either, uh, email me your address or, uh, or, or DM me your address on, on Twitter, I will, I will send you a sticker. Dan, if you want one too, let me know. Since you, since you also recommended sticker mule to me and they are awesome stickers. I, I, my, my, my original order was from the company called sticker you. And they sent me the worst stickers that I’ve ever, I’ve ever seen in my life. Like, like, like the logo is illegible and like, like faded looking. And like, I ordered like, like gray, like, like solid gray, but it came back like, I don’t know, like spotted. It looked like TV noise. It was awful. So yeah. Yeah. I might even send you more than once. And some, since some people like to put them on their phones and laptops and foreheads and get tattoos with them. So it’s all sorts of stuff that you can do with that. Uh, now, now I’m, uh, putting the, the final touches on, yeah, you’ll be, but now we’ll get it at SQL bits, but I’ll take the whole stack of them.

And I’ll be, I’ll finally be famous in India. Uh, but yeah, I’ve been, uh, uh, wrap the final touches on, uh, my, my demos for the indexing session. And that’s going to be fun. Um, that’s, uh, that’s gonna, it’s gonna be, it’s gonna be interesting. And, uh, let’s see. Oh, we finally have a SQL question. Lee says, how do you replicate a poorly performing query? I see many badly running queries, but replicating these on a dev environment can be difficult due to not knowing what values are being used for parameters. So, um, you can get from the plan cache.

And this is something that I wrote into SP blitz cache. If you want to use it, uh, you can, from the plan cache, you can get the parameters that code was initially compiled with, but you can’t see what it was last run with, which is, um, uh, sort of downside of dealing with the plan cache. I want to say that Grant Fritchie recently wrote a blog post about how to get that from extended events, but I would have to track it down and find it for you. Um, but that’s, so if you, if you want to just get in that, and that’s a great way to start troubleshooting parameters, nothing, right?

Because, uh, especially if, if, you know, someone is coming to you and saying, hey, when this query, this query is slow, when I run it, then they can perhaps give you the values that it was compiled with that, that was slow for them. And you can compare that to what it, or rather what they ran it with and you compile, uh, compare that to what it’s compiled within the plan cache.

Let’s see. Uh, I have a question. How often does Microsoft release patches for SQL Server 2017? Um, so I don’t know, cause I don’t work for Microsoft. Uh, if anyone from Microsoft is watching and listening and you want to give me a cool job working on SQL Server, I, I won’t complain, but, uh, I, I don’t know. Usually it’s supposed to be every month for the first year and then quarterly every, or every three months or quarterly after the first year, whether that happens and they stick to it, I don’t know. Um, there, uh, there have been some, some downfalls in, in, in the agility that Microsoft has tried to discover in the, in the CU release process.

Yeah. CU 13 now is to do the math. Ah, yeah. Good, good luck on that. You know, uh, they, they, they say they have a new servicing model. So let’s, let’s see if they stick to it. Right. I guess technically, well, no. Yeah. Yeah. You’re right there. I’m sorry. They, they messed up.

Yeah. Uh, it might, it’s funny. These t-shirts always look so much cleaner, like when I’m looking at them and then I get on camera and I just look like a mess. Let’s see. Rowdy has helpfully posted a link. Uh, let’s see. Lisa says, I know you briefly talked about Azure managed instances, but what are your experiences with them? We were seeing some real gutches at work while using them. Um, my experience with them was when, uh, was we got a preview version, uh, to play around with when I was with Brent and, um, I didn’t do a lot. I didn’t like really kick the tires on it. Um, because we didn’t have it up for very long because those things still cost money.

I think it was costing like 1500 bucks a month to keep it up. So we didn’t keep it up very long. Uh, we just, you know, did enough to like, kind of like get some initial stuff back on it. Um, and, uh, you know, yeah, they are expensive. Uh, but I, you know, I actually, over on Twitter the other day, uh, I talked to the, well, I didn’t talk to, I tweeted at and got a tweet response from the PM, uh, guy named Jovan. And he said that they’re working on something for developers that will be less expensive so that you can kind of kick the tires and blog about them and stuff. So that’ll be nice to see when it comes out, but there’s nothing public on that yet. Uh, as far as, uh, tell me, but I would love to hear about the, um, uh, the things that you ran into with managed instances, because, uh, it would be nice to have sort of like, uh, you know, like I have a real world use case and this didn’t work out for me sort of stuff to talk about because, um, right now I got nothing.

Even like, even if I, even if I got like a dev thing to mess with, I would like put stack overflow on it and be like, works for me. Not run into stuff that like, you know, people in the real world might have to do. They are crazy expensive though, but I think, you know, that’s, it’s totally worth it.

Um, you know, uh, as far as being a good mix of on-prem and managed database instances, I think, I think Microsoft hit a good, uh, a good mix of, you know, uh, out of the, uh, on-prem features with the, um, the managed side of the, of the server. See, Darren says, I would too, because I’d like to move from Azure SQL days. Yeah. I think you and everyone else who is on Azure SQL DB wants to manage, wants to move to a managed instance because they, I think, I think comparatively, they are, they are just fresh to death. Let’s see. Uh, Rowdy says a buddy familiar with AWS RDS SQL said that the community really loves it. Have you had any experience with their managed MS SQL?

Uh, what do you mean? Familiar with managed instances? Uh, let’s see. Lisa says we looked at SQL DBs, but the performance just wasn’t there. Yeah. Uh, so, I mean, there are aspects of the cloud where performance is just really tough to lock down, like, you know, uh, storage, networking that, that stuff gets crazy expensive. Like it’s, it’s tough to, you know, and it, and it’s, and it’s hard to like, you know, say, oh, well, the cost here is totally worth it because, you know, um, often it’s not often.

It’s just like, I’m getting soaked on this. Rowdy has more links. Rowdy is amazing. I hope Rowdy is always, always unemployed. So you can always show up and put links in chat for me. Just kidding, Rowdy. I, uh, I have passed your information along to people. Uh, let’s see. Uh, SQL Dev DBA says, uh, we have a 25 gig database, a data mart that has a 39 gig log file in the full recovery model. We take log backs every five minutes. Any thoughts?

I’m not really sure why you’d want to have a data mart in full recovery model. I’m not sure that that sounds like, um, a good, good mix for me. Like, like, like I, like I wouldn’t expect to see like a data warehouse in full recovery model. Um, any advice? Jeez. Uh, so, you know, is it how big, like, I guess, you know, it’s, you gotta have some historical questions about that, right? Like, was it always that big? Was there like a one-time transaction that made it that big? Um, you know, this is like a lot of, a lot of stuff comes to mind when I’m trying to figure out like, well, you know, like, is it worth it to shrink down the log file or am I just going to suck it up because 39 gigs of space just isn’t all that much these days? Like, I can’t imagine sweating 40 gigs unless I only had 20 gigs left, I guess. Let’s see. Uh, Lee says, when you first started as a DBA, what did you find the most useful aspect of executions plan to learn first? Seriously, need to get better at reading them, but it’s entries of it. Um, well, you know, for me, the hardest part was always figuring out like, is this a good execution plan? And, um, you know, I think the best way to start is, uh, like the way that you read the plan right to left and just ask questions to yourself about everything that happens. Uh, ask, like, we start with like, how did we access the index? Was it a seek or a scan? Why was that so? Um, do I not have an index that I could seek into, do, uh, do I have an index that I could seek into, but I didn’t for some reason?

Um, I’m doing this type of join. Why am I doing this type of join? I’m doing this type of aggregation. Why am I doing this type of aggregation? Uh, I think, you know, the best way to learn is truly by questioning plans that you see and like learning about the different operators and why they pop up.

And like over, you know, over the years, it’s funny because the stuff that you care about really does start flowing from right to left. So like, you know, you go from caring about, oh, did I seek or did I scan to, oh, what kind of join did I do to, uh, oh, I did a key look up to like, you know, well, something else downstream. And then you start caring about like the weirder operators are like, what are these spools? Like, what’s going on? Like, why are you spooling data out there? What are you doing to me? And then like, you know, you learn, you learn about, you know, the differences between cash plans and actual plans where like an actual plans, you see all this new information, especially nowadays, Microsoft is filing cool information, uh, actual plans. Um, let’s see, but you know, uh, if you want some reading material on it, uh, Grant Fritchie keeps putting out these books about execution plans that have tons of good information in them. And, you know, even if you only like, even if you don’t read them front to back, even if you just say, all right, look, I need, I want this reference material when I come up to this, when I come across something weird in a query plan, I’m going to go look at the book. It’s totally worth it to have on your shelf for that. Uh, Grant puts a lot of work with them. Grant’s a super knowledgeable guy. I would, uh, I think having, having his book on your shelf, if you’re trying to learn about execution plans is probably a really, really good idea.

Uh, let’s see, uh, SQL dev DBA follows up with log DB will typically be at least some size above the largest table to accommodate reboot. Yeah, it will. So it’s going to be, I mean, I would say at least the size of that object plus 50% ish, but you know, again, 39 gig log files, and isn’t really going to be like my biggest concern. Um, yeah, I mean, unless, unless you find yourself frequently having to restore those, but even, I think even then with instant file initialization turned on the data file will go quick and spacing out the log file will be kind of painful, but, uh, most people aren’t restoring data marts. Most people are just kind of rebuilding them. Let’s see. Uh, let’s see. Mike Whitty says, yep, that’s been our experience. Lee, cool, rowdy.

We do hourly imports from an Oracle database. Uh, once you have the data imported, I mean, uh, it’s a good question. Uh, yeah. So if you’re just dumping data into the database, it might not be, uh, as big a deal as if you’re, you know, doing some aggregations or moving stuff around or, you know, doing some kind of, uh, flat or what do they call it? Like presentation type logic, uh, to the data once it comes in. Good question. Trying to think of some other stuff. Um, Ben Navarez had a good, had a pretty good book, uh, about SQL Server 2014. That’s a, I mean, it’s not like dated, but it’s, you know, it’s not, it’s not as up to date as Grant’s book is now. And of course you could always buy my book from, it’s like, I think it’s free for Kindle users. So if you want to, if you want to just read the Kindle version of my book, you can. There’s, there’s a few things about execution.

And also if you’re, if you’re coming to my, my, my pre-con in, in, in, in jolly old Manchester, there’ll be lots of stuff about execution plans in there. Lots of deep probing, long fingers going into query plans and saying, what’s wrong with you? Why are you doing that to me? Uh, SQL WDB says we’re not manipulating it. We have views that use the data and we massage them with the views in order for power BI to access them. Might have to consider putting the data mark to recover. Yeah, I would. I mean, so putting it, so just to, you know, kind of set some expectations here, putting it into simple recovery model, isn’t going to fix the size of the log file. It might give you a better idea of, um, you know, how big the log file should be, but, uh, it’s not going to like magically shrink the log file for you. What I would do.

So here’s what I would do. Uh, I would, uh, set up a query to, to run and look at free space in the log file and have it run like every, you know, have it, have it run like every minute because you’re taking log backups every five minutes. Uh, I would have it run every minute and just kind of look at how log space is actually used. And it might be that, you know, you, you could shrink your log file down once to like, you know, maybe half the size and just leave it for a while and see if, see if it grows again. Let’s see. Oh, Julie posted a link and I have to okay it.

It’s funny. Like Amazon makes me okay. Uh, Amazon. Jeez. This is an Amazon link, but, um, YouTube makes me okay. Every length that comes in. Uh, let’s see. Lou says, uh, have you tried? Oh, the Azure DevOps studio. No, I haven’t. Uh, and I know I’m probably a bad DBA for not that, but, uh, I’ve been really head down, uh, lately trying to, uh, you know, get the consulting thing rolling and, uh, trying to get, uh, all of my various presentations and whatnot lined up for, uh, for a future use. So I’ve been really trying to kind of have not had a lot of time to experiment with new, new bells and whistles, but I probably should. It’s, it looks neat. I think the main drawback for me of, um, of, uh, Azure DevOps studio, or as they call it on, on Twitter, ADS is that, uh, it does not do well with execution plans right now. And that’s kind of like my bread and butter. So like whenever I want to like do something like in management studio, there’s like a 90 ish percent chance that there’s an execution plan involved. So I don’t know. I don’t know if like, I’m gonna, I don’t know if I’m to hop on that, hop on that yet. Cause I need, I need my execution plans or else, you know, I have no blog posts, but I don’t have execution.

It’s funny how that works. I should probably, probably learn how to blog about other things, right? Put some pancake. I have like, I have like pretty good recipes from getting laid off. And like, no, no, like I, I, I make, make pancakes and French toast and all sorts of other stuff for my kid in the morning. So it’s fun. It’s funny to have like that kind of time on my hands. I’m just like, what, what shape would you like it in today? A unicorn head. Of course, let’s do that. Like paint brushes and little spatulas and like details. It’s fun. I don’t know. Maybe SQL Server isn’t my calling. Maybe, maybe custom pancakes are my calling. Am I on Instagram? No, I’m not on Instagram.

Uh, I, I am baby stepping into social media. Uh, I do not, I do not do terribly well with it. So, uh, um, I’m, I got on Twitter because that seemed like the easiest to manage. And, uh, I could just say things instead of always having to have a picture to go with them. But, uh, maybe, maybe Instagram is next. Maybe I should at least like parking spot my company name.

Now someone’s probably gonna like hold it ransom from me. You don’t have to pay a million dollars to get Erik Darling data on, uh, on Instagram. Right. It says I do vlogs from your neighborhood. Uh, so I was thinking about like, I, like at first I was like, oh, I’ll do them from the gym.

But then like, no one wants to watch that happen. No one wants to like watch me deadlift and yell at things. There’s just no, no audience for that. This is, there’s like a million people who do the exact same thing. Plus I don’t leave the house except to go to the gym. I like walk there and back. And then that’s it. My favorite restaurant closed, or I would say our favorite restaurant, like, uh, like the family’s favorite restaurant closed. Uh, after the first of the year, the, the chef got a new opportunity to do like some cool thing and they closed. And that was kind of a blessing in disguise because it saved us a ton of money, a ton of money to eat there like twice a week.

It’s ridiculous. Let’s see here. Any other questions? I mean, I wish I was on Instagram. I don’t know. I guess the question for you is, are you, are you on Twitter? Are you, are you, are we friends on Twitter? Are we tweet twins? Fweets? What do we call it? I don’t know.

Let’s see. Uh, oh boy. Yeah. All sorts of things. All sorts of things. All right. Let’s see. Uh, talk to us about trivial plans, the good, the bad, and the ugly. So trivial plans are a wonderful sort of optimization where, um, SQL Server will say, I have such an obvious way of doing this one thing that I am not going to think about. Like if I thought about, if I thought for like, like as many CPU cycles as you asked me to, to come up with a better execution plan for this query, I likely wouldn’t. The thing is that sometimes it’s wrong and sometimes trivial plans lie, uh, because trivial plans are tied into this thing called simple parameterization and simple and parameterization in general can, can cause issues with either parameter sniffing, not using filtered indexes, stuff like that. And so, uh, when you get trivial plans, often you will get a simple parameterization alongside it. It’s not guaranteed, but it’s, it’s in there. And, uh, you know, there are some downsides where, you know, sometimes there is a better plan waiting behind that trivial plan fence that, you’re just not finding, uh, trivial plans won’t ask for missing indexes. Trivial plans will never go parallel. You know, there’s just stuff that you don’t get from a trivial plan that you get from full optimization. Not that every query in the world needs full optimization. And it’s really tough to find like when a trivial plan does better with full optimization. So it’s just something that I keep an eye out for. Like if I see that a plan gets trivial optimization, I might throw a one equals select one on there, get a, get full optimization and just see if anything changes. If not, I go about my business tuning the plan at hand. Julie says, is there any way to limit how often a SQL agent job sends a failure notification? Uh, not that I recall. Um, I don’t know if there’s a way to, to sort of like spoof that and like, like damp that down a little bit. Uh, I know that most monitoring products offer a way to sort of, uh, uh, uh, what do you call it? Uh, well, Rowdy posted a link.

Yep. And the link I added. Okay, cool. Uh, oh, look there. Look at that. How can I live with the number of emails sent by SQL Server agent? I’m going to upvote that. Sweet. I’m going to upvote that answer too. That’s a good answer. Thanks Rowdy. Uh, let’s see. Lee says, we have seen cases of parameter sniffing at work. The easy fix has been to add that option recompile. Why is that a bad fix?

Overhead seems minimal compared to the bad plan. If the overhead is truly minimal, then I wouldn’t call it a bad fix. Um, usually when, uh, when I’m dealing with parameter sniffing, I ask myself a few different questions. It’s either, uh, like what’s the difference between the good plan and the bad plan?

Like, so it, with the, with the small plan, am I getting like some little like serial key lookup, like low memory plan. And when a big plan comes through or when a big value comes through, is that just overwhelming it? And then like, what plan do I get for the big plan? Like this, look at what the differences are because sometimes there are ways to, you know, sometimes it’s like, oh, if we have a slightly better index or a slightly different index, we can avoid having to, we can avoid parameter sniffing altogether. Other times it’s like, well, maybe if I just hint to like, say optimize for this value, which is a bigger value, it makes more sense. Um, option recompile.

I just, I dislike it. Not, not necessarily because of like the overhead, because most of the time SQL Server coming up with a query plan is fairly easy. The reason that I dislike option recompile is that we don’t have any, we don’t have sort of any good historical information in the plan cache about, uh, what that query is up to over time. And if there’s ever a problem with the plan that we get with option recompile, we don’t, we don’t have a good way to like sort of track that and figure it out. So it’s not that I’m against option recompile all the time. I just, you know, if you’re going to use it, you need to know like it, you don’t have that kind of good forensic information in the plan cache anymore. Um, you know, so take, take the good plan, take the bad plan, or take the, the plan that’s bad for some value and just try to look at the differences. Uh, you know, this is, this is a good time to, uh, I guess if, if you have, if when you get grants book, try to like, like look at the operators that you’re getting and try to figure out situationally why SQL Server may have chosen those operators for one plan and not for another. So that’s a, it’s a good bit of homework to do is figure out why the optimizer thought, well, like figure out like, like look at like, you know, uh, the plan that it comes up with for the small values and be like, okay, cool. We have that.

And then run it with the big value and say, okay, now it takes us long. Then recompile it and look at it for the, look at the big plan and say, okay, we got a totally different thing. And then it’s just helpful to compare and go back and forth and look at, you know, what, what one does and why SQL Server was like, oh yeah, we, we had to do this differently because we were dealing with a way different set of data. Right. Any more questions, any other things that we can talk about, do yell at each other about yes, no, maybe I don’t know. Rowdy, you might, you might, you might have to, you might have to come up with one for me.

Putting Rowdy on the spot. Mike Walsh is being funny. Mike Walsh does not like my mustache. Oh, you posted on my Twitter. Let’s look at my Twitter then. Let’s see what happened over there. Oh, that’s you. Okay. I didn’t, that’s why I didn’t recognize you because you, you are a picture of a dog over there and you are, I think not a picture of a dog over here. Yes. Not a picture of a dog over here. So yeah, Mike, I know it’s not very punk rock. The goal is not to be punk rock. The goal is to be late stage glam rock. And that’s, that’s my, that’s my goal to be like, like we, we were glam and now we’re getting out of glam and we just kind of have some weird side effects happening.

Let’s see. Uh, Roddy says 3d printed pancakes are just as good as homemade. I’ve never had a 3d printed pancake someday. I want to live in that. I want to live in that future world where 3d printed pancakes are a thing. That sounds awesome to me. I love, I would love to try 3d print, except steak. Steak is where I draw like biological matter is where I would draw the line on 3d printed.

Come to Dallas. Uh, I was supposed to go to Dallas to, uh, do a user group thing, but, um, I don’t know. I think they found someone cooler to do it. So I don’t know. Maybe I’ll do it again, but we’ll see. Who knows? Who knows what the future holds? Let’s see. Oh, a question.

What’s the best way to get more information. Nigel says, what’s the best way? Uh, okay. I’ll do this really quick. Uh, so, uh, Rowdy, no, it wasn’t going to be SQL Saturday in May. It was going to be, uh, like a training day type thing, but I think I want to say they got like Andy Leonard or something for it. I, I, I, I had a much or though, uh, let’s see. Nigel says, uh, what’s the best way to get information from deadlocks? We’re having some deadlock issues. And while we use monitoring tools, they don’t give us enough information. Uh, typical scenario is one update, one select.

The update is only updating one table. The other table is in the deadlock. The only clue is there is RL between the two, but the update does not involve the columns. Um, so, uh, if you use the first responder kit tools, there is a store procedure on there that I wrote called SP Blitzlock that gives you, that breaks down. I think, I think really well, the information that comes out of deadlocks. Um, if you run that, I think that often gives you, uh, better information than monitoring tools do. I think monitoring tools, uh, don’t, don’t go into the depth that they should of telling you, uh, what happened. Uh, so I would start there. Um, if it sounds like if you have a monitoring tool, they might even have a deadlock extended event session set up and you can point SP Blitzlock at the, uh, the deadlock extended event session. And you can get a ton of cool information out of that. Dan says, I think SP Blitzlock is great.

And yes, it is. And I wrote that drunk on a plane, so it has to be great. So they gave you maybe way better info than Redgate. Wow. Well, you know, Redgate has never asked my opinion on deadlocks. Maybe they should.

Let’s see. Dan says, uh, how do you go about determining or recommending the correct amount of RAM? I have a customer with one terabyte of data over multiple databases and 25 gigs of RAM in an OLTP environment. Holy smokes. Uh, wow. So if I, if I’m making a sort of just base out the box, you want to know how much RAM to have? I like to say 50% of your data.

Um, and that’s not because I think that 50% of your data is active. Usually it’s somewhere around like the 20 to 30%, but I want 50%. I want to, I want to, I want to, I want to have RAM equal to 50% of data because caching data isn’t the only thing that SQL Server does with memory.

Obviously query plans are going to ask for memory grants and some of them are going to be pretty big. And it’s going to, it’s going to memory that for memory grants is going to fight with memory for the, for, uh, the buffer pool and for the plan cache. And just to be safe and say, I have this much memory available to me, that’s what I’m going to go with. Uh, if you want more, like more, a more detailed breakdown of what you should have, um, I would say look at weight stats.

If you’re spending a lot of time waiting on memory ish weights. Uh, so, and by that, I mean, if you’re spending a lot of time waiting on disc because you’re, you’re the, your, your active data is not in memory when you need it to be. So you’re looking at like page IO asset page, IO latch sh and ex weights. Uh, that’s a pretty, that’s that especially sword does not responding well. Like you have long average milliseconds per weight on that. Then it’s a pretty good sign that, uh, you might want to have some more memory in there to alleviate, you know, time that you’re spending, spending waiting on disc, or if you’re hitting some of the poison weights around memory, like resource semaphore, resource semaphore query compile, that’s an even bigger argument to get some more memory in there. Cause well, that won’t solve the problem a hundred percent. Oftentimes you add more memory and you end up, uh, just giving, uh, memory grants, a bigger piece of a pie, bigger, bigger pie to ask for a bigger piece of, uh, it is, it can solve some lower level problems with a resource semaphore. So, uh, Darren says, yes, more memory doesn’t cost extra in licensing unless you need to break that magical boundary where you move to enterprise edition. And which case all of a sudden, all your core is magically cost $5,000 more licensing is so funny like that, right?

Like, like, like I’m like, I’m holding, like, let’s pretend that this تي 缶 What those & questions bearing You

Going Further


If this is the kind of SQL Server stuff you love learning about, you’ll love my training. Blog readers get 25% off the Everything Bundle — over 100 hours of performance tuning content. Need hands-on help? I offer consulting engagements from targeted investigations to ongoing retainers. Want a quick sanity check before committing to a full engagement? Schedule a call — no commitment required.

Last Week’s Almost Definitely Not Office Hours: February 1

ICYMI


Last week’s thrilling, stunning, flawless episode of whatever-you-wanna-call-it.

Thanks for watching!

Video Summary

In this video, I delve into various topics related to database management and development. Starting off, I address a common issue where an application’s performance is blamed on the SQL Server or network, only for it to turn out that the real culprit was poor app design. We explore how simple file transfers between data centers can reveal latency issues, emphasizing the importance of practical testing over just theoretical analysis. Moving on, I discuss resources and training for advanced T-SQL, recommending the latest book by Itzik Ben-Gan and Adam Mechanic as a solid reference guide. The conversation then shifts to Microsoft’s managed instances, highlighting the lack of freely available resources and the financial barrier that prevents many from experimenting with these services. Throughout the video, I share my thoughts on potential solutions, such as reaching out to Microsoft for a free instance or considering a podcast format, while also acknowledging the time constraints and challenges in pursuing new projects.

Full Transcript

Are we live? We are live. We are live and lonely. It’s a weird Friday to be doing this though. I get it with me. Do do do do do, do do do do. People where are people? People, people, people. What if you threw an office hours and no one showed up? There’s one person here.

All right, off to a good start. If we accumulate one person per minute, this will be real lively, I think. To show my seriousness for my charity event, I have officially instituted the mustache.

It’s growing in. So by the time bits rolls around, it should be about down to here. But I’ll probably have to groom that in some way.

So, welcome, four of you. It’s nice to see you all. Oh, boy.

Where’d that go? I’ve lost chat. Where did chat go? Oh, man. Someone’s going to have to, like, tweet the questions at me or something.

Because now I don’t know how to get chat back. We had chat. Chat, where are you?

Chat. Chat. Oh, someone left. Someone didn’t want to. Oh, someone came back. Someone came back.

Thank you for coming back. So I’m going to have to do something kind of weird, I think. I’m going to have to go on. I’m going to have to go on this from my phone, I think.

So I can look at the chat window again. Because I have no idea where it went. And there’s no button that says bring back the chat. So bear with me for a second here while I fumble with this nonsense. Doot-a-doo.

Doot-a-doo. Yeah, there we go. Doot-a-doo.

Hey. There’s a live thing. All right. I can see me. All right. Yes. Mike says, nice stash. Thank you, Mike. I can see chat on my phone now.

So we’ve reached this bizarre level of recursion that I don’t even know how to deal with. Woo-hoo! All right. Let’s see.

Let me make this a little bit more tolerable for all of you. I’m going to hold my phone here. James says, best SQL Server trainer. Hands down. Thanks. You should tell that to Brent because he’d love to hear that. That would be the first thing I’d want to do.

Let’s see. I had to leave create a channel so I could chat. Weird. Yes, that is weird. I don’t understand why YouTube would make you do that. Right now, YouTube won’t even let me try to get the chat window back up without ending.

My live stream. So YouTube has some damn work to do on this interface because this is ridiculous. My sweater in a cold region.

Yes, I am in a cold region. I am in the Northeast. But thankfully, I am indoors. And thankfully, see that pipe in the corner right there? That thing gets absolutely nuclear, blazing hot in a way that human words can’t describe.

So even if I tried to get cold in here, I would fail miserably because of that pipe. That pipe… I mean, you could barbecue it.

If you wrap meat around that pipe, it would cook. It would cook through. It’s insane. It’s… It’s… I used to live in an apartment in Astoria, Queens. And when I lived there, the whole building was steam heat.

And during the winter, my room would get ridiculously hot because I had a big steam pipe in it. I had the radiator turned off. There was no radiator.

The radiator was like, no, screw it. The one time I turned the radiator on, it was like boiling. And during the winter, what I could do is have my bedroom window open, put a six-pack of beer in the windowsill. The beer would be nice and cold.

And my room would be temperate. And I could just sit there pleasantly drinking beer with the window open. Like sub-zero, like snowstorm, cold, freezing. It didn’t matter.

All winter long. Let’s do a barbecue next Friday. Yes. All right. We’ll do a barbecue next Friday. That sounds good to me. I like barbecues. Especially when I don’t have to go anywhere for them. It’s the best kind of barbecue.

It’s a stay-home barbecue. The stay-b-queue. The stab-by-queue? I don’t know. It’s all weird. It’s all very weird.

Da-da-da. Da-da-da-da-da. I’m looking at stuff. And I’m not ignoring you.

I promise. I promise I’m not ignoring you. I either stare at myself on YouTube or I look at to see if anyone said anything dumb about me on Twitter. I just bounce back and forth between that.

But you nice people who decided to show up today, why are you here? I don’t know. You can want to ask questions, James. You can ask questions.

What else would you like to do? It’s like office hours except lonelier. Let’s see here.

Let’s see. We’ll start with Marcy’s question. What is the best way to triage network performance if you put your app in a data center? What about…

What about… So… Like, do you mean, like, apps communicating with the SQL Server? Like, are you alive? Or do you mean, like, applications pulling data back and forth across the network? Because it’s two kind of different things there.

In that, like… Okay. So if… When I think about networking in a data center, I think about two things. I think about the path that data has to take from the SAN, right?

From the disks across the channels to get to your SQL Server, to get rid into memory, and then to end up in the application. And then I think about, like, you know, the bobs and weevils that the data has to get across to then go to the application. So there’s two different sort of types of networking that are at play there.

And what you got to be clear about is, like, which one you think the problem is. Because a lot of the times when people think that they have a problem with network performance going from the SQL Server to the app, the problem is really, like, that the app server itself is either underpowered, overloaded. I mean, I’ve seen app servers in balanced power mode that reduced, like, app time by, like, 30 or 40%.

And that was a nightmare. So there’s a lot of different… There are a lot of different angles you could approach that from that I would be more… I would be curious to hear more about.

So Darren says, do you do any work with Azure managed instances or MDs? What’s an MDs? I don’t know.

I don’t know what an MD is. So that might tell you how much work I do with Azure. But I like them. I just don’t have a free one to play with. If you have one that you want me to do something to, I’d be happy to work with it. I have nothing against them.

I think they’re lovely things. I think that the managed instance thing in particular is going to do a lot for Azure adoption as it matures as a product. Just like I would be able to do a lot if I ever matured as a person.

But I refuse. Okay. Treehouse SQL, that is. So, Marcy, start with wait stats. If you’re waiting a lot on async network I.O., then it is time to figure out what those apps are doing.

The other part of that picture is how the apps ingest data. So I’m going to tell a pretty funny story about one time. I know I’ve told this in the past, but I was working at a real job.

And we had this in-house bug tracking software. And the developers for it, like, redid the whole user interface. And they added a bunch of, like, pretty things to it.

So that when you went to, like, log a ticket or look at ticket activity, you could feel like you were looking at, like, a work of art. There were, like, animations. And things would, like, slide across the screen.

But when they rolled it out, everyone said, the SQL Server got really slow. And I was like, okay. Let’s look at the SQL Server. And, of course, I’m looking at the SQL Server, and the SQL Server is bored out of its mind.

It’s, like, barely registering wait stats. I’m like, all right. So let’s capture one of the queries that the app is running. And let’s see how long it just takes to hit it in SSMS.

So we do, and it returns immediately. I’m like, all right. So let’s use one of the app servers that still sees the old UX and see if that’s slow. So we do it over there.

And, like, the bare bones HTML ugly as sin, like, clunky rectangle button, like, gray button website, blazing fast there, too. So we had them disable, like, the new, like, CSS crazy animation stuff on the new one. And when we did stuff there, it was blazing fast, too.

So it was actually the way that the app ingested data and the things that the application did to present that data out to people that made things look slow and that made it look like there was a SQL Server problem or a network problem. But it was really just crappy app design. That’s fun, right?

Fun stuff. Let’s see. App is in a new data center. SQL did not move. So app. Well, Atlanta to Vermont.

That’s a pretty good hike. What, I mean, like, what happens if you, let’s start easy and let’s say what happens if you copy a file between, from one data center to another? Like, let’s just say you, like, want to drag and drop a file.

Let’s see how fast that goes. That’s what I would want to know. I would want to, like, you know, you could ping stuff and trace route and all that other, wire shark and whatever else. But, you know, take, like, a one gig file and just see how long it takes to copy from one thing to another.

That’s always kind of a fun way to do things. Let’s see. Let’s see what they say.

Oh, manage data. Oh, manage database. I see now. So Azure SQL DB, you called MD, you tricky, tricky son of a gun. All right. James says, I am planning on going from DBA to SQL developer.

What is the best training I can get for advanced T-SQL? Boy. So when I think about advanced T-SQL, there’s, like, a real wall that you hit.

Right. So, like, you can’t, there’s, like, no more complicated syntax to do something at some point. Right.

You just, like, what, a row number of windowing function. Nothing, like, there’s not a lot that’s really changed with T-SQL lately. And a lot of the problems that have been solved with it that are hard are pretty well written about. So if you think about stuff like bin packing, traversing hierarchies, doing, like, the last non-null, any sort of, like, ordered set stuff, there’s very few people who do that, or rather who write about that and write about it well.

I mean, really, you’re looking at it’s been gone. So what I always say is, buy the most recent book. Oh, it’s down here somewhere.

Buy the most recent book on T-SQL, which right now is this. And it’s backwards. Oh, man. So it’s called T-SQL querying.

It’s by Itzik Ben-Gahn and my friend Adam Mechanic. And I think that if you just have this book as a reference, you can go, you can get through a lot. Because there’s just, you know, good, thorough explanations of, like, how to solve a lot of common problems that do require more advanced T-SQL.

But it’s not like, you know, when you’re writing these queries, you need, like, there’s a more advanced join you can write. All right? It’s like, a join is a join, pretty much.

Right? You just need to figure out, do I need inner, outer, left, right, up, down, cross, cross apply or something. After that, it’s, you know, the syntax doesn’t, like, get infinitely more complex as you do more things. So I would start with a nice book that just gives you reference material on how to do certain stuff.

And then as you approach different problems, maybe that’s when things get more complicated. Let’s see. What else have you got?

Nothing. No other questions, really? All right. I guess I can start drinking then. No, I have to go to the gym. Maybe I won’t bother.

Maybe I’ll just start drinking. Go to the gym tomorrow. I have so many choices. All right. Any other questions? Anything else? Let’s see. Ooh, let’s see. Darren, firing stuff up. Do you know of any resources for managed instances?

No. So it depends on what you want to learn. Where Microsoft has kind of sadly fallen short is that kind of develop is like kind of like learning resources on stuff.

They used to have these virtual labs where you could go in and for free spin up like, like spin up and set up like a failover cluster availability group, log shipping, mirroring, all sorts of cool bells and whistles. They’re doing away with that and replacing it with something. I’m not really sure what it is.

But, you know, what makes it tough for me to like, you know, get on a high horse and say, hey, I really want to talk about this Microsoft product. Is it if I want to do anything with a managed instance, it’s going to cost me like $1,500 a month because there’s no developer managed instance. There’s no like, hey, you know, you might blog about this and get people to adopt it.

Here’s a managed instance that you can kick around in our there’s like like a fifth of a man of a VM in our billion dollar data center here. Go have fun with it. It would cost me like real money to play with a managed instance and to be able to write more stuff about it.

So I think part of the reason why you might not see as much written about those topics as you want is that it like unless someone has a job where their job is paying for like that hardware and they get to like work with or rather work like paying for that service. And they get to work with that service day in and day out because that’s all their business pay the bills. Oh, you’re kind of out of luck.

So if you know anyone at Microsoft who wants to give me a managed instance to to play with and blog about the greatness and awesomeness of sure. Let’s you can you can give them my email. You can give them my YouTube channel.

I would love to have a chat with them here. Let’s see. Yeah, there’s no playground. You know, that’s something that a lot of people don’t think about when they’re moving their infrastructure to the cloud is like. Like, you know, if you have dev and QA and UAT.

Down, like locally, there’s no dev and QA and UAT up in the cloud that all costs the same money. Right. Like, even like even like even if you say you put developer edition on you’re still paying.

Excuse me for a big, big old honking cloud instance. So that’s a lot of fun to think about in that way. Have you thought about a podcast?

Yeah, except. You know. What what terrifies me about a podcast is that a it might be expensive.

Like, I don’t I don’t know what goes into making a podcast. I don’t know how to like. I just haven’t.

Yeah. And in my head, sure, I would like to do it. But then when I look at the amount of time I have in a day and the amount of stuff that I have to do to try to, you know, make make a dime here and there. I’m sort of like, well, I’d love to have a podcast.

But if unless there’s like a button I can push that makes a podcast for me, I don’t know if I’m going to do it just yet. So maybe in time, maybe maybe when I get some more free time, like after SQL bits. And I do my my pre con there and, you know, hopefully survive everything.

Get to it. But for now, I’m just going to I’m just going to do these. I’m also working under this like sort of like blanket of terror that I’ll show up and there will be no one here. Like, I’m very grateful for the 10 of you who chose to show up and ask me questions and talk to me about stuff.

But, man, if I if I ever if I’m ever here and it’s like like 10 past and there’s two people and no one’s asking a question and I’m staring at my screen uncomfortably making doot doots, then, you know, I don’t want to be like no podcast this week. No one showed up. Like, you know, because what’s challenging about the YouTube format is that there’s no like screen share.

So if like there were two people here who weren’t asking questions, I couldn’t switch it over to now I’m going to show you something. It was like I would have to I don’t know, do something totally different. I would have to use like a like a paid platform, like a go to webinar or something like that.

So lots of stuff that I would have to do differently, but not necessarily in a bad way. Just I’ll get a little bit more infrastructure in place and things will go from there. I think I think that’s a nice way of saying all the stuff that I just said, you know, a little bit more infrastructure in place and then then we’re good to go.

See here. Steve asks, I recently ran SP Blitzcache and a top offender has warnings. We couldn’t find a plan for this query.

The proc is a 2200 line nightmare. Any recommendations on next steps, diagnose, resource? So every time I see that, it’s either because the plan has a recompile or like the store procedure, the plan had a recompile hint on it or something.

And like see what’s ever logged some metrics about it, but didn’t keep the plan or the plan recompile for some other reason. And sometimes like if you, when you see that there should be a bunch of reasons listed in there, why there might not be a plan. So what I would do is just grab the query text or like the store procedure name from one of the other columns and see if you can get an estimated plan for it there.

You know, one of the kind of things that I always wish that I could have put into Blitzcache that I didn’t get a chance to was like just some like validation on if a query plan is there. Because, you know, well, it’s good to be able to say, hey, this is a crazy, you know, awful thing that is executing and doing stuff. If there’s no query plan for it, it kind of defeats the point of a Blitzcache.

So I always wanted to do something where like if like a certain amount of the values were null that came back or whatever, then like we would like, like it would change the value of top. So we would bring back some more plans to, you know, to analyze because if you bring, if like you say top people is 10 and five of the lines are we couldn’t find a plan for this query. And you’re looking at like maybe five query, maybe like five plans that, you know, you know, kind of like limited value.

Like they’re probably at the end too. It’s like kind of stinks. Yeah.

Yeah. See, there’s a lot of different reasons why plans might not be in the cache when we go look and they all kind of stink. Like what, so what I would say is if it’s a big 2200 lines for a procedure, like you’re saying most likely. So there’s a limit to the number of nodes that can exist in XML.

It’s like 128. And after 128, you have to run a special command to get the plan XML from another place and you can’t render it in any way. It’s useful.

It’s a lot of fun. So like you can’t like cast it to XML because it’s too big and it throws errors and you can’t do anything good with it. So there should have been a query in there that said, like gave you like a select star from like a query plan text DMV for the SQL handle that, or plan handle that, that didn’t bring back a plan in BlitzCache. And by the way, BlitzCache support now is 99 cents a minute.

So you owe me like three bucks. Damn. I underpriced myself.

I should have said 299 for the first minute. Could have tripled my money. Damn. Let’s see here. What is the best software source control for SQL Server? I mean, look, Redgate kind of runs away with everything right now.

You know, I don’t, I, I, I have issues with some of their products, but I think for stuff like that, Redgate runs away with it. Hands down. I wouldn’t, I wouldn’t do it.

I wouldn’t go with anything else right now. You know, I would, I would probably get it. I would probably use a different monitoring tool, but for source control and DevOps type stuff, I don’t think that I would trust anyone other than Redgate. At this point.

You know, and that’s, and like, and that’s, you know, just based on, you know, like surveying kind of who does stuff, how involved they are with the SQL Server community. You know, the number of people using them, the available training and kind of expertise on it. Like, this just like Redgate just, you know, just stole the ball from everyone else.

It was just kind of like standing there, holding it over their head. Like, so I just, you know, whatever, whatever you need to do, I would, I would go to them first. So far as I know, they are, if you run into something that, you know, if you have some scenario that one of their products just is not addressing, they are pretty, pretty, pretty responsive.

And, you know, getting that kind of stuff put together, especially if you have a lot of money. Or like, or if you have like a company name that like looks good for them to say, hey, we work with like awesome charity group, corp, or something. I don’t know.

Lots of fun stuff. All right. Do, do, do, do, do, do. I don’t need any of this stuff. All right.

Let’s get rid of some stuff on my phone that was blinking and making YouTube questions not show up properly. Next week, I promise it will be seamless because I won’t click the wrong button near the participants window to make everyone disappear. I apologize.

I like sort of accidentally raptured all of you and sent you to a phantom zone or something. But I’m able to join you from my phone. We have a link.

It’s coming to the light, I guess. All right. Do we have any other questions from the magnificent 10 of you who have shown up? Let’s see here.

Darren says, have you ever worked with in-memory OLTP much, exploring some solutions using it? No, and only because I never got a chance to. So it’s a really, it’s a really niche feature as far as what I think it’s a good fit for.

And all of the use cases that I’ve seen for it have been for incredibly high rate data ingestion applications where the data that you care about doesn’t hang around long. So think about like an online gambling type thing where you have a bunch of events and people want to bet on events and do stuff. But as soon as that event is over, like no one’s going to go back and care about it, right?

Like events over, done, payouts. So when you want to ingest all of that like really high value data that needs to happen immediately, in-memory OLTP can be great for that. And then as soon as an event is over, you kind of flush it out to on disk tables where, you know, people can still get to it, but it’s not going to be, you know, like blazing latch-free, lock-free stuff.

And the reason that it’s really good for that is because with the high rate of data ingestion stuff is that that’s where the lock-free thing is really cool because it’s all of those concurrent inserts and updates and stuff that really need to happen quickly. If your problem is like, well, we need this like data warehouse report to be faster, that’s not a good use case for in-memory OLTP. And if your problem is like we have 5,000 transactions a minute and they’re kind of slow, then you don’t need in-memory OLTP.

You need a much more basic level of like tuning and indexing query stuff because the in-memory OLTP stuff, it really shines, I would say, like the 20, 25, 30,000 transactions a second or a minute or some ungodly number where, you know, you just really need to bang stuff in quick and no one can wait. You need all that like, it was like grandma betting 50 cents on Greyhound. Let’s see here.

Who is your pick for the Super Bowl? What teams are in the Super Bowl? You’d have to tell me that first and then I’ll pick. I have no idea right now. I pay almost no attention to any sports.

Sorry. And I’m not anti-sport. I like watching sports in bars and I like watching sports.

I like watching sports highlights because I think anyone who can make millions of dollars doing that kind of stuff because they’re just that good at it is pretty fun to watch. But, yeah, I have two kids and a wife and the amount of sports watching that goes on in my house is limited to the first like week to month when the Mets don’t suck or when there’s like a lot of anticipation that the Mets might do well this year. And then the Mets tank and no one watches baseball anymore.

So that’s about where my cutoff is. Let’s see here. I’m starting to use more clustered columnstore indexes. Yes.

Anything we should be careful of or anything cool we might be missing. So I’m going to go against nearly everything that I’ve ever said about index maintenance when I talk about columnstore and that it is absolutely positively vital that you maintain your columnstore indexes. There’s all sorts of stuff with like gravestones and deltas and compression and dictionaries and like all sorts of things that if you don’t have your columnstore indexes maintained correctly, you can really boot performance on it.

Joe Obish. I keep telling him to blog about it, but he doesn’t. But maybe he finally will.

But at his talk at pass over last year, which might be out on video now, I’m not sure yet. But at his talk at pass last year, he went into a bit how if, you know, you load a bunch of data into your columnstore indexes, but it’s like loaded inefficiently or like data types are weird, then you can end up with like really, really bad query performance because you don’t get like good dictionary compression or like run length encoding and all the other stuff that goes into making query store. Really, really fast.

So like, like, you think about the number like what makes it what makes columnstore really powerful right now is batch mode. So you work on batches of rows at a time rather than like single row at a time like you do with rowstore indexes. And when you have like, misloaded, let’s call them misloaded columnstore indexes, you end up working on far fewer batches because far fewer of them can fit in like an instruction at a time.

But Joe Obish is the man to watch for that. I think, you know, Nico, I’m pretty sure he has some posts on it. If you want to dig through his, his, his like 150 post archive on columnstore, but that’s, that’s the first thing that I would think of.

Um, so aside from maintenance, uh, you know, being very, very mindful of data types and, um, you know, when you, when you see, when you, or when you’re working with columnstore, there are like certain op like plan operators that you just want to avoid. Like constantly like nested loops, merge joins, uh, sorts, um, uh, anything like when operators execute in row mode rather than batch mode for some, for whatever reason, it’s a lot of stuff that can go wonky with those queries. So what, but what I love columnstore and I love what they’ve been doing with it.

There’s still a lot of, you know, manual labor type stuff that you, you have to do when you’re, when your queries are on to make sure that you’re getting the best performance of it. Um, everything is better in bars. Yes.

Everything absolutely is better in bars. Except sleep. Sleeping in bars is not, not better. It’ll get you thrown out pretty quickly. All right.

Any other questions? Anyone else? Fire something fun at me. Let’s see. I don’t know. I, I, I was wondering if I was, uh, no, nothing on Twitter. Okay.

So sometimes I always think that someone might ask a question on Twitter if they can’t show up here on the YouTube channel. Uh, let’s see. Some deranged creep wants to know my age, sex and location. And I’m just going to call, I’m just going to call in the Chris Hansen patrol on you.

None of that. Uh, am I excited about bits? Yes, I do have the costume and I’m, I’m, I’m disappointed that you didn’t notice that the picture that I put on Twitter about the costume because it is fully loaded. It is here.

The only thing that I couldn’t get is, so what’s funny is when I was, when I was talking to Andy Mallon about, about like the, the costume that I was buying, he, he was all excited. He was just like, he, he thought he like, he had like a, like a, like a dead on thing in mind. I was like, look, I can do a lot of it.

And he was like, well, did, did you get a racer back tank top? And I was like, I don’t know what that is. I bought like regular tank tops, which I’m still going to look fat in, but I can’t like imagine it like, like a racer back tank top. And then like, I got all, I got all nervous and I was like, uh, Hey, uh, I’m going to go look on Amazon for a racer back tank top.

And I don’t think that a clothing company has made a racer back tank top for men since Freddie Mercury wore one. Um, and even at that juncture, he might have just worn one that was made for a woman because he was a, he was a pretty slender fella, but not me. And like, I, I tried to look at, uh, like, you know, women’s sizes that, that might, might fit a man of my stature.

And, um, then I guess got depressed. I didn’t want to get into that. Uh, bringing up, hoping I’d bring it up for a preview.

Uh, I’d have to go get it. I don’t have it in my office. It’s the one thing that I managed to talk my wife into not making me keep in the office because everything else that might vaguely belong to me is jammed into my office. It is crazy.

Do you have a pick of him? I can, oh, geez, Louise. Let’s see here. How can I do this? Uh, all right. Let’s see. Uh, where is, how do I get to a browser now? This is very challenging.

You guys are pushing the limits of my, my technical ability here. Freddie Mercury. Live aid.

Come on, baby. Come on. Don’t fail me now. There we go. Images. No, not videos. Images. Come on, phone.

Come on. There we go. All right. So this is a very close approximation of what I will look like at SQL bits. Uh, I can’t do justice to his armpit hair. And, um, I’m, I’m not going to be able to lose 120 pounds, but I have that outfit pretty well nailed.

Except for the racer back tank top. That’s just going to be a regular tank top. I don’t know if I can tuck mine in.

That might, that might get dangerous. I don’t know how that’s going to go. That might not be a great idea. Excuse me. Jeez Louise. It is dry in here. All right.

Let’s see. Get back into the old YouTube. Come on, baby. There we go. Yeah. Ah, practice the pose. Live stream, picture and picture.

Thank you. That is the one thing that I have managed to get right in my time on YouTube is live stream, picture and picture. Uh, when I tried to schedule these, starting this up was the most painful thing I’ve ever done. I had to pay 10 bucks for an encoder or a decoder called like Wirecast.

And every time I went to start it up, it would tell me that my camera didn’t work. And there would be like, like blue screen, like not like computer blue screens, but it would just show me like a blue screen preview. And it was terrible.

So like, but like when I just hit like the go live button, it’s dead simple. When I try to schedule these, it’s miserable. I’m going to have to do something really. Uh, let’s see.

Any other, any other fun questions? You creeps staring at my poor office. Let’s see.

Zach asks. No, no. That was the same person. Practice the pose. No. I mean, it’s just the arm up, right? This isn’t a good camera for that, for me to practice. It’ll be fun.

It’ll be fine. Let’s see. We have, we do have, we have a question or maybe we have a statement. I don’t know. We’ll figure it out in a minute. Sam says, uh, by tuning indexes on a secondary moving reporting to read only secondaries are really popular movement in my workplace.

I’m concerned about how to manage the disparate index needs. Yeah. Uh, I, I wrote a post about this recently that is scheduled.

I think for like two weeks from now. Blogging my butt off. Uh, but it’s, you know, it, it’s, it’s tough to like, depending on how you’re replicating the data, you know, you, you, you usually can’t have a different set of indexes on a secondary. From the, what you have on the primary.

And what makes things even more challenging. And I think this might be the third week in a row that I’ve said this is that, uh, the index DMVs on like readable secondaries don’t migrate their data back to the primary. So you have a really hard time figuring out like what indexes are good for anything.

It’s like looking around like, uh, okay, this one looks good here. This one looks good there. I don’t, you know, it all just goes to heck at some point. Uh, and it would be, it would be nice if there was like something that coagulated all that DMV data, but there is nothing at this point.

You would have, you would have, you are stuck doing that on your own, writing your own scripts to push data around. Yeah. But yeah.

Uh, so like, unless you use some form of like capital R replication, right? By that, I mean like not AGs or log shipping or mirroring where you can apply a script afterwards to make different indexes on a, on a, on a secondary available than what are just on the primary. Uh, yeah.

Kind of out of luck on that. And that’s, and that’s too bad because I know that with availability groups, at least on readable replicas, SQL Server is able to create like temporary statistics. So it would be nice if you could create temporary indexes too.

That would be fun. Aggregate, not quite. No, I like coagulate better. I think coagulate sounds better as a word. Aggregate.

Aggregate just sounds aggressive and angry. Not fun. Coagulate. It’s like, we’re going to go, we’re going to go have fun. We’re doing it together. Co-agulate. A bloody mess.

Why? Lots of things coagulate. Pancake batter. Uh, fat. I don’t know.

What else? What else coagulates? I’m trying to think of something that coagulates in a pleasant way now and I’m starting to see your point. Maybe coagulate isn’t good either. Maybe there’s no way, there’s no good way, no good way to say you bring things together. There’s no good single word for that.

They’re all just ugly. All right. Uh, anything else? Any other fun questions? Observations?

Hmm. Hmm. Hmm. All right, folks. Uh, thank you for joining me. Uh, I appreciate all of you showing up and asking stuff. I will be back next week at the same time doing the same thing.

And hopefully you’ll be able to make it then. I’ll see you next time. Thank you. And, uh, next time I will have the Freddie Mercury costume ready to show you. I think we’re getting, we’re getting close enough to bits now where I can, I can, I can do the reveal.

So I will see you next week. Not dressed up, but I’ll, I’ll have it. I’ll have it. I’ll tease you a little. Maybe I’ll wear some little shorts or something.

Bye.

Video Summary

In this video, I delve into various topics related to database management and development. Starting off, I address a common issue where an application’s performance is blamed on the SQL Server or network, only for it to turn out that the real culprit was poor app design. We explore how simple file transfers between data centers can reveal latency issues, emphasizing the importance of practical testing over just theoretical analysis. Moving on, I discuss resources and training for advanced T-SQL, recommending the latest book by Itzik Ben-Gan and Adam Mechanic as a solid reference guide. The conversation then shifts to Microsoft’s managed instances, highlighting the lack of freely available resources and the financial barrier that prevents many from experimenting with these services. Throughout the video, I share my thoughts on potential solutions, such as reaching out to Microsoft for a free instance or considering a podcast format, while also acknowledging the time constraints and challenges in pursuing new projects.

Full Transcript

Are we live? We are live. We are live and lonely. It’s a weird Friday to be doing this though. I get it with me. Do do do do do, do do do do. People where are people? People, people, people. What if you threw an office hours and no one showed up? There’s one person here.

All right, off to a good start. If we accumulate one person per minute, this will be real lively, I think. To show my seriousness for my charity event, I have officially instituted the mustache.

It’s growing in. So by the time bits rolls around, it should be about down to here. But I’ll probably have to groom that in some way.

So, welcome, four of you. It’s nice to see you all. Oh, boy.

Where’d that go? I’ve lost chat. Where did chat go? Oh, man. Someone’s going to have to, like, tweet the questions at me or something.

Because now I don’t know how to get chat back. We had chat. Chat, where are you?

Chat. Chat. Oh, someone left. Someone didn’t want to. Oh, someone came back. Someone came back.

Thank you for coming back. So I’m going to have to do something kind of weird, I think. I’m going to have to go on. I’m going to have to go on this from my phone, I think.

So I can look at the chat window again. Because I have no idea where it went. And there’s no button that says bring back the chat. So bear with me for a second here while I fumble with this nonsense. Doot-a-doo.

Doot-a-doo. Yeah, there we go. Doot-a-doo.

Hey. There’s a live thing. All right. I can see me. All right. Yes. Mike says, nice stash. Thank you, Mike. I can see chat on my phone now.

So we’ve reached this bizarre level of recursion that I don’t even know how to deal with. Woo-hoo! All right. Let’s see.

Let me make this a little bit more tolerable for all of you. I’m going to hold my phone here. James says, best SQL Server trainer. Hands down. Thanks. You should tell that to Brent because he’d love to hear that. That would be the first thing I’d want to do.

Let’s see. I had to leave create a channel so I could chat. Weird. Yes, that is weird. I don’t understand why YouTube would make you do that. Right now, YouTube won’t even let me try to get the chat window back up without ending.

My live stream. So YouTube has some damn work to do on this interface because this is ridiculous. My sweater in a cold region.

Yes, I am in a cold region. I am in the Northeast. But thankfully, I am indoors. And thankfully, see that pipe in the corner right there? That thing gets absolutely nuclear, blazing hot in a way that human words can’t describe.

So even if I tried to get cold in here, I would fail miserably because of that pipe. That pipe… I mean, you could barbecue it.

If you wrap meat around that pipe, it would cook. It would cook through. It’s insane. It’s… It’s… I used to live in an apartment in Astoria, Queens. And when I lived there, the whole building was steam heat.

And during the winter, my room would get ridiculously hot because I had a big steam pipe in it. I had the radiator turned off. There was no radiator.

The radiator was like, no, screw it. The one time I turned the radiator on, it was like boiling. And during the winter, what I could do is have my bedroom window open, put a six-pack of beer in the windowsill. The beer would be nice and cold.

And my room would be temperate. And I could just sit there pleasantly drinking beer with the window open. Like sub-zero, like snowstorm, cold, freezing. It didn’t matter.

All winter long. Let’s do a barbecue next Friday. Yes. All right. We’ll do a barbecue next Friday. That sounds good to me. I like barbecues. Especially when I don’t have to go anywhere for them. It’s the best kind of barbecue.

It’s a stay-home barbecue. The stay-b-queue. The stab-by-queue? I don’t know. It’s all weird. It’s all very weird.

Da-da-da. Da-da-da-da-da. I’m looking at stuff. And I’m not ignoring you.

I promise. I promise I’m not ignoring you. I either stare at myself on YouTube or I look at to see if anyone said anything dumb about me on Twitter. I just bounce back and forth between that.

But you nice people who decided to show up today, why are you here? I don’t know. You can want to ask questions, James. You can ask questions.

What else would you like to do? It’s like office hours except lonelier. Let’s see here.

Let’s see. We’ll start with Marcy’s question. What is the best way to triage network performance if you put your app in a data center? What about…

What about… So… Like, do you mean, like, apps communicating with the SQL Server? Like, are you alive? Or do you mean, like, applications pulling data back and forth across the network? Because it’s two kind of different things there.

In that, like… Okay. So if… When I think about networking in a data center, I think about two things. I think about the path that data has to take from the SAN, right?

From the disks across the channels to get to your SQL Server, to get rid into memory, and then to end up in the application. And then I think about, like, you know, the bobs and weevils that the data has to get across to then go to the application. So there’s two different sort of types of networking that are at play there.

And what you got to be clear about is, like, which one you think the problem is. Because a lot of the times when people think that they have a problem with network performance going from the SQL Server to the app, the problem is really, like, that the app server itself is either underpowered, overloaded. I mean, I’ve seen app servers in balanced power mode that reduced, like, app time by, like, 30 or 40%.

And that was a nightmare. So there’s a lot of different… There are a lot of different angles you could approach that from that I would be more… I would be curious to hear more about.

So Darren says, do you do any work with Azure managed instances or MDs? What’s an MDs? I don’t know.

I don’t know what an MD is. So that might tell you how much work I do with Azure. But I like them. I just don’t have a free one to play with. If you have one that you want me to do something to, I’d be happy to work with it. I have nothing against them.

I think they’re lovely things. I think that the managed instance thing in particular is going to do a lot for Azure adoption as it matures as a product. Just like I would be able to do a lot if I ever matured as a person.

But I refuse. Okay. Treehouse SQL, that is. So, Marcy, start with wait stats. If you’re waiting a lot on async network I.O., then it is time to figure out what those apps are doing.

The other part of that picture is how the apps ingest data. So I’m going to tell a pretty funny story about one time. I know I’ve told this in the past, but I was working at a real job.

And we had this in-house bug tracking software. And the developers for it, like, redid the whole user interface. And they added a bunch of, like, pretty things to it.

So that when you went to, like, log a ticket or look at ticket activity, you could feel like you were looking at, like, a work of art. There were, like, animations. And things would, like, slide across the screen.

But when they rolled it out, everyone said, the SQL Server got really slow. And I was like, okay. Let’s look at the SQL Server. And, of course, I’m looking at the SQL Server, and the SQL Server is bored out of its mind.

It’s, like, barely registering wait stats. I’m like, all right. So let’s capture one of the queries that the app is running. And let’s see how long it just takes to hit it in SSMS.

So we do, and it returns immediately. I’m like, all right. So let’s use one of the app servers that still sees the old UX and see if that’s slow. So we do it over there.

And, like, the bare bones HTML ugly as sin, like, clunky rectangle button, like, gray button website, blazing fast there, too. So we had them disable, like, the new, like, CSS crazy animation stuff on the new one. And when we did stuff there, it was blazing fast, too.

So it was actually the way that the app ingested data and the things that the application did to present that data out to people that made things look slow and that made it look like there was a SQL Server problem or a network problem. But it was really just crappy app design. That’s fun, right?

Fun stuff. Let’s see. App is in a new data center. SQL did not move. So app. Well, Atlanta to Vermont.

That’s a pretty good hike. What, I mean, like, what happens if you, let’s start easy and let’s say what happens if you copy a file between, from one data center to another? Like, let’s just say you, like, want to drag and drop a file.

Let’s see how fast that goes. That’s what I would want to know. I would want to, like, you know, you could ping stuff and trace route and all that other, wire shark and whatever else. But, you know, take, like, a one gig file and just see how long it takes to copy from one thing to another.

That’s always kind of a fun way to do things. Let’s see. Let’s see what they say.

Oh, manage data. Oh, manage database. I see now. So Azure SQL DB, you called MD, you tricky, tricky son of a gun. All right. James says, I am planning on going from DBA to SQL developer.

What is the best training I can get for advanced T-SQL? Boy. So when I think about advanced T-SQL, there’s, like, a real wall that you hit.

Right. So, like, you can’t, there’s, like, no more complicated syntax to do something at some point. Right.

You just, like, what, a row number of windowing function. Nothing, like, there’s not a lot that’s really changed with T-SQL lately. And a lot of the problems that have been solved with it that are hard are pretty well written about. So if you think about stuff like bin packing, traversing hierarchies, doing, like, the last non-null, any sort of, like, ordered set stuff, there’s very few people who do that, or rather who write about that and write about it well.

I mean, really, you’re looking at it’s been gone. So what I always say is, buy the most recent book. Oh, it’s down here somewhere.

Buy the most recent book on T-SQL, which right now is this. And it’s backwards. Oh, man. So it’s called T-SQL querying.

It’s by Itzik Ben-Gahn and my friend Adam Mechanic. And I think that if you just have this book as a reference, you can go, you can get through a lot. Because there’s just, you know, good, thorough explanations of, like, how to solve a lot of common problems that do require more advanced T-SQL.

But it’s not like, you know, when you’re writing these queries, you need, like, there’s a more advanced join you can write. All right? It’s like, a join is a join, pretty much.

Right? You just need to figure out, do I need inner, outer, left, right, up, down, cross, cross apply or something. After that, it’s, you know, the syntax doesn’t, like, get infinitely more complex as you do more things. So I would start with a nice book that just gives you reference material on how to do certain stuff.

And then as you approach different problems, maybe that’s when things get more complicated. Let’s see. What else have you got?

Nothing. No other questions, really? All right. I guess I can start drinking then. No, I have to go to the gym. Maybe I won’t bother.

Maybe I’ll just start drinking. Go to the gym tomorrow. I have so many choices. All right. Any other questions? Anything else? Let’s see. Ooh, let’s see. Darren, firing stuff up. Do you know of any resources for managed instances?

No. So it depends on what you want to learn. Where Microsoft has kind of sadly fallen short is that kind of develop is like kind of like learning resources on stuff.

They used to have these virtual labs where you could go in and for free spin up like, like spin up and set up like a failover cluster availability group, log shipping, mirroring, all sorts of cool bells and whistles. They’re doing away with that and replacing it with something. I’m not really sure what it is.

But, you know, what makes it tough for me to like, you know, get on a high horse and say, hey, I really want to talk about this Microsoft product. Is it if I want to do anything with a managed instance, it’s going to cost me like $1,500 a month because there’s no developer managed instance. There’s no like, hey, you know, you might blog about this and get people to adopt it.

Here’s a managed instance that you can kick around in our there’s like like a fifth of a man of a VM in our billion dollar data center here. Go have fun with it. It would cost me like real money to play with a managed instance and to be able to write more stuff about it.

So I think part of the reason why you might not see as much written about those topics as you want is that it like unless someone has a job where their job is paying for like that hardware and they get to like work with or rather work like paying for that service. And they get to work with that service day in and day out because that’s all their business pay the bills. Oh, you’re kind of out of luck.

So if you know anyone at Microsoft who wants to give me a managed instance to to play with and blog about the greatness and awesomeness of sure. Let’s you can you can give them my email. You can give them my YouTube channel.

I would love to have a chat with them here. Let’s see. Yeah, there’s no playground. You know, that’s something that a lot of people don’t think about when they’re moving their infrastructure to the cloud is like. Like, you know, if you have dev and QA and UAT.

Down, like locally, there’s no dev and QA and UAT up in the cloud that all costs the same money. Right. Like, even like even like even if you say you put developer edition on you’re still paying.

Excuse me for a big, big old honking cloud instance. So that’s a lot of fun to think about in that way. Have you thought about a podcast?

Yeah, except. You know. What what terrifies me about a podcast is that a it might be expensive.

Like, I don’t I don’t know what goes into making a podcast. I don’t know how to like. I just haven’t.

Yeah. And in my head, sure, I would like to do it. But then when I look at the amount of time I have in a day and the amount of stuff that I have to do to try to, you know, make make a dime here and there. I’m sort of like, well, I’d love to have a podcast.

But if unless there’s like a button I can push that makes a podcast for me, I don’t know if I’m going to do it just yet. So maybe in time, maybe maybe when I get some more free time, like after SQL bits. And I do my my pre con there and, you know, hopefully survive everything.

Get to it. But for now, I’m just going to I’m just going to do these. I’m also working under this like sort of like blanket of terror that I’ll show up and there will be no one here. Like, I’m very grateful for the 10 of you who chose to show up and ask me questions and talk to me about stuff.

But, man, if I if I ever if I’m ever here and it’s like like 10 past and there’s two people and no one’s asking a question and I’m staring at my screen uncomfortably making doot doots, then, you know, I don’t want to be like no podcast this week. No one showed up. Like, you know, because what’s challenging about the YouTube format is that there’s no like screen share.

So if like there were two people here who weren’t asking questions, I couldn’t switch it over to now I’m going to show you something. It was like I would have to I don’t know, do something totally different. I would have to use like a like a paid platform, like a go to webinar or something like that.

So lots of stuff that I would have to do differently, but not necessarily in a bad way. Just I’ll get a little bit more infrastructure in place and things will go from there. I think I think that’s a nice way of saying all the stuff that I just said, you know, a little bit more infrastructure in place and then then we’re good to go.

See here. Steve asks, I recently ran SP Blitzcache and a top offender has warnings. We couldn’t find a plan for this query.

The proc is a 2200 line nightmare. Any recommendations on next steps, diagnose, resource? So every time I see that, it’s either because the plan has a recompile or like the store procedure, the plan had a recompile hint on it or something.

And like see what’s ever logged some metrics about it, but didn’t keep the plan or the plan recompile for some other reason. And sometimes like if you, when you see that there should be a bunch of reasons listed in there, why there might not be a plan. So what I would do is just grab the query text or like the store procedure name from one of the other columns and see if you can get an estimated plan for it there.

You know, one of the kind of things that I always wish that I could have put into Blitzcache that I didn’t get a chance to was like just some like validation on if a query plan is there. Because, you know, well, it’s good to be able to say, hey, this is a crazy, you know, awful thing that is executing and doing stuff. If there’s no query plan for it, it kind of defeats the point of a Blitzcache.

So I always wanted to do something where like if like a certain amount of the values were null that came back or whatever, then like we would like, like it would change the value of top. So we would bring back some more plans to, you know, to analyze because if you bring, if like you say top people is 10 and five of the lines are we couldn’t find a plan for this query. And you’re looking at like maybe five query, maybe like five plans that, you know, you know, kind of like limited value.

Like they’re probably at the end too. It’s like kind of stinks. Yeah.

Yeah. See, there’s a lot of different reasons why plans might not be in the cache when we go look and they all kind of stink. Like what, so what I would say is if it’s a big 2200 lines for a procedure, like you’re saying most likely. So there’s a limit to the number of nodes that can exist in XML.

It’s like 128. And after 128, you have to run a special command to get the plan XML from another place and you can’t render it in any way. It’s useful.

It’s a lot of fun. So like you can’t like cast it to XML because it’s too big and it throws errors and you can’t do anything good with it. So there should have been a query in there that said, like gave you like a select star from like a query plan text DMV for the SQL handle that, or plan handle that, that didn’t bring back a plan in BlitzCache. And by the way, BlitzCache support now is 99 cents a minute.

So you owe me like three bucks. Damn. I underpriced myself.

I should have said 299 for the first minute. Could have tripled my money. Damn. Let’s see here. What is the best software source control for SQL Server? I mean, look, Redgate kind of runs away with everything right now.

You know, I don’t, I, I, I have issues with some of their products, but I think for stuff like that, Redgate runs away with it. Hands down. I wouldn’t, I wouldn’t do it.

I wouldn’t go with anything else right now. You know, I would, I would probably get it. I would probably use a different monitoring tool, but for source control and DevOps type stuff, I don’t think that I would trust anyone other than Redgate. At this point.

You know, and that’s, and like, and that’s, you know, just based on, you know, like surveying kind of who does stuff, how involved they are with the SQL Server community. You know, the number of people using them, the available training and kind of expertise on it. Like, this just like Redgate just, you know, just stole the ball from everyone else.

It was just kind of like standing there, holding it over their head. Like, so I just, you know, whatever, whatever you need to do, I would, I would go to them first. So far as I know, they are, if you run into something that, you know, if you have some scenario that one of their products just is not addressing, they are pretty, pretty, pretty responsive.

And, you know, getting that kind of stuff put together, especially if you have a lot of money. Or like, or if you have like a company name that like looks good for them to say, hey, we work with like awesome charity group, corp, or something. I don’t know.

Lots of fun stuff. All right. Do, do, do, do, do, do. I don’t need any of this stuff. All right.

Let’s get rid of some stuff on my phone that was blinking and making YouTube questions not show up properly. Next week, I promise it will be seamless because I won’t click the wrong button near the participants window to make everyone disappear. I apologize.

I like sort of accidentally raptured all of you and sent you to a phantom zone or something. But I’m able to join you from my phone. We have a link.

It’s coming to the light, I guess. All right. Do we have any other questions from the magnificent 10 of you who have shown up? Let’s see here.

Darren says, have you ever worked with in-memory OLTP much, exploring some solutions using it? No, and only because I never got a chance to. So it’s a really, it’s a really niche feature as far as what I think it’s a good fit for.

And all of the use cases that I’ve seen for it have been for incredibly high rate data ingestion applications where the data that you care about doesn’t hang around long. So think about like an online gambling type thing where you have a bunch of events and people want to bet on events and do stuff. But as soon as that event is over, like no one’s going to go back and care about it, right?

Like events over, done, payouts. So when you want to ingest all of that like really high value data that needs to happen immediately, in-memory OLTP can be great for that. And then as soon as an event is over, you kind of flush it out to on disk tables where, you know, people can still get to it, but it’s not going to be, you know, like blazing latch-free, lock-free stuff.

And the reason that it’s really good for that is because with the high rate of data ingestion stuff is that that’s where the lock-free thing is really cool because it’s all of those concurrent inserts and updates and stuff that really need to happen quickly. If your problem is like, well, we need this like data warehouse report to be faster, that’s not a good use case for in-memory OLTP. And if your problem is like we have 5,000 transactions a minute and they’re kind of slow, then you don’t need in-memory OLTP.

You need a much more basic level of like tuning and indexing query stuff because the in-memory OLTP stuff, it really shines, I would say, like the 20, 25, 30,000 transactions a second or a minute or some ungodly number where, you know, you just really need to bang stuff in quick and no one can wait. You need all that like, it was like grandma betting 50 cents on Greyhound. Let’s see here.

Who is your pick for the Super Bowl? What teams are in the Super Bowl? You’d have to tell me that first and then I’ll pick. I have no idea right now. I pay almost no attention to any sports.

Sorry. And I’m not anti-sport. I like watching sports in bars and I like watching sports.

I like watching sports highlights because I think anyone who can make millions of dollars doing that kind of stuff because they’re just that good at it is pretty fun to watch. But, yeah, I have two kids and a wife and the amount of sports watching that goes on in my house is limited to the first like week to month when the Mets don’t suck or when there’s like a lot of anticipation that the Mets might do well this year. And then the Mets tank and no one watches baseball anymore.

So that’s about where my cutoff is. Let’s see here. I’m starting to use more clustered columnstore indexes. Yes.

Anything we should be careful of or anything cool we might be missing. So I’m going to go against nearly everything that I’ve ever said about index maintenance when I talk about columnstore and that it is absolutely positively vital that you maintain your columnstore indexes. There’s all sorts of stuff with like gravestones and deltas and compression and dictionaries and like all sorts of things that if you don’t have your columnstore indexes maintained correctly, you can really boot performance on it.

Joe Obish. I keep telling him to blog about it, but he doesn’t. But maybe he finally will.

But at his talk at pass over last year, which might be out on video now, I’m not sure yet. But at his talk at pass last year, he went into a bit how if, you know, you load a bunch of data into your columnstore indexes, but it’s like loaded inefficiently or like data types are weird, then you can end up with like really, really bad query performance because you don’t get like good dictionary compression or like run length encoding and all the other stuff that goes into making query store. Really, really fast.

So like, like, you think about the number like what makes it what makes columnstore really powerful right now is batch mode. So you work on batches of rows at a time rather than like single row at a time like you do with rowstore indexes. And when you have like, misloaded, let’s call them misloaded columnstore indexes, you end up working on far fewer batches because far fewer of them can fit in like an instruction at a time.

But Joe Obish is the man to watch for that. I think, you know, Nico, I’m pretty sure he has some posts on it. If you want to dig through his, his, his like 150 post archive on columnstore, but that’s, that’s the first thing that I would think of.

Um, so aside from maintenance, uh, you know, being very, very mindful of data types and, um, you know, when you, when you see, when you, or when you’re working with columnstore, there are like certain op like plan operators that you just want to avoid. Like constantly like nested loops, merge joins, uh, sorts, um, uh, anything like when operators execute in row mode rather than batch mode for some, for whatever reason, it’s a lot of stuff that can go wonky with those queries. So what, but what I love columnstore and I love what they’ve been doing with it.

There’s still a lot of, you know, manual labor type stuff that you, you have to do when you’re, when your queries are on to make sure that you’re getting the best performance of it. Um, everything is better in bars. Yes.

Everything absolutely is better in bars. Except sleep. Sleeping in bars is not, not better. It’ll get you thrown out pretty quickly. All right.

Any other questions? Anyone else? Fire something fun at me. Let’s see. I don’t know. I, I, I was wondering if I was, uh, no, nothing on Twitter. Okay.

So sometimes I always think that someone might ask a question on Twitter if they can’t show up here on the YouTube channel. Uh, let’s see. Some deranged creep wants to know my age, sex and location. And I’m just going to call, I’m just going to call in the Chris Hansen patrol on you.

None of that. Uh, am I excited about bits? Yes, I do have the costume and I’m, I’m, I’m disappointed that you didn’t notice that the picture that I put on Twitter about the costume because it is fully loaded. It is here.

The only thing that I couldn’t get is, so what’s funny is when I was, when I was talking to Andy Mallon about, about like the, the costume that I was buying, he, he was all excited. He was just like, he, he thought he like, he had like a, like a, like a dead on thing in mind. I was like, look, I can do a lot of it.

And he was like, well, did, did you get a racer back tank top? And I was like, I don’t know what that is. I bought like regular tank tops, which I’m still going to look fat in, but I can’t like imagine it like, like a racer back tank top. And then like, I got all, I got all nervous and I was like, uh, Hey, uh, I’m going to go look on Amazon for a racer back tank top.

And I don’t think that a clothing company has made a racer back tank top for men since Freddie Mercury wore one. Um, and even at that juncture, he might have just worn one that was made for a woman because he was a, he was a pretty slender fella, but not me. And like, I, I tried to look at, uh, like, you know, women’s sizes that, that might, might fit a man of my stature.

And, um, then I guess got depressed. I didn’t want to get into that. Uh, bringing up, hoping I’d bring it up for a preview.

Uh, I’d have to go get it. I don’t have it in my office. It’s the one thing that I managed to talk my wife into not making me keep in the office because everything else that might vaguely belong to me is jammed into my office. It is crazy.

Do you have a pick of him? I can, oh, geez, Louise. Let’s see here. How can I do this? Uh, all right. Let’s see. Uh, where is, how do I get to a browser now? This is very challenging.

You guys are pushing the limits of my, my technical ability here. Freddie Mercury. Live aid.

Come on, baby. Come on. Don’t fail me now. There we go. Images. No, not videos. Images. Come on, phone.

Come on. There we go. All right. So this is a very close approximation of what I will look like at SQL bits. Uh, I can’t do justice to his armpit hair. And, um, I’m, I’m not going to be able to lose 120 pounds, but I have that outfit pretty well nailed.

Except for the racer back tank top. That’s just going to be a regular tank top. I don’t know if I can tuck mine in.

That might, that might get dangerous. I don’t know how that’s going to go. That might not be a great idea. Excuse me. Jeez Louise. It is dry in here. All right.

Let’s see. Get back into the old YouTube. Come on, baby. There we go. Yeah. Ah, practice the pose. Live stream, picture and picture.

Thank you. That is the one thing that I have managed to get right in my time on YouTube is live stream, picture and picture. Uh, when I tried to schedule these, starting this up was the most painful thing I’ve ever done. I had to pay 10 bucks for an encoder or a decoder called like Wirecast.

And every time I went to start it up, it would tell me that my camera didn’t work. And there would be like, like blue screen, like not like computer blue screens, but it would just show me like a blue screen preview. And it was terrible.

So like, but like when I just hit like the go live button, it’s dead simple. When I try to schedule these, it’s miserable. I’m going to have to do something really. Uh, let’s see.

Any other, any other fun questions? You creeps staring at my poor office. Let’s see.

Zach asks. No, no. That was the same person. Practice the pose. No. I mean, it’s just the arm up, right? This isn’t a good camera for that, for me to practice. It’ll be fun.

It’ll be fine. Let’s see. We have, we do have, we have a question or maybe we have a statement. I don’t know. We’ll figure it out in a minute. Sam says, uh, by tuning indexes on a secondary moving reporting to read only secondaries are really popular movement in my workplace.

I’m concerned about how to manage the disparate index needs. Yeah. Uh, I, I wrote a post about this recently that is scheduled.

I think for like two weeks from now. Blogging my butt off. Uh, but it’s, you know, it, it’s, it’s tough to like, depending on how you’re replicating the data, you know, you, you, you usually can’t have a different set of indexes on a secondary. From the, what you have on the primary.

And what makes things even more challenging. And I think this might be the third week in a row that I’ve said this is that, uh, the index DMVs on like readable secondaries don’t migrate their data back to the primary. So you have a really hard time figuring out like what indexes are good for anything.

It’s like looking around like, uh, okay, this one looks good here. This one looks good there. I don’t, you know, it all just goes to heck at some point. Uh, and it would be, it would be nice if there was like something that coagulated all that DMV data, but there is nothing at this point.

You would have, you would have, you are stuck doing that on your own, writing your own scripts to push data around. Yeah. But yeah.

Uh, so like, unless you use some form of like capital R replication, right? By that, I mean like not AGs or log shipping or mirroring where you can apply a script afterwards to make different indexes on a, on a, on a secondary available than what are just on the primary. Uh, yeah.

Kind of out of luck on that. And that’s, and that’s too bad because I know that with availability groups, at least on readable replicas, SQL Server is able to create like temporary statistics. So it would be nice if you could create temporary indexes too.

That would be fun. Aggregate, not quite. No, I like coagulate better. I think coagulate sounds better as a word. Aggregate.

Aggregate just sounds aggressive and angry. Not fun. Coagulate. It’s like, we’re going to go, we’re going to go have fun. We’re doing it together. Co-agulate. A bloody mess.

Why? Lots of things coagulate. Pancake batter. Uh, fat. I don’t know.

What else? What else coagulates? I’m trying to think of something that coagulates in a pleasant way now and I’m starting to see your point. Maybe coagulate isn’t good either. Maybe there’s no way, there’s no good way, no good way to say you bring things together. There’s no good single word for that.

They’re all just ugly. All right. Uh, anything else? Any other fun questions? Observations?

Hmm. Hmm. Hmm. All right, folks. Uh, thank you for joining me. Uh, I appreciate all of you showing up and asking stuff. I will be back next week at the same time doing the same thing.

And hopefully you’ll be able to make it then. I’ll see you next time. Thank you. And, uh, next time I will have the Freddie Mercury costume ready to show you. I think we’re getting, we’re getting close enough to bits now where I can, I can, I can do the reveal.

So I will see you next week. Not dressed up, but I’ll, I’ll have it. I’ll have it. I’ll tease you a little. Maybe I’ll wear some little shorts or something.

Bye.

Going Further


If this is the kind of SQL Server stuff you love learning about, you’ll love my training. Blog readers get 25% off the Everything Bundle — over 100 hours of performance tuning content. Need hands-on help? I offer consulting engagements from targeted investigations to ongoing retainers. Want a quick sanity check before committing to a full engagement? Schedule a call — no commitment required.

Last Week’s Almost Definitely Not Office Hours: January 25

ICYMI


Last week’s thrilling, stunning, flawless episode of whatever-you-wanna-call-it.

Thanks for watching!

Video Summary

In this video, I explore some quirky aspects of SQL Server maintenance and query optimization. Starting off with a lighthearted joke about webcasts and attendance, I dive into more serious topics like index usage, DMVs (Dynamic Management Views), and the optimizer’s behavior. I share an amusing demo illustrating how certain columns in tables can influence parallel plans, leading to performance differences that are both interesting and somewhat perplexing. The discussion then shifts to backup encryption and restore processes, touching on best practices for securing backups when using cloud storage services like AWS. Throughout the video, I also share some personal insights—like my ongoing mustache-growing challenge and a few funny anecdotes about past projects and experiences with SQL Server. It’s been great engaging with you all, and I hope to see more of your questions in future sessions!

Full Transcript

I sure hope I’m alive. Wee! Alright, let’s get that worked out. And…

What if you threw a webcast and nobody came? Good question, right? I should share this thing on Twitter. Words that…

…the horrible coming out of my face. … …

… … … … all right and we’ll see oh we have a person hello a person there’s all well also a truck out front the truck is my new best friend i guess and i have a bunch of wine openers might ask you know it’s funny these uh these wine openers are functionally the same there is absolutely no difference between any of these wine openers these corkscrews they are identical in every single way right from the backs the fronts but they just have slightly different branding on them which i find very funny so i got two houdinis and a word i can’t read because it’s in too fancy of a script and uh everything about them is completely the same and it reminds me a bit of um like dmv queries in sql server where uh you know they can like they can be wrong you can totally write a wrong query but when you write the right query it’s going to look exactly the same as everyone else’s right query like you can find ways to mess with it like to do something a little bit differently but it’s all being the same dmvs and columns everything else and it’s very strange to think about that that everyone has the exact same set of tools to work with and everyone has the exact same set of tools uh to to look at but people get very territorial about their very special dmv or diagnostic queries and you you would you would act like they invented the thing but they didn’t it’s kind of funny anyway there are there are approximately three of you here one of you is going to say something one of you is going to ask a question like three people in a room one of you has a question about sql server maybe what’s up arthur daniels great post today about the memory grant thing enjoyed that uh something kind of funny that you’ll notice uh with stack overflow is when you’re writing queries against it uh stuff against like the users table that involves about me or the post table that involves uh a few of the columns or like the comments table that involves the text column the text of the comment uh the optimizer is quite biased against parallel plans when you involve when you involve those columns uh i noticed that like the even on 2010 like the the parallel version of the plan that you were looking at was quite quite a bit more expensive than the serial version but uh i’ll send you over a funny demo query specifically for the comments table where if you use like if you use a creation date column play goes parallel everything’s fine but if you use the the comment text column it goes to say serial and everything sucks it’s kind of amusing yes yes indeed indeed indeed we should all these things optimizer is quite quite a strange strange beast used used used to maxed up one oh yeah you use a sap right is it business one that you use mostly or something else there’s a funny delay on these things seven of you god bless does does one of seven people have a question i’m uh i’m busy growing out my various hairs uh you’ve since you’re here you you’ve probably all seen the uh the charity thing that i’m doing where if if i hit a certain dollar amount i’ll i’ll deliver my my regular session at bits not not the not the full pre-con i’m not going to dress like freddie mercury for eight hours i don’t think freddie mercury even dressed like freddie mercury for eight hours but uh if i’ll do the one hour session dressed just in freddie mercury’s get up from the live aid concert uh and so i’m trying to grow out the the mustache and the hair so i can i can look more freddie-ish when i do that going all for it i’m not gonna i’m not gonna get skinny though i don’t think i don’t think i have it i don’t think i have the capability to get to get that skinny but i tried once it didn’t go well i got very dizzy all the time no fake teeth no my my regular teeth are weird enough you put fake teeth in here i don’t know what would happen they’re all over the place you know what’s funny is i actually got uh my wit my wisdom teeth were perfectly fine like they weren’t impacted everything was normal with my wisdom teeth but it was decided that they should get pulled out and everyone who said that you know if you go take your wisdom teeth out it’ll help your like regular teeth straighten out and i did that when i was 19 and here i am now i think like i’m i’m 2 19s in age and my teeth haven’t moved an inch or not even like at all an inch would be huge but like my teeth did not change one bit so everyone lied to me my teeth did not like magically decompress in my gums uh arthur has an interesting question uh have you ever seen an execution plan in cache with just a select operator and zero estimated cost if it helps a query return zero rows and i run the query manually i get a clustered index seek uh so that can happen uh let’s see what’s the what’s the best way some um if and it’s it’s just a select query it’s like it’s not wrapped in like an if exists or like in any sort of if logic or branching logic anyway uh so when if you run the query manually um you might be getting a trivial plan which is which in which case you will get um uh what do you call it there an index seek but if you get a non-trivial plan um yeah so if the cash trivial plan you might be getting a constant scan in there uh which might be weird i don’t know though um um if you want to show me privately what you mean i’d be happy to take a better look at it but it is a little little rusty on that uh lee asks any gutches with backup encryption we’re copying backups to aws now and i’d like to ensure no one can restore it but us uh no no real gutches uh the only real gutches with backups right now are around um uh tde so if you’re if you’re just like if you’re using like like like like the like built-in backup encryption and not using tde and then taking the backups uh so like with tde it gets kind of funky because on versions of cc older than 2016 you would get this kind of weird thing where all of a sudden you couldn’t compress your backups when tde was enabled uh and then you know your backups were huge but after two cc was over 2016 introduced encryption for uh for or reintroduced backup compression for tde enabled databases but there’s been all sorts of crazy bugs uh can i still restore a backup of prod to dev without a bunch of hoops to jump through well initially you’ll have some hoops like you’ll have to make sure that they have the certificate and all that other stuff uh on on the on the dev server but after that it’s pretty easy to pretty easy to do uh and all that stuff is built into oldest scripts so or at least at least on the backup side of course ola doesn’t write a restore script poor ola yeah the trivial yeah the constant scan is a weird thing uh so like what my guess would be that sometimes in prod the query is non-trivial and it might bail out for some reason like there might be some contradiction detection uh so i don’t know lee says he’s using dba tools to generate restore scripts to restore a dev uh i’ve never actually used them for that um i still don’t have a real job where i would have to do backups and restores but um you know hopefully hopefully i’ll avoid that uh but you know if if they have if they have everything built in then i wouldn’t i wouldn’t distrust it the dba tools folks are uh pretty pretty good pretty smart folks pretty good at powershell much better at powershell than i’ll ever be i hope if anyone wants me to learn powershell i don’t know what i’ll do let’s go cry in a corner somewhere that’s what i what i do best anyway cry in a corner very goth all right any other questions any other people want to know about a thing there there are 10 of you here now this many no one asks me anything i’m gonna go back to doodling become quite quite a doodler the last few weeks maybe next week i’ll show you some of my doodles i recorded a video earlier too joe asks is this going to be a regular thing like office hours used to be yeah as long as i can keep it up uh you know it’s it’s just me and um you know so there’s like no coverage so if uh if if the day ever comes when i’m booked with a client friday at noon then i won’t be able to do it but i think as long as uh as long as i can i’ll do it i’ll make it regular well maybe i’ll do it on a different day maybe i’ll you know bring me i just tried fridays because you know when we did office hours on wednesdays people would always be like uh it’s wednesday at noon i can’t do anything fridays at noon people are a little bit more um a little bit more uh relaxed at work i think hopefully so i i started i just decided to do fridays because they seemed like a pretty reasonable day uh have you used the failover detection utility from the tiger team no um you know i it’s not that i don’t think it’s cool i think it’s really cool and i love that they built their they’re built the microsoft is building tools like this uh it’s just been so long since um i’ve even had an ag demo environment with my vms to play with that stuff it’s just it’s just not my main focus this is not what i’m particularly interested in with sql server um it looks great though uh i know a few people excuse me who have used it who do have uh production ag stuff and they are pretty pretty psyched on it um arthur asks on oltp systems are you a fan of compression um you know if if io is an issue sure um it’s if so yes if like so if you’re in a situation with oltp where like uh you have trouble or like even if you have a really big oltp system you know if you have you know if you have trouble either keeping all your data pretty uh you know pretty like a ton of data or if you know uh you if like when you read data from disk it’s you know uh it’s not as fast as you’d like it to be the compression can certainly help there uh as long as you’re not like terribly cpu bound it’s pretty neat also you know it’s one of those things where like you have to be really careful that a like you’re actually getting a compression benefit from things b that the compression isn’t messing with your inserts updates and deletes and see that um you know when it’s it’s not like causing any like not causing like harmful cpu overhead uh it totally has a good place with oltp i’m not against it by any means but you know there are some there are some boxes that you have to check before i think before you go and uh implement it the other thing that kind of stinks about compression is that there’s no way to set it at like the table level or database level or anything like that so like people can go and create a new index and with no compression and then you’re just kind of like stuck yeah if you want to change it you have to rebuild the index but then again that’s one of the reasons that i would support rebuilding an index is if you wanted to add compression lee says i recently compressed a database and the next day one of our nightly ssis packages to that database suddenly jumped five minutes in duration with a lot more logical reads interesting i wonder what did you did you happen to capture what was different about it i mean like i get that you compressed the database and that was different but i wonder what was different about the process or like what what what the process did differently in some way be interesting darren says he always has a cpu worry with compression well no of course nothing changed in the ssi but like the ssis package does stuff in sql server and sometimes those things have execution plans or they have you know things to go differently um you know like so for an example uh there are these funny things called dml request sorts when you modify data and some sometimes those dml request sorts can add a exactly what they sound like a gigantic sort to a query plan and sometimes i would guess that if you had to compress data loading data in a sorted pattern would would help so that if you like if you had an insert that was at one point not doing the the dml request sort and then after you did the compression it was then that might be the clue as far as like the cpu where he goes uh you know i very few times do i see a system that is cpu constrained in a way that like cpus are pegged so like i don’t see a lot of people whose systems are running oltp and they’re at like 99 which is where which is like where i’d be worried about compression where i most people like when they people have cpu which is on a sql server mostly what i see is like they’re running out of worker thread stuff where they’re hitting thread pool weights and compression won’t hit won’t compression compression won’t affect that compression will affect like if you have cpus that are running hot then they’re going to run a little bit hotter with compression not like a ton and says you should have seen your system a couple months ago could take a look now want to pay me the compile rate is super high in our internal apps like the how much when you say compile rate do you mean like queries compiling or do you mean like how long they have like how long it takes them to compile or uh how frequently they compile there’s a lot of questions they have so many questions so many big questions percent compile the batches oh and uh i wonder what changed because obviously a lot of compilations is never a good thing uh did you introduce like some weird dynamic sql or some temp tables or uh i don’t know i’ll tell you one of the funniest reasons uh that i ever saw for a high compile rate was um i forget what the application was i want to say it was like asp.net but all of the queries that went in uh they would they would they would like be this like initial query that would run that would like test to see if the query was valid so it would come in it would be like set fmt only on lower like set browse table on or whatever and then it would run a query that would hit like 70 million roll rows in a table and then it would like change the settings back and all of these queries are coming in and they were just compiling every single time because the the session would start it would run those set options and it would cause a compilation which is really funny to see i was like why why why would you do that silly can you fix parameter sniffing with option recompile uh so that doesn’t actually fix parameter sniffing what that does is it disables parameters sniffing um and while it is you technically a fix sometimes there are underlying plan quality issues that need to be addressed because what option recompile does is it it assumes that the query plan you get when sql server can make a good guess is a good plan and i don’t i don’t buy that a lot of the time i think a lot a lot of the time when people are like oh if i option recompile it fixed the problem but it does it there may still be these weird underlying things that you have to deal with oh well you know it’s it showed up in chat so i felt i figured i’d talk about it sorry i didn’t i didn’t mean that you weren’t funny i just i was i just figured i’d uh i’d talk about option recompile it’s not it’s not like i have a lot of other stuff to talk about i’m pretty boring i already knew a vacuum cleaner it was funny like uh my wife had knocked over this like pink princess unicorn snow globe that my daughter has and it just like it was like shattered glass and plaster and whatever the liquid inside of a snow globe is everywhere and she she used our nice vacuum monster dyson monster thing to to uh to vacuum it up and apparently you shouldn’t vacuum water leave it non-shop back because now like anytime you put one of the attachment heads in it just starts spinning even if you’re not vacuuming so there’s a short in there somewhere so i ordered a new vacuum this morning hopefully that shows up before the floors are covered in disgustingness uh that’s the rest of the way always turn on query store in sql server 2016 plus um no uh there is some observer overhead to it and well i think it’s a very valuable tool and especially if uh so i’ll put it like this if you’re going to use it then you should turn it on and see if there’s an there’s no unacceptable performance decrease with query store i think it’s a really cool thing to to be able to use to track query performance especially over time because the plan cache is such hot garbage at keeping things in it um so i would say that i would i would like to see it turned on more and i would like to see um the various weird bugs around it uh fixed and i would also like to see some more options about where the data is stored with query store i think that’d be nice but uh you know i’d say generally if you’re going to use it and there’s no you know um unacceptable performance overhead to turn it on uh one of my last great posts over on brent’s site was about uh the cruel defaults that uh query store is turned on with so like uh there are collection modes where they define the types of queries that will end up getting collected by query store by default it goes to all and all captures and since this is my channel i get to curse all capture some real bullshit all will capture every single like system query and all this dumb stuff that goes on in the background that who cares but you if you use the collection mode auto that like queries have to meet some certain thresholds they’re not documented so i don’t know what they are but uh they have to um they have to meet certain thresholds before they get collected in query story they’re in like like compile time or like how like you know if like the query took a while to run or something like that so they’re like that turning on auto makes the overhead a little bit less tough but you know it’s it can still be there and arthur was helpful enough to post the link for us thank you arthur you are my you’re my number one junior office hours dba i wish i had a better title for you uh darren says he has an odd question we have a data mart where they rebuild all the data databases are in simple recovery model it seems odd to have no maintenance at all though any thoughts uh no that’s like the perfect perfect time to not have any maintenance if you’re just blowing everything away and loading it back in every night who cares let’s say it’s like a dba’s dream to not have to care about that sort of thing i wouldn’t do any maintenance on that i mean like there’s like there’s like almost no point in backing it up there’s no point in doing index maintenance on it i mean okay i can’t even think of a good reason to run check run check db there i guess i guess check db would be would be okay like if you wanted to run that before you loaded data just to see if like any system tables were corrupt that might be a good idea but i can’t think of a good yeah it’s just isn’t really good if it’s just gonna get like you’re taking a backup of something that’s gonna be gone anyway all right out the door out the door with you see what other maintenance is there i wouldn’t update you know i wouldn’t update stats because i’m pretty sure that like if you like truncate or drop tables and create tables and reload everything i wouldn’t even like you like the stats would update there i mean i guess if you needed i guess if you needed better statistics than what the autumn like the whatever like automatic stats update threshold is then there might be there might be a use case for updating stats there at a higher sampling well they do all right we’re on the same page look at that good job you are whoever designed that is now a full-fledged sql server consultant they should i don’t know i don’t have any i don’t have any certifications i’m sorry if they did if i did i would i would say that they are honorary honorarily certified but i’ve got none none i’m too dumb to pass a test see lee says i have a two new two node ag on standard edition with five ags because i have to use basic availability groups any reasons not to migrate this one ag to enterprise if i do make so uh i’d say cost is the primary thing like how many so you know once you go from standard to enterprise your cost jumps up pretty significantly it’s a five thousand dollar per court difference if you do migrate any suggested method uh well if you’re migrating to like if you’re on uh windows server 2016 i think you can make it make it a bit more seamless but i think like i know with ags there’s some weird stuff from like the windows server the windows server level needing to match and then like the sql server level needing to match there’s weird stuff involved there oh if you have i mean if you if you already have it paid for then yeah i’d probably move uh if you need to move to like like a net new environment i would use uh like log shipping or something i wouldn’t use mirroring in this case because you’re going from standard to enterprise and uh you know you obviously you already have an ag setup so that would be rather awkward to try and implement so um i i would i would say to just if you wanted to use log shipping and just uh get your current databases moved over to whatever new vm hardware fake hardware whatever virtual hardware uh you’re going to set up then that’s probably how i’d move things just to just to make the transition a bit more seamless and that’s assuming that you couldn’t you know set up another vm to you know get the ag also synchronizing to and then fail over to that and then fail over to whatever’s next and then destroy the old environment yeah that’s tough so uh at least he’s trying to simplify things so i don’t have so many ags to manage and check like when we reboot for us yeah that’s a bummer um you know that’s one of the reasons why you know i i asked the question again ah man all my all my all my solid gold material is still still on brent’s site but uh you know i i had a poster over there recently about like have ags gotten any easier and i think you know when it comes to stuff like patching and um you know so and even something like you know just doing uh like uh checking out indexes in an ag right so you know you have the stuff on the primary and you check like index metrics there and you know you can see that like i have a bunch of unused indexes but they get used on a secondary if you’re offloading reads so yeah you know there’s still a lot of stuff that’s tough about ags and patching is certainly one of those very perilous things because with ags you know in particular like there are a ton of patches i mean there are a ton of fixes in each patch specifically for ag stuff and ag patches have been known to break stuff too so it’s like you’re very perilous you know it’s like whatever i’d say whatever you get um whatever you what do we have for your ags make sure that you know when you do those patches you’re testing them in a lower environment first because boy howdy if one of those patches breaks something you have to uninstall a patch uninstalling a patch is my one of my least favorite things in the world because i always forget it’s the best way to i know there’s like there’s like a few ways to do it and there’s like one of them that’s like the best way to do it and i always forget which one it is yeah daren mentions you might be able to do a rolling upgrade if you can do a rolling upgrade great if you’re on like windows server 2012 or something though i don’t think you can do the you can’t do a rolling upgrade if you’re moving to like windows server 16 or 19 down the line so it would have to be at least 2016 just fun nothing but a good time with those ags who’s emailing me no i’m not talking to you don’t worry it wasn’t brent uh let’s see all right anyone else weird questions the audience has dwindled down to six now i feel bad i bored someone well i must have must have must have made someone sleepy all right well if no one has any other questions i’m gonna i’m gonna unlive this thing or try to figure out how oh there there’s a big red button that says end stream all right uh i’m gonna i’m gonna d live myself and go um i don’t know what i’m gonna do i’m gonna practice singing i guess anyway uh thanks everyone for joining me uh i had a good time i’ll see you next week i hope you know god willing and uh yeah thanks lee yes i’ll see you next week and uh go have fun this weekend do do stuff i wouldn’t do yes you have a good weekend too joe all right everyone take care bye

Video Summary

In this video, I explore some quirky aspects of SQL Server maintenance and query optimization. Starting off with a lighthearted joke about webcasts and attendance, I dive into more serious topics like index usage, DMVs (Dynamic Management Views), and the optimizer’s behavior. I share an amusing demo illustrating how certain columns in tables can influence parallel plans, leading to performance differences that are both interesting and somewhat perplexing. The discussion then shifts to backup encryption and restore processes, touching on best practices for securing backups when using cloud storage services like AWS. Throughout the video, I also share some personal insights—like my ongoing mustache-growing challenge and a few funny anecdotes about past projects and experiences with SQL Server. It’s been great engaging with you all, and I hope to see more of your questions in future sessions!

Full Transcript

I sure hope I’m alive. Wee! Alright, let’s get that worked out. And…

What if you threw a webcast and nobody came? Good question, right? I should share this thing on Twitter. Words that…

…the horrible coming out of my face. … …

… … … … all right and we’ll see oh we have a person hello a person there’s all well also a truck out front the truck is my new best friend i guess and i have a bunch of wine openers might ask you know it’s funny these uh these wine openers are functionally the same there is absolutely no difference between any of these wine openers these corkscrews they are identical in every single way right from the backs the fronts but they just have slightly different branding on them which i find very funny so i got two houdinis and a word i can’t read because it’s in too fancy of a script and uh everything about them is completely the same and it reminds me a bit of um like dmv queries in sql server where uh you know they can like they can be wrong you can totally write a wrong query but when you write the right query it’s going to look exactly the same as everyone else’s right query like you can find ways to mess with it like to do something a little bit differently but it’s all being the same dmvs and columns everything else and it’s very strange to think about that that everyone has the exact same set of tools to work with and everyone has the exact same set of tools uh to to look at but people get very territorial about their very special dmv or diagnostic queries and you you would you would act like they invented the thing but they didn’t it’s kind of funny anyway there are there are approximately three of you here one of you is going to say something one of you is going to ask a question like three people in a room one of you has a question about sql server maybe what’s up arthur daniels great post today about the memory grant thing enjoyed that uh something kind of funny that you’ll notice uh with stack overflow is when you’re writing queries against it uh stuff against like the users table that involves about me or the post table that involves uh a few of the columns or like the comments table that involves the text column the text of the comment uh the optimizer is quite biased against parallel plans when you involve when you involve those columns uh i noticed that like the even on 2010 like the the parallel version of the plan that you were looking at was quite quite a bit more expensive than the serial version but uh i’ll send you over a funny demo query specifically for the comments table where if you use like if you use a creation date column play goes parallel everything’s fine but if you use the the comment text column it goes to say serial and everything sucks it’s kind of amusing yes yes indeed indeed indeed we should all these things optimizer is quite quite a strange strange beast used used used to maxed up one oh yeah you use a sap right is it business one that you use mostly or something else there’s a funny delay on these things seven of you god bless does does one of seven people have a question i’m uh i’m busy growing out my various hairs uh you’ve since you’re here you you’ve probably all seen the uh the charity thing that i’m doing where if if i hit a certain dollar amount i’ll i’ll deliver my my regular session at bits not not the not the full pre-con i’m not going to dress like freddie mercury for eight hours i don’t think freddie mercury even dressed like freddie mercury for eight hours but uh if i’ll do the one hour session dressed just in freddie mercury’s get up from the live aid concert uh and so i’m trying to grow out the the mustache and the hair so i can i can look more freddie-ish when i do that going all for it i’m not gonna i’m not gonna get skinny though i don’t think i don’t think i have it i don’t think i have the capability to get to get that skinny but i tried once it didn’t go well i got very dizzy all the time no fake teeth no my my regular teeth are weird enough you put fake teeth in here i don’t know what would happen they’re all over the place you know what’s funny is i actually got uh my wit my wisdom teeth were perfectly fine like they weren’t impacted everything was normal with my wisdom teeth but it was decided that they should get pulled out and everyone who said that you know if you go take your wisdom teeth out it’ll help your like regular teeth straighten out and i did that when i was 19 and here i am now i think like i’m i’m 2 19s in age and my teeth haven’t moved an inch or not even like at all an inch would be huge but like my teeth did not change one bit so everyone lied to me my teeth did not like magically decompress in my gums uh arthur has an interesting question uh have you ever seen an execution plan in cache with just a select operator and zero estimated cost if it helps a query return zero rows and i run the query manually i get a clustered index seek uh so that can happen uh let’s see what’s the what’s the best way some um if and it’s it’s just a select query it’s like it’s not wrapped in like an if exists or like in any sort of if logic or branching logic anyway uh so when if you run the query manually um you might be getting a trivial plan which is which in which case you will get um uh what do you call it there an index seek but if you get a non-trivial plan um yeah so if the cash trivial plan you might be getting a constant scan in there uh which might be weird i don’t know though um um if you want to show me privately what you mean i’d be happy to take a better look at it but it is a little little rusty on that uh lee asks any gutches with backup encryption we’re copying backups to aws now and i’d like to ensure no one can restore it but us uh no no real gutches uh the only real gutches with backups right now are around um uh tde so if you’re if you’re just like if you’re using like like like like the like built-in backup encryption and not using tde and then taking the backups uh so like with tde it gets kind of funky because on versions of cc older than 2016 you would get this kind of weird thing where all of a sudden you couldn’t compress your backups when tde was enabled uh and then you know your backups were huge but after two cc was over 2016 introduced encryption for uh for or reintroduced backup compression for tde enabled databases but there’s been all sorts of crazy bugs uh can i still restore a backup of prod to dev without a bunch of hoops to jump through well initially you’ll have some hoops like you’ll have to make sure that they have the certificate and all that other stuff uh on on the on the dev server but after that it’s pretty easy to pretty easy to do uh and all that stuff is built into oldest scripts so or at least at least on the backup side of course ola doesn’t write a restore script poor ola yeah the trivial yeah the constant scan is a weird thing uh so like what my guess would be that sometimes in prod the query is non-trivial and it might bail out for some reason like there might be some contradiction detection uh so i don’t know lee says he’s using dba tools to generate restore scripts to restore a dev uh i’ve never actually used them for that um i still don’t have a real job where i would have to do backups and restores but um you know hopefully hopefully i’ll avoid that uh but you know if if they have if they have everything built in then i wouldn’t i wouldn’t distrust it the dba tools folks are uh pretty pretty good pretty smart folks pretty good at powershell much better at powershell than i’ll ever be i hope if anyone wants me to learn powershell i don’t know what i’ll do let’s go cry in a corner somewhere that’s what i what i do best anyway cry in a corner very goth all right any other questions any other people want to know about a thing there there are 10 of you here now this many no one asks me anything i’m gonna go back to doodling become quite quite a doodler the last few weeks maybe next week i’ll show you some of my doodles i recorded a video earlier too joe asks is this going to be a regular thing like office hours used to be yeah as long as i can keep it up uh you know it’s it’s just me and um you know so there’s like no coverage so if uh if if the day ever comes when i’m booked with a client friday at noon then i won’t be able to do it but i think as long as uh as long as i can i’ll do it i’ll make it regular well maybe i’ll do it on a different day maybe i’ll you know bring me i just tried fridays because you know when we did office hours on wednesdays people would always be like uh it’s wednesday at noon i can’t do anything fridays at noon people are a little bit more um a little bit more uh relaxed at work i think hopefully so i i started i just decided to do fridays because they seemed like a pretty reasonable day uh have you used the failover detection utility from the tiger team no um you know i it’s not that i don’t think it’s cool i think it’s really cool and i love that they built their they’re built the microsoft is building tools like this uh it’s just been so long since um i’ve even had an ag demo environment with my vms to play with that stuff it’s just it’s just not my main focus this is not what i’m particularly interested in with sql server um it looks great though uh i know a few people excuse me who have used it who do have uh production ag stuff and they are pretty pretty psyched on it um arthur asks on oltp systems are you a fan of compression um you know if if io is an issue sure um it’s if so yes if like so if you’re in a situation with oltp where like uh you have trouble or like even if you have a really big oltp system you know if you have you know if you have trouble either keeping all your data pretty uh you know pretty like a ton of data or if you know uh you if like when you read data from disk it’s you know uh it’s not as fast as you’d like it to be the compression can certainly help there uh as long as you’re not like terribly cpu bound it’s pretty neat also you know it’s one of those things where like you have to be really careful that a like you’re actually getting a compression benefit from things b that the compression isn’t messing with your inserts updates and deletes and see that um you know when it’s it’s not like causing any like not causing like harmful cpu overhead uh it totally has a good place with oltp i’m not against it by any means but you know there are some there are some boxes that you have to check before i think before you go and uh implement it the other thing that kind of stinks about compression is that there’s no way to set it at like the table level or database level or anything like that so like people can go and create a new index and with no compression and then you’re just kind of like stuck yeah if you want to change it you have to rebuild the index but then again that’s one of the reasons that i would support rebuilding an index is if you wanted to add compression lee says i recently compressed a database and the next day one of our nightly ssis packages to that database suddenly jumped five minutes in duration with a lot more logical reads interesting i wonder what did you did you happen to capture what was different about it i mean like i get that you compressed the database and that was different but i wonder what was different about the process or like what what what the process did differently in some way be interesting darren says he always has a cpu worry with compression well no of course nothing changed in the ssi but like the ssis package does stuff in sql server and sometimes those things have execution plans or they have you know things to go differently um you know like so for an example uh there are these funny things called dml request sorts when you modify data and some sometimes those dml request sorts can add a exactly what they sound like a gigantic sort to a query plan and sometimes i would guess that if you had to compress data loading data in a sorted pattern would would help so that if you like if you had an insert that was at one point not doing the the dml request sort and then after you did the compression it was then that might be the clue as far as like the cpu where he goes uh you know i very few times do i see a system that is cpu constrained in a way that like cpus are pegged so like i don’t see a lot of people whose systems are running oltp and they’re at like 99 which is where which is like where i’d be worried about compression where i most people like when they people have cpu which is on a sql server mostly what i see is like they’re running out of worker thread stuff where they’re hitting thread pool weights and compression won’t hit won’t compression compression won’t affect that compression will affect like if you have cpus that are running hot then they’re going to run a little bit hotter with compression not like a ton and says you should have seen your system a couple months ago could take a look now want to pay me the compile rate is super high in our internal apps like the how much when you say compile rate do you mean like queries compiling or do you mean like how long they have like how long it takes them to compile or uh how frequently they compile there’s a lot of questions they have so many questions so many big questions percent compile the batches oh and uh i wonder what changed because obviously a lot of compilations is never a good thing uh did you introduce like some weird dynamic sql or some temp tables or uh i don’t know i’ll tell you one of the funniest reasons uh that i ever saw for a high compile rate was um i forget what the application was i want to say it was like asp.net but all of the queries that went in uh they would they would they would like be this like initial query that would run that would like test to see if the query was valid so it would come in it would be like set fmt only on lower like set browse table on or whatever and then it would run a query that would hit like 70 million roll rows in a table and then it would like change the settings back and all of these queries are coming in and they were just compiling every single time because the the session would start it would run those set options and it would cause a compilation which is really funny to see i was like why why why would you do that silly can you fix parameter sniffing with option recompile uh so that doesn’t actually fix parameter sniffing what that does is it disables parameters sniffing um and while it is you technically a fix sometimes there are underlying plan quality issues that need to be addressed because what option recompile does is it it assumes that the query plan you get when sql server can make a good guess is a good plan and i don’t i don’t buy that a lot of the time i think a lot a lot of the time when people are like oh if i option recompile it fixed the problem but it does it there may still be these weird underlying things that you have to deal with oh well you know it’s it showed up in chat so i felt i figured i’d talk about it sorry i didn’t i didn’t mean that you weren’t funny i just i was i just figured i’d uh i’d talk about option recompile it’s not it’s not like i have a lot of other stuff to talk about i’m pretty boring i already knew a vacuum cleaner it was funny like uh my wife had knocked over this like pink princess unicorn snow globe that my daughter has and it just like it was like shattered glass and plaster and whatever the liquid inside of a snow globe is everywhere and she she used our nice vacuum monster dyson monster thing to to uh to vacuum it up and apparently you shouldn’t vacuum water leave it non-shop back because now like anytime you put one of the attachment heads in it just starts spinning even if you’re not vacuuming so there’s a short in there somewhere so i ordered a new vacuum this morning hopefully that shows up before the floors are covered in disgustingness uh that’s the rest of the way always turn on query store in sql server 2016 plus um no uh there is some observer overhead to it and well i think it’s a very valuable tool and especially if uh so i’ll put it like this if you’re going to use it then you should turn it on and see if there’s an there’s no unacceptable performance decrease with query store i think it’s a really cool thing to to be able to use to track query performance especially over time because the plan cache is such hot garbage at keeping things in it um so i would say that i would i would like to see it turned on more and i would like to see um the various weird bugs around it uh fixed and i would also like to see some more options about where the data is stored with query store i think that’d be nice but uh you know i’d say generally if you’re going to use it and there’s no you know um unacceptable performance overhead to turn it on uh one of my last great posts over on brent’s site was about uh the cruel defaults that uh query store is turned on with so like uh there are collection modes where they define the types of queries that will end up getting collected by query store by default it goes to all and all captures and since this is my channel i get to curse all capture some real bullshit all will capture every single like system query and all this dumb stuff that goes on in the background that who cares but you if you use the collection mode auto that like queries have to meet some certain thresholds they’re not documented so i don’t know what they are but uh they have to um they have to meet certain thresholds before they get collected in query story they’re in like like compile time or like how like you know if like the query took a while to run or something like that so they’re like that turning on auto makes the overhead a little bit less tough but you know it’s it can still be there and arthur was helpful enough to post the link for us thank you arthur you are my you’re my number one junior office hours dba i wish i had a better title for you uh darren says he has an odd question we have a data mart where they rebuild all the data databases are in simple recovery model it seems odd to have no maintenance at all though any thoughts uh no that’s like the perfect perfect time to not have any maintenance if you’re just blowing everything away and loading it back in every night who cares let’s say it’s like a dba’s dream to not have to care about that sort of thing i wouldn’t do any maintenance on that i mean like there’s like there’s like almost no point in backing it up there’s no point in doing index maintenance on it i mean okay i can’t even think of a good reason to run check run check db there i guess i guess check db would be would be okay like if you wanted to run that before you loaded data just to see if like any system tables were corrupt that might be a good idea but i can’t think of a good yeah it’s just isn’t really good if it’s just gonna get like you’re taking a backup of something that’s gonna be gone anyway all right out the door out the door with you see what other maintenance is there i wouldn’t update you know i wouldn’t update stats because i’m pretty sure that like if you like truncate or drop tables and create tables and reload everything i wouldn’t even like you like the stats would update there i mean i guess if you needed i guess if you needed better statistics than what the autumn like the whatever like automatic stats update threshold is then there might be there might be a use case for updating stats there at a higher sampling well they do all right we’re on the same page look at that good job you are whoever designed that is now a full-fledged sql server consultant they should i don’t know i don’t have any i don’t have any certifications i’m sorry if they did if i did i would i would say that they are honorary honorarily certified but i’ve got none none i’m too dumb to pass a test see lee says i have a two new two node ag on standard edition with five ags because i have to use basic availability groups any reasons not to migrate this one ag to enterprise if i do make so uh i’d say cost is the primary thing like how many so you know once you go from standard to enterprise your cost jumps up pretty significantly it’s a five thousand dollar per court difference if you do migrate any suggested method uh well if you’re migrating to like if you’re on uh windows server 2016 i think you can make it make it a bit more seamless but i think like i know with ags there’s some weird stuff from like the windows server the windows server level needing to match and then like the sql server level needing to match there’s weird stuff involved there oh if you have i mean if you if you already have it paid for then yeah i’d probably move uh if you need to move to like like a net new environment i would use uh like log shipping or something i wouldn’t use mirroring in this case because you’re going from standard to enterprise and uh you know you obviously you already have an ag setup so that would be rather awkward to try and implement so um i i would i would say to just if you wanted to use log shipping and just uh get your current databases moved over to whatever new vm hardware fake hardware whatever virtual hardware uh you’re going to set up then that’s probably how i’d move things just to just to make the transition a bit more seamless and that’s assuming that you couldn’t you know set up another vm to you know get the ag also synchronizing to and then fail over to that and then fail over to whatever’s next and then destroy the old environment yeah that’s tough so uh at least he’s trying to simplify things so i don’t have so many ags to manage and check like when we reboot for us yeah that’s a bummer um you know that’s one of the reasons why you know i i asked the question again ah man all my all my all my solid gold material is still still on brent’s site but uh you know i i had a poster over there recently about like have ags gotten any easier and i think you know when it comes to stuff like patching and um you know so and even something like you know just doing uh like uh checking out indexes in an ag right so you know you have the stuff on the primary and you check like index metrics there and you know you can see that like i have a bunch of unused indexes but they get used on a secondary if you’re offloading reads so yeah you know there’s still a lot of stuff that’s tough about ags and patching is certainly one of those very perilous things because with ags you know in particular like there are a ton of patches i mean there are a ton of fixes in each patch specifically for ag stuff and ag patches have been known to break stuff too so it’s like you’re very perilous you know it’s like whatever i’d say whatever you get um whatever you what do we have for your ags make sure that you know when you do those patches you’re testing them in a lower environment first because boy howdy if one of those patches breaks something you have to uninstall a patch uninstalling a patch is my one of my least favorite things in the world because i always forget it’s the best way to i know there’s like there’s like a few ways to do it and there’s like one of them that’s like the best way to do it and i always forget which one it is yeah daren mentions you might be able to do a rolling upgrade if you can do a rolling upgrade great if you’re on like windows server 2012 or something though i don’t think you can do the you can’t do a rolling upgrade if you’re moving to like windows server 16 or 19 down the line so it would have to be at least 2016 just fun nothing but a good time with those ags who’s emailing me no i’m not talking to you don’t worry it wasn’t brent uh let’s see all right anyone else weird questions the audience has dwindled down to six now i feel bad i bored someone well i must have must have must have made someone sleepy all right well if no one has any other questions i’m gonna i’m gonna unlive this thing or try to figure out how oh there there’s a big red button that says end stream all right uh i’m gonna i’m gonna d live myself and go um i don’t know what i’m gonna do i’m gonna practice singing i guess anyway uh thanks everyone for joining me uh i had a good time i’ll see you next week i hope you know god willing and uh yeah thanks lee yes i’ll see you next week and uh go have fun this weekend do do stuff i wouldn’t do yes you have a good weekend too joe all right everyone take care bye

Going Further


If this is the kind of SQL Server stuff you love learning about, you’ll love my training. Blog readers get 25% off the Everything Bundle — over 100 hours of performance tuning content. Need hands-on help? I offer consulting engagements from targeted investigations to ongoing retainers. Want a quick sanity check before committing to a full engagement? Schedule a call — no commitment required.

Last Week’s Almost Definitely Not Office Hours: January 18


 

Video Summary

In this video, I dive into some complex topics related to SQL Server performance tuning and parameter sniffing. Starting off, I address the nuances of parameter sniffing by discussing scenarios where a stored procedure might generate either a big plan or a small one, and how keeping the big plan can serve as a temporary fix. However, I emphasize that this approach needs careful testing to ensure it doesn’t cause issues in highly concurrent environments. Moving on, we explore resource governor and its limitations, suggesting it should be renamed “query thought throttler” due to its tendency to negatively impact performance. The conversation then shifts towards the challenges of intelligent query processing, particularly parameter sniffing, and how improvements could lead to more adaptive plans based on varying parameters passed into stored procedures.

Full Transcript

A

All right, so, uh, look at this. Ready? Yeah, yeah.
Do, do, do, do, do, do, do. Mm-hmm. Mm-hmm.
Mm-hmm. Mm-hmm. Mm-hmm.
Mm-hmm. Mm-hmm. Hello, hello, hello.
Hello, hello, hello. Hello, maybe. Weed.
Weed. It’s working, I think, kind of. It turns out scheduling these things is a lot harder. Or, like, starting up these things when they’re scheduled is a lot harder than just starting one up.
I have to do weird, odd, uncomfortable things to get this started up when I schedule them. So I think from now on, I’m just going to last minute go live. I’m just going to give whatever.
There are four of you in here, huh? We got a link to this one because the other one’s dead. That’s fun.
Happy Friday. Friday. Dancing on Twitter.
Did I promise dancing on Twitter? I forget. Now I’m too hungover to dance. I might yak on you if I start dancing. Sorry, Peter.
I apologize. So I have spent my morning messing with, oh, I had to set up an AWS account and stuff. And I had to upload the, oh, private dancing.
Yes. Well, there are six people in here, so it wouldn’t be very private. So I had to spin up an AWS account and set up an S3 bucket with permissions and all sorts of other goofy stuff this morning on top of trying to rattle off some blog posts and whatever before the weekend.
It’s going to be fun. It’s going to be a fun time. Of course I set up I am.
I followed Amazon’s best practices in that regard because leaving the root user is the only user seemed like a terrible idea. I did have a, actually it was kind of funny because I had to create a public bucket. And for a while it just kept saying like access denied every time I tried to make my public bucket public.
And the more I say public bucket, the more I regret saying public bucket. But yeah, it kept saying access denied. And it turned out that I had to like allow the making of, I had to allow making public buckets public, which is a weird thing to have to do first.
Like it should say that like this, like this bucket does not allow, is not allowed to go public. It’s goofy. Yeah, I have, I have a bunch of I am users now to confuse hackers.
So like they’ll get in, they’ll think they can do something, but they really can’t. It’s like dozens of, dozens of I am users that will lead them nowhere. Yeah, it was weird.
Like, cause I want to be able to share slides and stuff at the bits pre con and other training stuff that I’m doing. So I needed to have like a bucket that everyone could just freely download from, but not do anything else from. So, uh, there it is.
I don’t want to use Dropbox for that because, oh, I don’t know. I suppose there’s a reason. I don’t really know what it is.
Now that I got this fancy business Dropbox account, I don’t know. I don’t know. I just don’t know anymore. Man, I don’t know what other fun things have happened since last week.
I got business insurance. I got contracts from lawyers. I made, I had, I sent out my first invoice.
I don’t know. It’s been an okay week. It wasn’t a very big invoice. I probably haven’t made that little money in a week since. I don’t know.
Uh, I would say, I’d say when I, when I should have been in college. And I don’t know. It’s been an okay week. Uh, I feel like you got a lot of the, a lot of stuff figured out in here that was, that was kind of up in the air and unsure last, last Friday.
All right. There are five of you, but no one’s asking questions. So this might be quick. Like, I’ll give it another couple minutes, but then, then I have to go back to doing, well, I guess being unemployed.
Doing, doing my work. This woman’s work. It’s a good Kate Bush song. I wish that this thing would show me the list of users so that I could, like, why is there no list of users?
There we go. Oh, it’s just me and one of the, who are the other, who are the other people in here then? That’s ridiculous.
Yes. Josh is here. Thank you, Josh.
I guess, I guess, I guess by participant, it means people who have actively said something and not people who, um, I don’t know. I actually don’t even know. I don’t know.
I don’t understand this thing anymore. I seem to have, seem to have lost all touch with reality. If no dancing, what about whiskey? Uh, I have to go to the gym later.
Stupid. So, uh, I don’t think I’m going to start drinking whiskey this early. Uh, Peter asks, your post on fragment, or I guess says, your post on fragmentation was timely for frustrating reasons.
Trying to make the best of it, but would you say it’s worth my time to dig into fragmentation intervals? Uh, what do you mean fragmentation intervals? Like how often you run defrags or how often things become fragmented?
Or what exactly is a fragmentation interval? Not sure. Yeah. Not sure what that means. Internals.
Oh, no. Uh, I wouldn’t, I wouldn’t touch that. I don’t think it’s, I don’t think it’s really worth the effort. Um, you know, I, I remember, uh, every time I opened an internals book, I think the first, like, three or four chapters were just, like, like, uh, like a filler waste of time on, like, how things are stored.
And it’s good stuff to, like, know once or, like, you know, know, like, a little bit and then just kind of tuck away. But I don’t think it’s ever helped me solve much of a, um, much of a performance problem on a server.
It’s always one of those things where it’s just like, yes, it’s very neat to know that there are 8K pages and they get stored on extents. They get stored in data files and data files have these games and S games and PFS pages and all this other stuff.
But it’s not, I never, like, looked at that and went, oh, well, that’s why this query is slow. Because, um, this just never happened. It’s always been some other, like, you know, uh, well, sometimes basic reason.
Other times it’s more fun. I think, um, Adam Mechanic has one of my absolute favorite talks and it’s called, like, like, it’s like the five things that cause 95% of your query performance problems.
So it’s on YouTube too. You can find it if you look for Adam Mechanic videos on here. But, um, it, I think the, the real wisdom in there is that it usually is, uh, just one of, like, you know, one of a few really basic things that, uh, often causes the majority of performance issues and once you get outside of those things, that’s when, like, the really interesting stuff comes in.
Like, I’m gonna, I’m gonna write a blog post today, I think, about how when you, uh, it’s like when you write a query that will find data. Sometimes it’s a lot faster than a query that won’t find data.
Farah says, what monitoring tool do you wish existed but doesn’t? I don’t know. I guess mine. Uh, so the kind of interesting thing about, uh, not working for Brent anymore is, uh, you know, a lot of the work that I put into the first responder kit is now kind of, uh, I mean, I mean, it’s not off limits, but it’s, uh, you know, a bit awkward to go back to at this point.
So, uh, I’m, you know, gonna have to do some of my own stuff around that. Uh, as far as stuff that I wish, like, stuff that I, you know, stuff that I wish monitoring tools did that I don’t think exists very well is, uh, correlating, uh, or, like, capturing relevant details of, you know, um, catastrophic events.
And I don’t mean catastrophic, like, the server crashed or the server, like, failed over or something. I mean, like, you hit thread pool or, like, resource semaphore or, like, you know, just CPU pegged up to 100%.
I wish that when that stuff happened, there would be, like, this emergency mode for monitoring tools where they were just, like, like, like, like, okay, like, this crazy thing is happening. We need to focus on, like, these few things instead of just running the same dumb queries and be like, oh, 10TBs might be funny.
You know, like, stop looking at, you know, disk activity and just be like, no, we need to focus on this. Like, we need to, like, really zoom in on, uh, what’s happening there instead of, like, running the, like, like, like goofball template queries that kind of keep doing.
I’m flipping around, looking at stuff. Chris is on Twitter saying he’s watching. Why don’t you ask a question, Chris?
That would be really helpful. I don’t have anything to talk about. Oh, boy. Josh says, I have a parameter sniffing question from the Master Inquiry Tuning class that you maybe worked on.
Wow. Wow. Okay. How, you can ask me a very general parameter sniffing question, and maybe I’ll be able to answer that. Because if I have a stored proc that either gets a big plan, meaning parallel big memory grant, or a small plan, should I try to keep the big plan to avoid the small plan spilling?
Um, I think that that’s a pretty good band-aid. Like, that’s a pretty good temporary fix. Because a lot of the time when the big plan runs, unless the big plan runs very concurrently, and those additional resources become a point of contention, either parallelism, either via parallelism you hit thread pool weights, or via the memory grants you wanted to restore a semaphore, then generally, yes, that’s a pretty good band-aid until you can dig deeper into maybe getting a good plan for all variations of the query.
But that can be really tough to do, especially when, uh, you know, stored procedures, you know, especially, like, you know, when you’re learning about parameters sniffing, a lot of the examples are just like a single parameter that gets passed in.
And, like, that single parameter can cause enough variation in a plan. But then you get to the real world, you get back to your job, and there’s, like, you know, 5, 10, 15, 20 different parameters that can get passed in.
And some of them can be null, and some of them can cause real problems. So, uh, you know, if you need to, like, quick fix parameter sniffing stuff, then sometimes, yeah, like, getting and keeping the big plan can, you know, be worthwhile.
But sometimes, um, you know, you really, you know, it’s, it’s, it can cause problems downstream if, if it’s a highly concurrent thing. So, like, what I would do is I would test, if I get that big plan, how many of it can I run at once, right?
So, like, you know, use, like, SQL query stress or O stress or something and just run the big plan and, like, like, add threads to it until you either, like, run out of worker threads and hit thread pool or you run out of memory available and hit restore semaphore.
So, I’d probably like to do one of those two things and then be like, all right, well, like, this is, like, the limit for how many of this query can run. And then think about, like, as far as your workload goes, like, do you have a bunch of other queries that might be running alongside it?
How many copies of this query can run? How many, like, other, these other queries might come along? You know, there’s a, there’s a, everyone, when they think about concurrency, they just think about kind of standard, like, locking and blocking on the server, right?
Where, uh, you know. They’re like, well, I can’t run, you know, like, three of these updates at once because they’ll block each other.
Or I can’t run this update and these other select queries because they’ll block each other, right? And that’s when people fall into no lock or, you know, uh, maybe the slightly smarter decision to use an optimistic isolation level.
But, uh, you know, like, I think the, the next step in learning about concurrency is really, like, um, you know, understanding that queries interact with each other and the hardware in very particular ways.
And that it’s very easy to, um, uh, you know, become very, like, I would say, non-concurrent, uh, when enough, uh, when enough queries run. Peter says, could you get fancy with resource governor?
So resource governor has some really interesting stuff, especially, I think, for memory grants. But it, it shouldn’t be called resource governor. It should be called query thought throttler because all it really does is, uh, you know, like limit the resources that a query can use.
And often that has some rather bad side effects on performance. Yeah. Parameter sifting is hard. Um, and it’s one of those things where, uh, out of all of, I think the intelligent query processing stuff that Microsoft has been working on, I really wish that parameter sniffing were, you know, coming to the forefront.
Uh, because I think that is like, as far as like, you know, if you want to think about intelligent query processing, uh, you know, it’s nice that you can switch join types and it’s nice that you get memory grant feedback between executions.
And it’s nice that, you know, some stuff has happened with functions and table variables coming up in 2019, but man, parameter sniffing is still, I think like the biggest problem. And if you wanted to really have intelligent query processing, being able to, um, you know, store, I think branch iterations of the plan, like make some different plan choices along the way for things.
If, uh, you know, depending on the parameters that get passed in, like, I don’t think you should have multiple copies of a plan, but I think you should have multiple iterations of a plan and that, uh, you know, you could, you could do more to say, well, you know, instead of just reusing one plan, we’ll reuse like one of three or five plans depending on what parameters get passed in.
Uh, so I think, I think that might be like a good next step for the intelligent query processing crew would be to do something like that. You know, uh, it is just, you know, something that like every time, well, back, back when, back when I had clients, back when I had clients, that was always a big problem for them.
Uh, what day is your SQL bits pre-con? Uh, boy, that’s a good question. Um, let me check.
My SQL bits pre-con is, oh, it’s, you know what, it’s on the SQL bits website. I’m an idiot. I don’t know why I didn’t just look there.
I think it’s, it’s, it’s the second day. Sessions, training days. Uh, yeah, mine is on Thursday. Total server performance tuning. So Thursday, February 29th.
The training days are Wednesday and Thursday. So, uh, mine, mine’ll be Thursday. And if you’re going on Wednesday, you should definitely go check out Aaron’s session because, uh, Aaron, I think has a really cool one.
And, uh, if, if, if you, if it turns out that mine is sold out, uh, I think Penal’s would be a good, good choice to go to as well. Okay.
So that’s fun, fun, fun, fun, right? Good stuff. Uh, let’s see here. Uh, Farrah says, what were the most common query performance problems you ran across as a consultant? Were they mostly sniffing?
Uh, so I, I would say a lot of them would, a lot of them were parameter sniffing. Uh, other ones that were quite common were, were around indexing where it was either a general lack of indexing or a general, like abundance of indexing.
Like, none of the indexes, like someone added a lot of indexes a long time ago and just never revisited them. And it’s like code changed, queries changed, you know, uh, the way the app worked changed. No one ever revisited the indexes.
And we’re like, Oh, cool. Like we could, we could get rid of these five indexes that are somehow on the same single column over and over again. And we could like, you know, maybe add some other indexes. It’ll help the queries that we’re running today.
All right. So that, those are, those are very common. Um, stuff with functions was always very common. Uh, people selecting a lot of, or a lot more data. Actually, there were a number of really funny incidents where, uh, you would see, be like, people would be like, Oh, you know, we have this, you know, this query, these queries that run and they populate like, like an Excel file or a dashboard or something.
And they would just be like select star with nowhere clause. And you’d just be like, well, you know, you can limit the data that goes there because they would get it all into the application. And then people would do it like with the data that landed in the application.
That was very fun. Uh, Mr. Sick asks, did you get to keep that home, home server? I built. Yes, I did get to keep that. Uh, Brent was very nice about the things that I was allowed to keep, uh, in the layoffs, including, um, you know, a lot of the, the training material that I had worked on there.
I get to, um, you know, do, do my own thing with, because I mean, obviously I don’t, I mean, I don’t think Brent, I would imagine Brent wants to write his own material. Most of it, or he could, you know, he could, he could write, uh, things in a different way than I do. So I got to take the stuff that I worked on.
Um, and I will be using that for various stuff. Uh, I don’t know if it’s, I don’t know if it’s totally NDA. I don’t think it’s NDA anymore, but, uh, my, I put in an application to, uh, do videos with Pluralsight. And it was accepted and I’m just working on getting, you know, hooked up with someone over there.
And I’m going to be producing a couple courses for them, uh, at least, uh, fairly immediately. And then, you know, talk about some additional courses that I might do for them. Because it’s, you know, uh, I think, I think Pluralsight’s a pretty cool, uh, platform for that.
But, and, you know, as much as I would love to say, hey, like, I could, you know, like set up a, you know, whole video training thing the way, the way Brent has, um, I, that’s like a little bit beyond the scope of what I can do, uh, do, do quickly. So, you know, I’m going to say I’m going to do the Pluralsight thing for, uh, the foreseeable future. And then if, um, you know, that goes well, or if, you know, the, the consulting and training thing, uh, takes off in an appreciable way, then I’ll try to put in some plumbing to do, uh, videos through my own site.
Uh, oh, thank you, Mr. Sick. I’m excited to, uh, you know, I mean, I’m not excited to be unemployed, but I am excited to be able to do, be free to kind of, you know, uh, you know, shape my own stuff the way, the way I want to, uh, you know, that is kind of, that is a nice freedom to have. But we’ll, we’ll see how it goes.
I mean, I’m not, I’m not, I don’t think I’m going to become a suit and tie man anytime soon, but, uh, you know. So, uh, stuff like that is stuff like that is hard to forecast, uh, especially in January when there is not a whole heck of a lot of work. I’ve, I’ve been like, sort of like, just like, you know, talking to some other people who do independent consulting and I’m like, so how’s your January going?
And they’re like, we thumb twiddling. It’s like nothing doing. I don’t feel too bad.
I don’t feel like I’ve messed anything up yet, but, uh, I’m just waiting for, waiting for, uh, waiting for January to thaw out a little bit. So I, you know, maybe get some more action over on my end. It would be, it would be nice to, uh, have a positive income stream by February.
That would be a little, maybe a lofty goal, but it’s one that I’m going to go with. I don’t know. Who else?
Anyone else have anything? Anyone? Anyone? Anyone? Anyone? We could, you could have a, I have a brief discussion on what I should name the, the, the scripts that I work on. Obviously Blitz is taken.
So, uh, we’ll just call it SP Eric and maybe it’ll crash your server and maybe it won’t. Maybe it’ll run DBCC write page. Maybe, uh, I don’t know.
Maybe it’ll just change weird settings. I don’t know yet. We’ll see. I have, I’ve, uh, I remember at the DBA days that we wrote a chaos sloth or I wrote a chaos sloth script and it was pretty fun. And then it would go through and change weird settings.
It would change like max stop and cost threshold and max memory and some other stuff. And, uh, I always thought, man, it’d be fun to have one that did more stuff like, like, like change, like, like bigger settings or like restart SQL or something like that.
Or like, you know, just do crazy stuff. Like, you know, use like XP command shell or, uh, something else to like, you know, turn off the network or whatever. Yeah.
Random trace flags, but you’ll, you’ll have to send me your list of random trace flags. If you want me to do that for us, because you’ve, you’ve got a better list than I do. I have like, I have like a, uh, like a markdown file with a few found helpful over the years, but I don’t, I’m not. I’m not good at keeping track of all of the trace flags.
So you’ll have to send me your list of ones that would be especially nefarious to turn on and off. Tech news says, hello from India. Hello, tech news.
Uh, I am not in India, though. I wish I was because the food is wonderful. I think that’s about my favorite food in the world. So you’re thinking, thinking about other stuff that that script could do.
I don’t know. It’s like drop indexes. Where am I from? I am from America. I think sometimes. I’ve been to Canada a few times.
It’s pretty nice there. Kevin says, when query tuning, it’s easy to force a query to use a particular index, uh, using hints. But sometimes I want to see what the index optimizer would choose if the index it has chosen wasn’t there.
But I don’t want to disable the index because it could be large and take too long to rebuild. I wish there was a hint that allowed it to specify an index not to use. Oh, interesting.
So, uh, good news and bad news. When you specify indexes, when you specify indexes, you can actually give a list of indexes that you want it to use. Uh, I wrote the post over on Brent’s site a while back.
Um, let me see if I can find it quickly. With one of the bad idea, bad idea jeans posts. And as long as Brent’s sites up, you can do this.
There we go. Look at that. First try. It’s amazing the way that works. I’m going to stick that into chat. Um, so you can actually, you can specify multiple indexes for a query to use. So if you know, like, the names or the IDs of all the indexes that, you know, you’re okay with the optimizer having a choice of, and, you know, which ones you don’t want it to look at, is that you can specify all the ones that you say, like, are interested in seeing more from, seeing it choose from, and then not, like, not specify the ones that you don’t want to see.
So that’s one way to do it. I know it’s not the greatest thing in the world. Like, it would be much easier to say, no, just don’t use this one, rather than maybe you can use all of these.
But it could be worse. You could have absolutely no options there. That might be. I mean, the other thing is, well, I guess on a dev server, it still might be just as annoying. I don’t have a better idea on that, aside from the fact that you can specify all of the possible indexes that might be a yes, rather than specifying one that might be a no.
You know, I try to know a thing or two. I think that’s the whole point of consulting, is to know a thing or two. So sometimes, you know, like, actually, there are times when people, like, say something that’s so wrong, it makes me question whether I know what I’m talking about or not.
And that’s always a frightening moment, because in my head, I’m like, no, no, that’s wrong. And I know it’s wrong. And I know the right answer.
But, man, you are so convinced about this wrong thing that I’m trying to, like, doubt my own sanity. I’m like, I don’t know what to do right now. I’m, like, trying to, like, you know, like, low-key Google stuff and be like, this is right.
There’s no way this can be right. There’s no way. And, yeah, it’s always weird. It’s like brief losses of confidence when you’re like, wow, this person is so spectacularly wrong. They are making me question, like, things that I’ve known for a decade or things that, you know, I’ve, like, tested myself and looked at.
I’m like, what on earth? How could you do that? All right.
Any other questions? You funny, peanutty people? There are significantly fewer people here this week. There were 22 last week. But, you know, maybe that was, like, beginner’s luck. Now I’m down to eight people.
You will only do SQL types? Yeah, that’s all I really know about. I don’t know about C Sharp or anything else. So, unfortunately, I wish I knew more stuff.
I’m terrible at PowerShell. I don’t know. What else? What else is there? I mean, I can talk about hardware a little bit. I like hardware.
Things like that. Windabug. Yeah. Except you’re better at windbag than I am, Forrest. So, I don’t know why you’d want me to talk about it.
You have cracked some nuts in there that I haven’t been able to. What am I doing? Good question.
What am I doing? I think I’m actually going to go get lunch. Because there are very sparse questions. So, thank you for joining me. It was a fun-filled half hour of trying to figure out how to get this thing to work. I will most likely be back next week with another one.
We’ll see. Maybe. Maybe not. Anyway. Thank you. And see you next time. Bye. Bye.
Thank you.

Open Office Hours, Or Something

Just Like Last Week


I’ll be on YouTube Friday at Noon EST, answering your questions about life, love, SQL Server, and fashion choices.

This time with 33% less potato.

Last week I was a victim of “how hard can this be?”, only to find out that I needed to download an encoder and figure out how to use it to broadcast.

Which is weird, because when I did a dry run, the website seemed to pick up on all the hardware stuff. Ah well. I’m still working on the single channel audio thing, which is apparently something that a lot of people with my setup have. Which solution will work?

TUNE IN TO FIND OUT!

If you wanna watch last week’s episode catch it here!

Thanks for reading!

Going Further


If this is the kind of SQL Server stuff you love learning about, you’ll love my training. Blog readers get 25% off the Everything Bundle — over 100 hours of performance tuning content. Need hands-on help? I offer consulting engagements from targeted investigations to ongoing retainers. Want a quick sanity check before committing to a full engagement? Schedule a call — no commitment required.