TSQL Tuesday #116 - SQL on Linux

I’ve been in a party mood all week. Not because of my birthday being this week (it was). And not because of my son’s birthday being this week (it was). No, this week is the week of the second Tuesday of the month – which means that it’s time for T-SQL Tuesday. And this week, it’s not just on Tuesday – it’s open all week to post on. Which, as you will soon see, is a good thing.

The T-SQL Tuesday history

T-SQL Tuesday is the blogging party that was created by Adam Machanic (b|l|t) way back in December 2009, for the purpose of strengthening the SQL Server blogging community. T-SQL Tuesday gets bloggers posting about a specific theme, chosen by the host blogger. This party is now being organized by Steve Jones (b | t), and it now has it’s own web site. As a blogger, all we have to do is blog about that theme… today.

This month’s host blogger and topic

This month, the host blogger is Tracy Boggiano (b | t). Until I read the party invitation, I did not realize just how much Tracy is into SQL Server running on Linux. I realize that I’m going to need to read more of her work.

The theme that Tracy has selected for this TSQL Tuesday is “SQL on Linux”. What Tracy wants us to blog about is:

I was wondering what it would take for people to adopt SQL on Linux. Alternating I’m offering up for you to blog about what everyone should know when working with SQL on Linux or anything else related to SQL running on Linux.

The history of SQL Server

When Microsoft first started partnering with Ashton-Tate and Sybase in 1989 for SQL Server v1, guess which OS it ran on? Did you realize that it only ran on OS/2 at the time?

It wasn’t until version 4.2 was released (in 1992) that it could run on a Windows platform. Since version 4.2 and until SQL Server 2017, it only ran on a Windows platform. As of SQL Server 2017, it can run on a variety of Linux distributions, including Docker containers.

My take on running SQL Server on Linux

I mentioned earlier that it’s a good thing that this episode is for a week. The reason is that, in addition to birthdays going on this week, I wasn’t really sure of what to write about. You see, while I do use SQL Server on Linux, it’s how I use it that makes me pause. Since SQL Server was released on Linux (starting with SQL Server 2017), I’ve been using it for all of my presentations that I give on new features. I’ve finally decided to just write about why I use it for presentations.

Installation

When I’m working with new technology, I always install the program into a virtual machine. For SQL Server, this means first installing the OS, then SQL Server. Creating a new Windows VM, patching it with the latest updates, and installing SQL Server on it usually takes me several hours, with lots of time spent downloading (and in the rural area that I live, I’m glad to have DSL – but I sure wish I had something more modern (aka fast)). For Linux, I just use an Ubuntu distribution. The install process for the OS is done in 15 minutes, and the SQL Server installation is just a couple of commands.

Updating to the latest SP / CTP is just as easy on Linux.

This makes creating a new VM extremely easy. Something that I frequently do when creating a presentation.

It’s SQL Server

The way that Microsoft has handled porting SQL Server to run on Linux is nothing short of brilliant. There is an OS layer that is different for which OS you are running on to handle the different calls necessary to perform OS actions. This means that it can easily be ported to even more operating systems, if desired (just write a new OS layer). But SQL Server itself? It’s the same code, whether it is running on Windows, Linux, or in a Docker container.

Since it’s the same code, it runs the same. Whatever demos that my presentation uses runs the same, whether it is running on a Linux VM or a Windows VM. So, the attendees will see the same thing, regardless of what OS that they are using. When doing a presentation, this becomes vital. What good is a presentation on new features if it doesn’t work the same?

The future of SQL Server on Linux

When I first heard about SQL Server being ported to run on Linux, I thought that the only reason for this was because of shops that pride themselves on being anti-Windows. Truthfully, there are good reasons for this. The tremendous amount of patching alone can justify this reason.

However, this isn’t the only reason. Other reasons include:

  • OS Licensing (as cheap as free for a Linux distribution).
  • Containers (easily spin up instances of SQL Server).
  • Continuous Integration / Continuous Delivery (CI/CD).

I’ve mentioned that I only use SQL Server on Linux for presentations. Until I have clients that start working with it on their systems, I just don’t know how much more I will use it. I know that I have a Linux learning curve to get over, and to learn how to configure these various systems for best practices. However, I know that 99% of my SQL Scripts will work the same.