SQL Server

How to Query the StackExchange Databases

SQL Server
27 Comments
Update – October 2015 – You can download a Torrent of a database (rather than a data dump) now. Most of my demos involve my favorite demo database: Stack Overflow. The Stack Exchange folks are kind enough to make all of their data available via BitTorrent for Creative Commons usage as long as you properly attribute…
Read More

Careful Adding Indexes with Always On Availability Groups

In theory, you can add indexes online with SQL Server Enterprise Edition. In theory, with AlwaysOn Availability Groups, you can add and drop indexes on the primary replica whenever you want. In theory, you can perform read-only queries on the secondaries whenever you want, and nobody gets blocked. In practice, these things don’t always add…
Read More
A terrible execution plan featuring three sort operators.

Dynamic Sorting

SQL Server
36 Comments
While working on some DMV scripts, I came up with a lazy way to have a user definable sort order in the query that seemed like pure genius. I showed it to the team and they’d never seen anything like it before. The Situation Users like to be in control. They want to define custom…
Read More

Why Are You Still Using SQL Server 2005?

SQL Server
15 Comments
The year: 2005. What was happening with the Brent Ozar Unlimited® crew? I was working on the help desk for a small company while attending Fox Valley Tech College to earn my associate degree. I think I still wanted to go into programming at that point in time! I’d never been to a user group…
Read More

You Won the Tribal Awards With Us

Blogging, SQL Server
4 Comments
The Simple-Talk Tribal Award Winners are out, and we won in two categories – Blog of the Year for the Brent Ozar Team Blog, and me as the Person You’d Most Like to Have a Beer With. See, now we’re having a beer virtually. It’s almost like – no, it’s nothing like. We need real…
Read More

SQL Server DMVs that Lie

SQL Server
21 Comments
SQL Server has amazing instrumentation. Dynamic management views and functions give you great insight into what’s happening in your SQL Server and what’s slowing it down. Interpreting these views and functions takes a lot of time, but with practice and skill you can use them to become great at performance tuning. But nothing’s perfect. Some…
Read More

How to Cache Stored Procedure Results

SQL Server, T-SQL
23 Comments
Say you run an online store, and on each item’s page, you need to show related items that people purchased. Let’s take an Amazon page for my favorite rechargeable AA batteries: Frequently Bought Together In a perfect world, we would cache this data in the web/app tier – but back here in the real world,…
Read More

Meet Doug Lane (Video)

Company News, SQL Server
0
Our mysterious employee #2 – where did he come from? How did he get into SQL Server? What does he want to learn in his first year at work with us? The answers to those questions, and more, will reveal themselves in this webcast recording:
Read More

Q: Can High MaxDOP make a query SLOWER?

SQL Server
13 Comments
Answer: Yep, sometimes it can. I used to think that higher degrees of parallelism followed a law of diminishing returns– you could add more threads, but the benefits would taper off. But it’s a bit more complicated than that. Microsoft’s recommendation to be careful when setting maxdop to values over 8 is a warning worth heeding.…
Read More

Vote for yourself in the new Tribal Awards.

SQL Server
0
When you vote for us in Simple Talk’s new Tribal Awards, you’re voting for yourself. Best Free Script – sp_Blitz® – Sure, I started this all by myself a few years ago, but it’s grown into something huge. Scroll down through the change log and get a load of the dozens of contributors who have helped…
Read More

Always On Availability Groups, Backup Checksums, and Corruption

The latest version of sp_Blitz® alerts you if you haven’t been using the WITH CHECKSUM parameter on your backups. This parameter tells SQL Server to check the checksums on each page and alert if there’s corruption. But what about corrupt backups? Books Online says: NO_CHECKSUM – Explicitly disables the generation of backup checksums (and the validation…
Read More

Keep it Constrained

Indexing, SQL Server
8 Comments
SQL Server has this fancy feature called constraints. Database constraints are used to restrict the domain (the range of allowed values) of a given attribute. That’s just a funny way of saying: through a set of carefully crafted rules, we control the shape of our universe. Our Test Table We’re going to be testing with…
Read More

Interview with Me on SQL Server Radio

SQL Server
1 Comment
At SQL Rally Amsterdam, I sat down with Matan Yungman for a half-hour interview for the SQL Server Radio Podcast. The podcast is usually in Hebrew, but Matan was nice enough to let me stick with English, heh. Matan and I had a great time. He came with a list of really good questions, and he…
Read More