Posts by Erik Darling

The Curse of Cursor Options

Red Skies At Night I know it’s hard to believe, but I still see a lot of people using cursors when they shouldn’t. Other times, there’s some scary dungeon part of the code that someone wrote eons ago that no one wants to go anywhere near to fix. Sometimes there’s a decent reason, something like:…
Read More

SUM, AVG, and arithmetic overflow

You Shoulda Brought A Bigger Int Sometimes you run a query, and everything goes fine. For a while. For example, if I run this query in the 2010 copy of Stack Overflow, it finishes pretty quickly, and without error. Transact-SQL SELECT u.Id, u.DisplayName, SUM(p.Score) AS SumPostScore, AVG(c.Score) AS SumCommentScore FROM dbo.Users AS u JOIN dbo.Posts…
Read More

Skewing Parallelism For Fun And Profit

What Is Skewed Parallelism? When queries go parallel, some assumptions get made: There’s enough work to keep multiple threads busy Each thread will get an equal amount of work to do The ‘equal amount of work’ part is particularly important, because in a parallel plan, each thread gets an equal share of memory up front.…
Read More
Pocket Square

First Responder Kit Release: Fingers Crossed!

This is a small release just to make sure you don’t forget about us. We know you’re busy. You can download the updated FirstResponderKit.zip here. sp_Blitz Improvements #1755 – @MisterZeus added a new check for alerts that don’t send information out. I mean, is that even an alert? #1766 – @jadarnel27 added some code to help folks who have a standard (non-sa)…
Read More

One Hundred Percent CPU

Raise Your Hand If You’ve ever wanted to play a prank on your co-workers, but just didn’t have a any ideas that didn’t involve exploding Hot Pockets. Now you have something even less safe than molten cheese squirts! A stored procedure that pushes CPUs to 100%. All of’em. Transact-SQL CREATE OR ALTER PROCEDURE dbo._keep_it_100 AS…
Read More

Announcing SQL Server 2019

TEASE Who Let The Docs Out? Ignite must be coming up. If you head over to Microsoft’s GitHub repo, you can peruse around for stuff updated recently. Maybe you’ll create an account. Maybe you’ll start contributing to open source projects. Maybe you’ll quietly slip into a world of solitude for days on end. Happy Saturday!…
Read More
Menu
{"cart_token":"","hash":"","cart_data":""}