Survey: Light or Dark

This week I am continuing with the simple survey series. Today my question is, do you prefer using a dark or light background when writing code?

I like a light background with dark text (usually black text on a white background), because I find it difficult to see when I change between different applications, and even to see clearly when I look away from the screen. Visual artefacts suck.

How about you? Sound off with me on Twitter: @bornsql .

Survey: Tabs or Spaces

This is my second survey for the month of December.

Last week I asked about join predicate order. This week, it’s a simple question:

Do you prefer tabs or spaces to indent your T-SQL, and why?

I prefer to use tabs, because that’s how I learnt it in software development. Not that you asked, but my default tab size is 4 spaces.

Being able to adjust the tab size makes using spaces redundant, for me anyway.

Hit me up on Twitter (either @bornsql ) to have your say.

Survey: Join Predicate Order

It’s a quiet month as we look forward to 2016, so I’m asking a series of survey questions for the next few posts.

My first one is about the order of join predicates.

When joining two or more tables in T-SQL, which do you prefer?

SELECT *
FROM TableA a
INNER JOIN TableB b
   ON a.Col1 = b.Col1

or

SELECT *
FROM TableA a
INNER JOIN TableB b
   ON b.Col1 = a.Col1

The SQL Server Query Optimizer doesn’t care, so it comes down to your preference.

For legibility, I prefer the first option, where the table order is reflected in the predicate order.

Some people like having the order reversed.

Which do you prefer, and why?

Temporal Tables – When To Use Them

This is the final part of my Temporal Table series. You can read parts one, two and three here.

Last week I demonstrated how to modify temporal tables in SQL Server 2016.

This week I’m answering a very simple question.

When should you use Temporal Tables?

I see two main reasons for using this feature:

  • You are legally obligated to store an audit trail of changes to your data.
  • You currently implement history tracking through triggers and stored procedures or in application code.

Considerations

Tracking changes to your data is a big deal, and in databases with heavy churn, you can end up needing a massive amount of space to handle your history, especially if you need to retain seven years of data, like some of our customers.

If data storage is a concern, I’m going to recommend SQL Server Enterprise Edition. The Books Online documentation specifically states that the history tables for Temporal Tables are implemented with Page Compression by default, which is an Enterprise Edition feature.

If you cannot afford Enterprise Edition, temporal tables will still work, but page compression will not. You may still have to spend money on additional storage.

Realistically, there’s no hard and fast estimate of how much space this feature will use. You will have to do some testing. Based on that testing, you can decide whether to spend money on additional storage, an Enterprise Edition licence, or both.

Whatever your decision, I hope that you have learned something. SQL Server 2016 is, in my opinion, as significant an update to the product as SQL Server 2005 was.