The Bit Bucket

Data Tales 3: The case of the stubborn log file

This is the third tale in a series of stories about data. I hope you enjoy the series.

Anyone who has worked with SQL Server for any length of time knows the common errors that happen. Before a new user even completes their question, you often know how it’s going to end.

One of those questions is always about database log files that keep growing and growing until they fill all available disk space. Sound familiar? We’ve all heard about that one and most of us would have a straightforward checklist for what to look for.

2025-09-07

SSMS Tips and Tricks 6-2: Viewing missing index details

I’ve mentioned before that SSMS is a good tool for analyzing queries, as much as for executing them.

Way back in SQL Server 2005, query plans had missing index details added. When a query plan was created, SQL Server recorded that it thought it could have executed the query better, if only you’d provided it with appropriate indexes. But at that point, the suggestions weren’t very good, and the tools didn’t show them.

2025-09-06

SQL Interview: 76 Performance of temporary tables vs table variables

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database.

Section: Administration Level: Medium

Question:

Are there situations where temporary tables will perform better than table variables?

What could cause that?

Answer:

Temporary tables have two properties that are not available to table variables:

  • Indexes - with table variables, you can have primary key constraints and unique key constraints, but not other indexes
  • Statistics - temporary tables support rich statistics, similar to tables where table variables have very limited statistics, mostly just cardinality.

2025-09-05

SSMS Tips and Tricks 6-1: Comparing query plans

One of the advantages of SSMS is that it can be used to analyze queries, not just to execute them.

There are two basic types of query plan: estimated execution plans, and actual execution plans.

For a typical query, I can obtain the estimated execution plan, by hitting Ctrl-L, choosing the option in the Query menu, or clicking on the toolbar icon:

Let’s do this for the following query:

2025-09-04

Data Tales 2: The case of the exploding table

This is the second tale in a series of stories about data. I hope you enjoy the series.

I was recently at a customer site where the developers were very concerned about the impact of adding columns to a table. They told me that when they added a new column that their deployment code was timing out and the database was massively increasing in size.

The table had increased from around a small size to well over 50GB during the single operation. The deployment operation involved adding the column and writing one row to a deployment history table. Because they were only writing a single new row, they were blaming SQL Server for bloating the database size when a column was added.

2025-09-03

SSMS Tips and Tricks 5-8: Turning off completion times

I’ve had many developers ask me how can I turn off those annoying completion time messages in SSMS?.

A while back, the product team decided that we’d all like completion times shown in the Messages output tab. I don’t share their enthusiasm for them.

For a start, a completion time was already shown here in the Properties window for the query, along with much more info:

So, for me, it really was quite irrelevant. Worse, I often use the output of the Messages tab as text for scripts, etc. The last thing I wanted were a bunch of completion times sprinkled through those.

2025-09-02

SQL Interview: 75 Boolean logic with NULLs

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database.

Section: Development Level: Intro

Question:

In the following WHERE clause, both AColumn and AnotherColumn are NULL.

WHERE AColumn = AnotherColumn

What is the effect of the WHERE clause?

Answer:

In SQL boolean logic, the expression NULL = NULL returns NULL and not True. So the WHERE clause would exclude the rows.

2025-09-01

SSMS Tips and Tricks 5-7: Viewing queries and results in separate tabs

In SSMS, query results are normally shown at the bottom of the query window.

This can greatly reduce the screen real estate both for the query, and for viewing the results.

In Tools, Options, Query Results, SQL Server, Results to Grid, there is an option to Display results in a separate tab. This can be very useful and generally you will also want to choose the extra option to Switch to results tab after the query executes.

2025-08-31

Data Tales 1: The case of the auto-truncating data

This is the first tale in a series of stories about data. I hope you enjoy the series.

I have a number of clients that I spend a day or two with each month. I like this style of engagement as I get to know the staff and their systems over a period of time, can see the improvements that we make over time. The staff members also know that if they have issues that aren’t desperate, they can save them up for the days that I am onsite. When I arrived at one of these customer sites recently, several of the staff members had grins on their faces, and one told me that Terry (well let’s call him Terry anyway) had really broken something.

2025-08-30

SQL Server High Availability Online Course Released

Over the past few months, we’ve been updating and converting courses that we used to run in-person, to a full online and on-demand format. The latest course is on High Availability for SQL Server.

We’re pleased to announce that this course is now available. This is another course that we’ve had so many requests for. You can find details of it here:

SQL Server High Availability for Developers and DBAs

It’s time to keep your SQL Server running - no matter what !

2025-08-30