SQL Server

Database Connection Hazards with Entity Framework

SQL Server
23 Comments
I recently came across a curious case where a SQL Server was suffering a number of long-running queries coming from an application written in Entity Framework. When I measured the average query execution times, I got some unexpected results: CPU time: 12 milliseconds Reads: 273 Elapsed time: 6800 milliseconds Wait, what? Looking at the wait stats…
Read More

Logical Query Processing

You can’t do that on management studio Recently, while working with a client, I did something in a query that they were mystified by. I didn’t think much of it, but I thought it might be useful to you, dear readers, as well. Along with an explanation. Here’s a sample query that takes advantage of…
Read More
Creating a branch in the GitHub client for Windows

Pull Request 101 for DBAs Using GitHub

SQL Server
8 Comments
I’ve worked with source control quite a bit over the years — everything from ye olde Visual Source Safe to Subversion to TFS. I even supported the Source Depot system at Microsoft as an engineer for a year back in the day! These days I don’t use source control a ton. We keep repositories of…
Read More

The sp_rename follies

SQL Server
28 Comments
Before we get started… I know. I know. BOL. It’s documented. They even show you how to rename a table. Thanks, sp_rename! But sometimes… You just forget. And as with most simple mistakes, fixing them is… Weird. Here’s what happened to me recently, when I was working on a table swapping demo. Transact-SQL CREATE TABLE…
Read More

Three Easy Tweaks to Tune Up Your SQL Server

SQL Server
18 Comments
I’ve been doing SQL Critical Care® work with clients for over a year now. It’s absolutely true that every client’s situation is different and needs special attention. However, I’ve found that there’s a short list of issues that nearly all clients have in common. Drawing from that list, here are the top three high-impact, low-effort areas you can work…
Read More

Want us to run training classes at your office?

SQL Server
0
You’re working with SQL Server, and you really want to learn how to make it faster and more reliable, but your boss just won’t let you go off to our upcoming training classes. Good news – we’ll bring the training to you. Just download our training catalog PDF and choose from modules on how to diagnose…
Read More

Indexing for GROUP BY

Indexing, SQL Server
9 Comments
It’s not glamorous And on your list of things that aren’t going fast enough, it’s probably pretty low. But you can get some pretty dramatic gains from indexes that cover columns you’re performing aggregations on. We’ll take a quick walk down demo lane in a moment, using the Stack Overflow database. Query outta nowhere! Transact-SQL…
Read More

New Updates for sp_Blitz®, sp_BlitzCache™

SQL Server
24 Comments
We’ve just updated our First Responder Kit to include new versions of these tools: sp_Blitz® v41 – June 18, 2015: Added check 162 for CMEMTHREAD waits on servers with >= 8 logical processors per NUMA node. Added check 159 for NUMA nodes reporting dangerously low memory in sys.dm_os_nodes. Added check 161 for a high number of cached…
Read More

Indexing for Windowing Functions

Indexing, SQL Server, T-SQL
6 Comments
Hooray Windowing Functions They do stuff that used to be hard to do, or took weird self-joins or correlated sub-queries with triangular joins to accomplish. That’s when there’s a standalone inequality predicate, usually for getting a running total. With Windowing Functions, a lot of the code complexity and inefficiency is taken out of the picture,…
Read More