Category: Blog

  • Join Other Database Pros Coming to the Netherlands

    In a few weeks I’ll be heading to Amsterdam for a few events. I’ll be working for a day before a short train ride down to Utrecht, a place I’ve never been and am looking forward to visiting.

    It’s a packed week with PASS On Tour, the Redgate Summit, and Data Saturday Holland. If you live in the EU, this is an easy way to learn a lot about different aspects of databases, see what others are working on or concerned about, and network with fellow professionals.

    Plus it’s in the Netherlands. I’ve never been to Utrecht, but my wife and I love Amsterdam. In fact, she’s meeting me there and we’ll likely spend a few days before taking a holiday.

    The PASS On Tour and Redgate Summits in New York were great. Lots of interesting talks, good conversations and questions, and some fantastic networking. Looking forward to the same in the Netherlands.

    Register today and join me for a short week of database discussions in October.

  • In Memory of Andrew Clarke, AKA Phil Factor

    One of the parts of getting older that really sucks is I seem to attend more funerals than weddings. It’s a sad fact of file, and this was one of the reasons Andy Warren and I created SQL Memorial, to keep those we’ve known close to our hearts.

    In a few internal posts, and a few external ones, I keep seeing this picture:

    2025-09_0317

    It’s one I took in 2016 with a selfie stick I’d gotten just before my trip to Redgate. There are a lot of familiar faces in here, but this was the content team at that time with myself, Grant, Tony (far right) and Andrew somehow in the center.

    This is a memorable picture and likely taken after lunch when Tony, Andrew, and I had visited a pub somewhere in the Cambridge area. I will treasure those memories of us sitting together, chatting about various work or non-work topics and enjoying a break from the office. Those chaps were some of the few that would have a pint at lunch, and I was pleased to be invited along.

    My most fond memory of Andrew was on one of the Redgate outings, where we’d taken the entire Marketing department out for a day. I happened to be in Cambridge and we visited a small printing museum in a little town, we had to draw a self portrait, and here’s my incredibly poor effort:

    2025-09_0318

    The thing that struck me from that day was how Andrew was quite the Renaissance man. He was interested in everything, how technology worked, including the old printing presses. He delved into how books used to be produced and could give me an education of some of the historical aspects of both how to bind a book as well as the history of some famous books from ancient times.

    Perhaps one of the more interesting things we discussed was life in the country. Andrew had a small farm where he raised some crops and animals. He had an old water wheel he was refurbishing that would either produce power to grind crops into flour, or it would be retrofitted to produce electricity. He explained to me how this horizontal wheel in the river would be placed to capture energy.

    Over the years we had many chances to discuss various topics. He even came to PASS a few times, one of which I captured below. That’s Andrew on the left.

     

    2025-09_0315

    Of course, there’s never enough time with friends. Andrew lived an amazing and long life, but it sadly ended before any of us who knew him expected it.

    I feel lucky that I had the moments and memories with Andrew that I did.

  • A New Word: Anderance

    anderance – n. the awareness that your partner perceives the relationship from a totally different angle than you – spending years looking at a different face across the table, listening for cues in a different voice = an odd reminder that no matter how much you have in common, you’re still in love with different people.

    I often think of anderance since I spend a lot of time with my wife, in daily life, traveling, communicating with phones. I sometimes wonder why she sees things in my differently than I do. Maybe she sees more or less, maybe she has a different view of me than I do.

    I realize that who I think I am, and who she thinks I am are a bit different. Not a lot, but a bit.

    Probably the same for her.

    It’s been 30 years, and it’s still amazing. And I still learn things about her, about me, and about us.

    From the Dictionary of Obscure Sorrows

  • Sparse Columns Can Use More Space: #SQLNewBlogger

    I saw this as a question submitted at SQL Server Central, and wasn’t sure it was correct, but when I checked, I was surprised. If you choose to designate columns as sparse, but you have a lot of data, you can use more space.

    This post looks at how things are stored and the impact if much of your data isn’t null.

    Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers.

    Setting Up

    Let’s create a couple of tables that are the same, but with sparse columns for one of them.

    CREATE TABLE [dbo].[NoSparseColumnTest](
         [ID] [int] NOT NULL,
         [CustomerID] [int] NULL,
         [TrackingDate] [datetime] NULL,
         [SomeFlag] [tinyint] NULL,
         [aNumber] [numeric](38, 4) NULL,
      CONSTRAINT [NoSparseColumnsPK] PRIMARY KEY CLUSTERED 
    (
         [ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    CREATE TABLE [dbo].[SparseColumnTest](
         [ID] [int] NOT NULL,
         [CustomerID] [int] NULL,
         [TrackingDate] [datetime] SPARSE  NULL,
         [SomeFlag] [tinyint] SPARSE  NULL,
         [aNumber] [numeric](38, 4) SPARSE  NULL,
      CONSTRAINT [SparseColumnPK] PRIMARY KEY CLUSTERED 
    (
         [ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    
    

    Once we have these, I used claude to help me fill this with data. That’s coming in another post, but I uploaded the script here. This is for the SparseTable Test, where I replaced the select on line 59 with NULL values. In the NoSparse table, this selected random data.

    If I select data from the tables and count rows, I see 1,000,000 rows in each. However, the Sparse table is all NULL values in these columns.

    2025-09_0228

    Checking the Sizes

    I can use sp_spaceused to check sizes. The results of running this is below, but here is the summary

    • NoSparse Columns – 42MB and 168KB for the index
    • Sparse Columns – 16MB and 72KB for the index

    A good set of savings. Here is the raw data:

    2025-09_0229

    Adding Sparse Data

    I’m going to update 10% of the rows to be not null in different columns. Not 10% total, but a random 10% amongst all the columns. Again, Claude gave me a script to do this and I have run it. This is the SparseTest_UpdateData.sql in the zip file above.

    After running this, I have 900,000 nulls i the TRackingDate, as well as the other columns. You can see the counts below, and a sample of data.

    2025-09_0230

    If we re-run the size comparison, it’s changed. Now I have:

    • NoSparse Columns – 42MB and 168KB for the
      index
    • Sparse Columns – 33.7MB and 88KB for the index

    Not bad, and still savings.

    Let’s re-run the update script and aim not for 10% updates, but 65% updates. This gets me to only 315k NULL values in the tables, or a little over 70% of my sparse columns are full of data. My sizes now are:

    • NoSparse Columns – 42MB and 168KB for the
      index
    • Sparse Columns – 67MB and 192KB for the index

    My sparse columns now use more space than my regular columns.

    Beware of using the sparse option unless you truly have sparse data. I didn’t test to find out where the tipping point it, but I’d hope it was less than 50% of data being populated.

    SQL New Blogger

    This is another post in my series that tries to inspire you to blog. It’s a simple post looking at a concept that not a lot of people might get, but which might trigger a question in an interview. That’s why you blog. You can share knowledge, but you build your brand and get interviewers to ask you questions about your blog.

    This post took a little longer, about 30 minutes to write, though the AI made it go quicker to actually generate the data for my tables. There were a few errors, which I’ll document, but pasting in the error got the GenAI to fix things.

    This post showed me testing something I was wondering about. In a quick set of tests, I learned that I need to be careful if I use a sparse option. You could showcase this and update in 10% increments (or less) and keep testing sizes until you find when there is a tipping point. Bonus if you use a column from an actual table in your system.

    https://learn.microsoft.com/en-us/sql/relational-databases/tables/use-sparse-columns?view=sql-server-ver17