How can a table with 0 records use so much space?

Just like that puppy you got during the pandemic, your databases hunger for more. And they grow. And occasionally make a mess. I’ll stop the analogy.

Anyhow, it’s worthwhile to occasionally review the tables in a database to see which ones are growing every day, using the most space.

But what if during a review you see the largest table looks like this?

That’s around 24 GB of sweet drive space allocated for 0 records. But…how?

Let me show you how.

Continue reading

How to get Change Data Capture to work in an Availability Group

If you’ve ever had to implement Change Data Capture (CDC) for a database in an Availability Group, then you know that the CDC jobs don’t really consider the Availability Group. The capture and cleanup jobs created are set up as if the database exists only on a single instance.

And that’s a problem, because I would guess quite lot of databases are in Availability Groups. Maybe even some of yours. If you have this issue, I’ve put together a step-by-step solution in this post.

I know this post is a little long compared to others here, but I’ve tried to be thorough to save you headaches.

Continue reading

sp_GetRowcount: How to count the number of rows in any SQL Server table fast

Have you ever had to find the number of rows in a user table, and then wrote a little “SELECT COUNT(*) FROM tblWhatever” and hit execute…and waited…and waited…and waited some more? And then started wondering what was going on?

If so, this post is for you.

Let me explain the problem, and then give you a reusable solution. Consider this a turning point in your career.

Continue reading

What permissions are required for temporary tables?

Managing permissions is a constant issue for Database Administrators, but rarely do DBAs consider permissions for tempdb. Everybody’s looking for something, but how often do you get requests for “access to read and write in the tempdb database”? Like…never?

OK, but what if you were asked the subject of this post in a job interview? Even if you’ve worked with SQL Server for ages, would you know how to answer this? Moreover, would you know why the answer should give you some concern?

Hold your head up, because I’ll start answering these questions now.

Continue reading

TempDB configuration for people in a hurry

If you’ve ever had to play administrator to a SQL Server instance, you’ve probably had to deal with TempDB data or log files that have grown unexpectedly. I know a lot of folks have had to do this, because the most read post on this site is “Help! My tempdb database won’t shrink!

Consider it a right of passage of sorts. Also, consider that it might be entirely avoidable. Let me show you.

Continue reading

T-SQL Tuesday #131 – Database Analogies

This image has an empty alt attribute; its file name is tsql2sday150x150.jpg

This post is for the most recent #tsql2sday, a monthly exercise where a topic is proposed by a community member and everyone is invited to post their thoughts on the subject. This month Rob Volk has asked us “how would you explain database concepts to someone who’s not technologically savvy,” or relatedly, “explain databases like I’m five!”

I’m very excited to participate this month, because, as anyone who has seen my “Faster Transactions” presentation recently knows, I love using the analogy of SQL Server transactions as orders in a restaurant.

Let me tell you briefly about the “Le SQL Server” restaurant.

Continue reading

Online certification exams are definitely different

As you can tell from previous posts, I’ve taken a few Microsoft Certification exams here in 2020. As you may have also heard, there’s been this Coronavirus pandemic happening at the same time, which means any such exam taken since mid-March of this year has to be done online and not in the comfort of a test taking center.

I’ve taken four of these exams so far this year from the comfort of my home. It’s definitely different from taking an exam at a testing center. If you’re interested in learning a bit more, click on through.

Continue reading

How I passed the 70-762 certification exam

According to the myriad of statistics used to track such things, the post “How I passed the 70-761 certification exam” has been one of the most popular on this site in recent months. If this means folks are studying for that exam, then I thought I’d post a similar post for 70-762 since I passed that one as well.

This exam was originally scheduled for retirement at the end of June, but now you can attempt this certification until January 31, 2021.

If you’re motivated to study for this exam, let me share a bit to try to help you.

Continue reading