
Making SQL Server run on Linux - kogir
https://blogs.technet.microsoft.com/dataplatforminsider/2016/12/16/sql-server-on-linux-how-introduction/
======
grabcocque
That's some seriously cool tech. The great thing from Microsoft's perspective
is not needing to maintain two completely separate codebases, beyond the
SQLPAL and the linux host extenstion, which are fairly small in comparison.

Also, by having the SQLPAL be directly descended from the Windows SQLOS should
mean that Windows and Linux SQL Server have similar performance, and they're
not paying a significant overhead that's typical of platform emulation.

Good shit.

~~~
rplst8
> The great thing from Microsoft's perspective is not needing to maintain two
> completely separate codebases...

This is a great thing for customers too. The systems will work very similarly
and less code means fewer bugs and security risks.

------
johansch
"Because of SQL Server’s long history on a single operating system, Windows,
..."

It did come out of the UNIX-based Sybase SQL Server, though:

[https://en.wikipedia.org/wiki/Sybase](https://en.wikipedia.org/wiki/Sybase)

I wonder if there was an OS abstraction layer at that time (Sybase ported it
to OS/2 together with Microsoft first) that was then thrown away by Microsoft
after they licensed the source code and went on their own?

~~~
dspillett
There was a fairly large amount of reenginerring work around the 20000/2005
era, and a significant number of smaller but significant feature
additions/changes since, and I doubt that non-windows compatibility was
considered at any point during those developments.

------
rokosbasilisk
What are the advantages of even using sql server when I can use postgres far
more easily on linux ?

~~~
dogma1138
Be able to use the 1000s of commercial products that need MSSQL.

Encryption is easier to manage and it has built in solutions for HIPPA and
PCI.

SQL reporting services and the entire ecosystem of apps that run on top of
MSSQL..

Better clustering, ha, revision control and backup.

Most likely better enterprise support, and you'll be able to port "legacy"
applications that were designed with win/sql in mind without having to rewrite
your entire DB access and query code.

~~~
severino
I doubt any of those 100.000.000.000 commercial products that need MSSQL would
run on Linux either.

In fact, even SQL Server Management Studio is a Windows-only application.

~~~
dogma1138
Actually a lot of them do it's not hard to find some ticketing system or a
call center management system that is written in JAVA or PHP and only works
with mssql or oracle dbms.

The app stack is usually more platform agnostic than you think. Even if it's
asp.net you most likely going to be able to run it or easily port it to .net
core.

Basically having cross platform .net is pointless without having cross
platform everything else especially MSSQL.

~~~
tracker1
I was surprised how easy it was to get a couple asp.net apps running under
docker dotnet-onbuild base containers... I think having SQL Server under
linux/docker is a really nice option. Just being able to use it with ci/cd
environments in linux is a pretty big thing.

I've moved more away from the MS environments the past few years now, but have
missed some of the things that MSSQL makes very easy, and by comparison
PostgreSQL makes relatively hard. Of course you're paying for it. Having the
option to run under Linux is really nice though imho.

~~~
insulanian
> but have missed some of the things that MSSQL makes very easy, and by
> comparison PostgreSQL makes relatively hard.

Could you give some examples?

~~~
tracker1
Namely in the box replication and failover (like checkbox interaction via the
GUI) compared to a hard to configure, or expensive to license add-on.

IIRC geo indexing was easier in mssql, although much more configurable in
pgsql.

Not on pg, but linq to entities for .net is really nice, and the pg adapter
(iirc) wasn't nearly as good. The node adapters for each are about equal
though.

Out of the box performance on mssql, and query performance in general was
better last time I compared (admittedly about 2 years ago).

------
alistproducer2
Here's a little lighter reading from ars on the subject
[http://arstechnica.com/information-technology/2016/12/how-
an...](http://arstechnica.com/information-technology/2016/12/how-an-old-
drawbridge-helped-microsoft-bring-sql-server-to-linux/)

------
kaushiks
Slightly tangential, and while I know nothing about the implementation details
of the SQLPAL, the SSCLI (and later CLR/CoreCLR) took the same approach to
port Windows based code to Unixes [1] and makes for interesting code reading.
For e.g. The SSCLI PAL's implementation of SEH [2].

[1] [https://github.com/lewischeng-
ms/sscli/tree/master/pal/unix](https://github.com/lewischeng-
ms/sscli/tree/master/pal/unix)

[2] [https://github.com/lewischeng-
ms/sscli/blob/adbd6bbad0816f65...](https://github.com/lewischeng-
ms/sscli/blob/adbd6bbad0816f65650a66e1701112a307dc4b09/clr/src/inc/palclr.h#L176)

------
xedarius
Feels exactly like how they abstracted DirectX from direct graphics driver
access, which coincidentally was called HAL.

~~~
lafar6502
Not only graphics, HAL in Windows NT era was (as the name says) a set of
common abstractions for talking to different hardware in standardized way

------
stuartd
So SQLPAL (great name) is in the current SQL Server for Windows? It's quite an
engineering achievement, though you could hopefully automate a lot of the
actual abstraction, and I bet the testers were on overtime. I'd be interested
to know the timeline, is any version of SQLPAL in SQL Server 2016? Or is it
SQL.Next?

------
rbanffy
The article mentions win32. I remember it from the Window NT 3.1 days. Is it
still used? Is the "32" in the name there because someone thought that 32 bits
should be enough for anyone?

~~~
chungy
It's merely the name of the API, even on 64-bit Windows, where it ends up
being a misnomer :-)

------
quickben
Anybody looked into migration to the Linux platform? Realistically, what would
be the advantages/cost?

~~~
kabdib
Not having to run Windows is a big factor. (Just so you know: I run a lot of
Windows servers, so I'm not being knee-jerk snarky. This is a real cost).

~~~
teilo
Yes, and the cost savings go well beyond a Windows license + SA. Being able to
leverage an existing toolchain for configuration management and deployment is
a huge cost savings, given that the Windows alternatives are both expensive,
more difficult to use, and break a lot more (IMHO).

~~~
Scuds
apt install mssql-server

[https://docs.microsoft.com/en-us/sql/linux/sql-server-
linux-...](https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-
ubuntu)

and for the people doing docker

[https://hub.docker.com/r/microsoft/mssql-server-
linux/](https://hub.docker.com/r/microsoft/mssql-server-linux/)

~~~
teilo
I was thinking more of Ansible, but yeah. I've done SQL Server installs on
Windows Core, and it is painful. Aside from the obscure PowerShell commands,
you have to write a config file - just to get the damn thing installed.
Rubbish. (I hear it's gotten better in 2016 though).

------
biehl
Are there any plans for SQL Server to run on MacOS?

~~~
jpalomaki
On docker: [https://docs.microsoft.com/en-us/sql/linux/sql-server-
linux-...](https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-
docker)

------
known
SQLPAL =
[https://en.wikipedia.org/wiki/Wine_%28software%29](https://en.wikipedia.org/wiki/Wine_%28software%29)

