Posts by Erik Darling

Implicit vs. Explicit Conversion

SQL Server
10 Comments
Everyone knows Implicit Conversion is bad It can ruin SARGability, defeat index usage, and burn up your CPU like it needs some Valtrex. But what about explicit conversion? Is there any overhead? Turns out, SQL is just as happy with explicit conversion as it is with passing in the correct datatype in the first place.…
Read More

RAM and Sympathy

With the release date for 2016 finally announced Everyone can start gearing up to gaze upon its far shores from the 2008R2 instance they can’t or won’t upgrade for various reasons. I’m excited for a lot of the improvements and enhancements coming along, and generally hope I’m wrong about customer adoption. One annoyance with the…
Read More

Where Clauses and Empty Tables

SQL Server
3 Comments
Sometimes SQL is the presentation layer And when it is, you end up doing a lot of concatenating. This isn’t about performance, or trying to talk you out of SQL as the presentation layer, this is just something you should keep in mind. SQL is a confusing language when you’re just starting out. Heck, sometimes…
Read More

Stats Week: Messin’ With Statistics

SQL Server, Statistics
7 Comments
If there’s one thing living in Texas has taught me It’s that people are very paranoid that you may Mess With it. Even in Austin, where the citizenry demand weirdness, they are vehemently opposed to any form of Messing, unless it results in mayonnaise-based dipping sauce. Me? I like Messing With stuff. Today we’re going…
Read More

Stats Week: Do Query Predicates Affect Histogram Step Creation?

Auto Create Statistics is your friend It’s not perfect, but 99% of the time I’d rather have imperfect statistics than no statistics. This question struck me as interesting, because the optimizer will totally sniff parameters to compile an initial plan. If you don’t have index statistics, or system statistics already on a column in a…
Read More

Stats Week: Statistics Terminology Cheatsheet

SQL Server
7 Comments
These things used to confuse me so much Despite having worked at a Market Research company for a while, I know nothing about statistics, other than that project managers have all sorts of disagreeably subjective phrases for describing them. Vast majority, convincing plurality, dwindling minority, et al. Less talky, more picture. When I started getting…
Read More

Old and Busted: DBCC Commands in 2016

SQL Server
3 Comments
I hate DBCC Commands Not what they do, just that the syntax isn’t consistent (do I need quotes around this string or not?), the results are a distraction to get into a usable table, and you need to write absurd loops to perform object-at-a-time data gathering. I’m not talking about running DBCC CHECKDB (necessarily), or…
Read More

ISNULL vs. COALESCE: What The XML?

SQL Server
14 Comments
This isn’t about performance If you’re interested in performance tests, you can get in the way back machine and read a couple posts by Adam Machanic here and here. I’m also not talking about the difference between them. There are a million articles about that. They’re obviously different, but how does SQL handle that internally?…
Read More

Indexes Helping Indexes

Indexing, SQL Server
20 Comments
This post isn’t going to solve any problems for you It was just something I stumbled on that struck me as funny, while working on a demo for something else. Brent didn’t believe it at first, so I thought I’d share with the class. Blog. You, Your Name Here. Hiya! So there I was, creating…
Read More

Make Extended Events Great… Finally

SQL Server
13 Comments
SQL Server 2016 is adding some really awesome stuff Not the least of which is a ton of super cool information in execution plans, and an Extended Events session to expose the same information for all queries. The details are detailed in detail over on this blog post from MS. For those of you with…
Read More