
How Microsoft brought SQL Server to Linux - rusht
https://techcrunch.com/2017/07/17/how-microsoft-brought-sql-server-to-linux/
======
djsumdog
Years ago I was part of a project that became a startup. We got a Bizspark
license and originally developed for MS SQL. Later we added in support for
Postgres/MySQL. Running unit tests against Postgres/MySQL was pretty easy on
my Linux box, but for MS SQL I'd have to start a VM and provision SQL Server
2012 (at the time).

I jumped on the Linux version as soon as I heard about it. I never got an
invite to the preview, but once the Docker container was released, I fully
integrated it into our tests:

[https://github.com/BigSense/BigSenseTester/blob/master/docke...](https://github.com/BigSense/BigSenseTester/blob/master/docker-
tests.rb#L60)

I can now pull up all three DBs in containers (mysql/pgsql/mssql) and three
instances of BigSense and run tests over all three in a deterministic manner.

I had started working on automating a Windows Server with automatic SQL
installation in Vagrant, but that was starting to look really complicated. If
it wasn't for MS porting their database to Linux, we probably would have
dropped it from the project.

~~~
foodie_
Curious why have postgres and SQL server?

~~~
hungerstrike
He said that they "originally developed for MS SQL." and then "Later we added
in support for Postgres/MySQL."

Sounds like they develop a product that can use multiple RDBMS back-ends.
Also, I'm guessing that since 90% of the businesses out there use Microsoft
products, you would probably want to support their products in such a venture.

On a personal note, I find anything that's not SQL Server to be tedious to
work with due to the lack of high quality GUIs, client tools and certain
features.

For instance - did you know that Postgres can't easily return multiple
resultsets? In SQL Server I just write one procedure containing multiple
SELECT statements and my client code can get all of those resultsets with only
one call to that procedure. This one feature alone cuts down on all sorts of
boilerplate code and trips to the database.

~~~
y4mi
honest question, when would you query several tables without joining them
somewhere?

you can do that on postgres as well btw, my first idea would be to create a
function [1] and just throw the rows together. still can't imagine a usecase
for that though, i'd always want to get them separately if they're unrelated.

you're correct on the GUI side however. Everything i've tried is a buggy mess.
i've actually mostly given up on that front and just went with pgcli [2]. its
pretty good for ad hoc queries. But it doesn't really help if you're trying to
write a function. Its just nice for selects with lots of joins or nested
selects.

[1] [https://www.postgresql.org/docs/9.1/static/sql-
createfunctio...](https://www.postgresql.org/docs/9.1/static/sql-
createfunction.html) [2]
[https://github.com/dbcli/pgcli](https://github.com/dbcli/pgcli)

~~~
hungerstrike
The databases I build exist only to serve the application and I prefer to
tightly couple the data access to the database itself, thereby addressing the
object/relational impedance mismatch in one simple stroke.

I usually write queries that return multiple resultsets when the caller needs
to get a bunch of data from different tables all at once. (So, all of the
time.) Instead of sending each table query to the database server
individually, I just query one "stored procedure" in SQL Server. It saves a
lot of round-trips on the network and there are other benefits too.

For instance, say my API needs to take the relational data from tables
`Customer, Order, OrderItem(s) and OrderShipment(s)` and return them as a JSON
object `{order:{customer: {...}, items: [...], shipments: [...]}}`. Or, say I
need to render a PDF using those same tables. In either case the client needs
to get a whole graph of data out of the database and with SQL Server, they can
only send one little query to call my procedure: `EXEC
dbo.GetCustomerWithOrderDetail @OrderId=999;` instead of sending 4 or 5
single-resultset queries.

Sometimes I do also end up sending 2 or 3 procedure queries separately, for
instance the client might send a query for `GetCustomerWithOrderDetail`
followed by `GetPdfTemplateWithDetailForRendering`. So, I get code
encapsulation too.

The benefits of this style are exponential in my opinion. Most of the time, my
client apps don't even need to know the names of the tables because they are
calling procedures, not embedding "SELECT * FROM TABLE" in the client code.
The only minor drawback is that the client does need to know the order that
the resultsets are returned in ahead of time.

I think there are a few ways to attempt this in PG but none of them seem to
come very highly recommended. I looked around just now and found this post:

[https://stackoverflow.com/questions/36717138/postgres-
functi...](https://stackoverflow.com/questions/36717138/postgres-function-
return-multiple-tables)

You can see the programmer wants to do what they need to in a very simple way,
similar to how it would be done in SQL Server. However, it's not possible.
Here is an article that explores some of the options in PG and the problems
with each approach:

[https://blog.dsl-platform.com/multiple-result-sets-
alternati...](https://blog.dsl-platform.com/multiple-result-sets-alternatives-
in-postgres-3/)

~~~
foodie_
Interesting. I worked on a larger project that used Oracle and a similar
approach. The maintainers of PG actually advocate for this abstraction as well
(maybe not the multiple responses, not familiar with that aspect) but most
developers and frameworks ignore it.

------
esterly
SQL Server source code originated on UNIX, ported to OS/2 then Windows. See
the Sybase history
[https://en.wikipedia.org/wiki/Sybase](https://en.wikipedia.org/wiki/Sybase)

~~~
spikels
Sybase had a version running on Linux back in 2003. Used it for a big
analytics project. It blew away SQL Server in term of reliabilty. No need for
regular restarts.

~~~
skc
SQL Server requires regular restarts?

I find this hard to believe.

~~~
drsim
I don't know which version the parent looked at, but we had a mix of SQL
Server 6.5 and 2000 servers. Those on 6.5 suffered from all kinds of phantom
errors which a regular restart schedule fixed. SQL Server 2000 on the other
hand was solid.

~~~
mgkimsal
similar experience - worked with 6, 6.5 and 7 on NT 3.5 and NT 4. 4 was
better, but it often was 4 itself which ended up needing rebooting, vs SQL
Server itself, but... when one's on the other, does it make much of a
difference? There wasn't an option to run MSSQL 7 on anything else, IIRC.

I do remember 7 on 4 was much improved re: requiring reboots, and the projects
I was on ended up doing it periodically more out of proactive concern re: NT4
than real demonstrated problems with MSSQL 7. 1999 project had 80 NT servers
running IIS reboot on a schedule every few hours with a big load balancer in
front. 70+ up at any one time, always a handful being reboot and coming in and
out of the pool. If we didn't proactively do it, they'd just go down anyway.
IIRC that spoke more to IIS than NT but again... how can you necessarily tell
the difference? Not rhetorical, there were probably good ways to dig in and
try to determine root causes (and I think some folks tried or did) but it
didn't mean we could actually do anything about it (like patch and recompile
the NT kernel).

------
CrLf
I'm still unsure of the usefulness of SQL Server on Linux. I don't see the
point of running SQL Server on Linux (I'd rather choose PostgreSQL or
something), nor do I see the point of choosing Linux if I'd already settled
for SQL Server.

I don't think this (in the end) is anything more than a marketing trick, there
to give the illusion of choice.

This is not uncommon in ISVs, btw. There are many commercial offerings that
have a Linux version, crippled in so many interesting ways that it makes it
pointless. I'm a Linux person but I advocated against choosing Linux versions
(of different products) many times in the past. Actually, that means the
marketing trick works.

In my experience, software always has a primary plaform where it shines, and
the other "supported" platforms are always stepchildren.

~~~
tw04
That's because you're missing the point. MS isn't competing against Postgres
or MySQL, they're competing against Oracle, DB2, and Hana. All of which have a
variant that runs on Linux. They need to be just as flexible as their real
competition if they want to continue to expand market share.

~~~
gmarx
meta-point. You could have edited out your first sentence

~~~
dspillett
Or just reworded it: "I don't think you are not seeing MS's real objective
here" is probably what he meant, in the tone he thought it, he just wrote it
in a more direct manner that made it seem more aggressively negative.

------
chx
Microsoft is playing a fantastic Linux game with putting Linux userspace on
the Windows desktop where drivers and UI are far better than the Linux drivers
and UI and putting SQL Server on Linux server where the Linux kernel is much
stronger. They know their strengths and weaknesses and not afraid to play to
them.

Here's my writeup on setting up Windows 10 as a long, long time Linux user
[https://github.com/chx/chx.github.io/wiki/How-I-set-up-my-
Wi...](https://github.com/chx/chx.github.io/wiki/How-I-set-up-my-
Windows-10-\(coming-from-Linux\))

~~~
thriftwy
Too bad that Windows 10 barely usable on itself.

Every application looks different (yes they used to blame Linux/X11 on that
one). It has two control panels (or three maybe), two web browsers shipped
with it.

Takes more than a minute to boot on a new and pretty formidable laptop. This
is the fresh factory install.

Can freeze the desktop while apparently doing something under the hood
(installing updates? scanning malware? summoning the devil?), without any
indication as to why, and not come back in five minutes.

Seriously considering overwriting it with Ubuntu even when it's aimed for a
non-technical user.

~~~
aykutcan
Windows 10 is usable in every aspect.

Boot speed is pretty good and doesnt freeze like that.

Check your hardware if that is a fresh factory install. You are doing
something wrong.

They are not common problems. They are yours.

~~~
vidarh
I bought my son a new laptop earlier this year. It is something like ten times
faster than his old Linux laptop (my old hand-me-downs), yet it boots slow and
is sluggish with Windows where his old Linux setup was fast. I haven't had it
freeze, but I've spent far more time solving problems with his new laptop in
the last few months than in the last few years of having him use Linux. If it
wasn't for some of the games he likes that aren't available for Linux, I'd
have insisted he stick to it.

Maybe they're not common problems, but it's certainly not just him that find
it gives a poor experience.

~~~
alkonaut
If a new laptop is slow something must be wrong. Such as it having a
mechanical disk. It might not seem like a big problem but it's almost a
complete no go with win 10. If there are performance issues/freezing on a
machine with 8GB and SSD then something is wrong and you should contact the
manufacturer, chances are a bios or driver update will fix it

~~~
thriftwy
> Such as it having a mechanical disk. it's almost a complete no go with win
> 10

Why then do Windows 10 laptops get sold with HDDs? You come to store and
that's what you get out of it.

Also, Linux doesn't mind running from HDD. Not ten years ago, not now.

Lesson to MS: Get your act together or get out of this business. Come back
from make-believe world. MS is running on make-believe for the last 10 years.
Windows 8, the whole Avalon story, Windows Phone and now this Windows 10
"which only works well on SSD but never discourages anybody from getting an
HDD laptop". Supposedly we should learn about this by telepathy or something.

~~~
tw04
>Also, Linux doesn't mind running from HDD. Not ten years ago, not now.

That's factually incorrect. OSX, Windows, Linux, it makes no difference. You
cannot hide the 8ms of response time that comes with a crappy laptop spinning
drive. If you spend all your time in a web browser with ample amounts of
memory... sure. If you're doing ANYTHING that requires disk I/O - whether it
be launching a game, or opening a large directory, you will experience
significant lag time with a spinning drive.

~~~
thriftwy
Guess what, Linux distros figured out how to sprint read everything that is
needed into RAM and boot under 10 seconds. Windows takes more than a minute on
better hardware by seeking the hell out of it.

~~~
tw04
That's just not even remotely based in reality. Linux is SIGNIFICANTLY slower
to boot on HDD than SSD.

[https://www.youtube.com/watch?v=Bgmph_bL8V4](https://www.youtube.com/watch?v=Bgmph_bL8V4)

[https://www.youtube.com/watch?v=X-Rsr4E6b68](https://www.youtube.com/watch?v=X-Rsr4E6b68)

But I would once again question why you care how long it takes to cold boot a
laptop. I think my laptop gets cold booted MAYBE once a month.

~~~
thriftwy
For some reason, my Windows 10 install reboots itself regularly. Or sometimes
it freezes so the only solution is hard reset. That I'm not going to blame
solely on Windows, but still, that's what I'm observing.

------
smartbit
I would never recommend SQL Server on Linux for Enterprise production.

\- licensing costs are probably the same. If the cost of an additional Windows
Server license is an argument, something else is going on.

\- recently having dealt with MS Enterprise support on Linux, it was an
horrendous experience I can nobody recommend

\- an Enterprise with need for SQL Server without Windows Server support
engineers?

\- did we see independent performance tests published? A quick search I found
these
[http://www.fhtino.it/blog/showpost.aspx?id=6790c78accb84f9c9...](http://www.fhtino.it/blog/showpost.aspx?id=6790c78accb84f9c9d0ecd315ec3f450),
seemingly not a convincing argument.

IMHO the whole story stinks and none of the arguments mentioned by Microsoft
are valid. Probably it is all about _winning hearts and minds_.

SQL Server on Docker images for Devs is great as these are free of licensing
costs (I guess).

~~~
taspeotis
I think it's partly a hat-tip to ISVs using .NET. Entity Framework (Core and
Desktop) works best with SQL Server, with whole .NET Core is cross-platform
thing they let ISVs sell to Linux shops too. The alternative would be to mix
EF with PostgreSQL or (horror of horrors) MySQL which is a pain-in-the-ass for
testing/QA. ORMs are leaky abstractions!

If you're ponying up for a SQL Server license you can afford to pony up for
the Windows license. But if you're not a Microsoft shop and you're buying .NET
Core-based COTS you can skip the license fees and install SQL Server vNext
Express on your Linux machines. (Up to the point where you max out Express and
have to cough up for Standard anyway.)

~~~
jmkni
At our place, we use ServiceStack with OrmLite, which runs well on .net core
and plays nicely with MySQL.

You can switch between SQL Server and MySQL by changing just one line of code.

~~~
j_s
So it is worth $250/seat + $175/yr renewal?

I haven't looked at much ServiceStack stuff because of the cost.

~~~
jmkni
Well I'm the only dev at the moment so I really just need an indie dev license
for myself, and it's licensed per developer, not per project etc.

I think it's worth it.

In my opinion, anybody working on .net ends up spending a lot of time writing
what is essentially their own version of ServiceStack, on Web API.

It has a lot of features that you would end up writing anyway, spend months
doing so, and would probably do less well. It basically gives you a massive
head start.

------
wilhil
As someone who has tried some early builds, what annoys me is that they have
made it a lot easier and much quicker to install on Linux than it is on
Windows!

~~~
tkubacki
It's hard to make things easy on Windows - it's law of nature.

~~~
alkonaut
It's actually not - if you try to avoid integrating in any way with the os.
Shared-nothing apps are pretty nice.

SQL server and a few of the other behemoth apps seem to have a very hard time
staying separate from windows which is annoying.

In Linux the design benefit is that there are package managers and the flaw is
that there are many. Shipping a simple binary installer for multiple
distributions is still tricky.

~~~
deadbunny
> Shipping a simple binary installer for multiple distributions is still
> tricky.

Because you're bypassing the package manager. Packaging isn't all that hard,
much easier than building your own binary installer that handles multiple
platforms.

~~~
alkonaut
Right. My point was that it's easy to deploy to one or a couple of
distributions but still painful to deploy for "Linux" without further
specification. Meanwhile on windows their trainwreck of an installation system
works for all windows from 95 usually.

------
polskibus
Does anyone know whether Analysis Services and Integration Services are also
going to be available on Linux? What about Windows Authentication mechanism -
is it going to be available, if yes then how would a Linux box join AD domain?

~~~
noinsight
> how would a Linux box join AD domain?

By using Red Hat's _sssd_ which handles it pretty much seamlessly.

You get fully working Kerberos with that which should work with SQL server
probably.

~~~
cjsuk
You get _mostly_ working Kerberos. It's not quite that reliable.

~~~
noinsight
What issues have you run into? I haven't encountered any problems.

Admittedly I mostly use it for logging into servers with AD accounts (it will
autocreate homedirs too!) and access controls via AD groups.

You can permit SSH/sudo access through AD group memberships. SSH works with
Kerberos SSO.

~~~
cjsuk
Mainly periodic random unexplainable KDC_ERR_C_PRINCIPAL_UNKNOWN which appears
to be the Kerberos equivalent of "fuck you!"

~~~
dijit
Check your ntp; this happens when kerberos loses trust with the principle.

Happens on Windows too but they mitigate it by _forcing_ you to use NTP
against the AD servers.

~~~
cjsuk
We already use NTP (chrony) against the DCs.

We did have some problems with timedatectl being a dick in the early days of
CentOS 7 which reported NTP as enabled but it wasn't. That caused the same
issue but we resolved that one and it still periodically happens.

I can't quote for the state of the DC's though; they're not mine and I don't
want them! :)

------
rdiddly
Unexplained photo of Portland's Steel Bridge. Is it a reference to OSCON?

~~~
cpeterso
The article says Microsoft ported SQL Server to Linux using a 2011 Microsoft
Research project called "Drawbridge":

[https://www.microsoft.com/en-
us/research/project/drawbridge/](https://www.microsoft.com/en-
us/research/project/drawbridge/)

------
manigandham
Like the article suggested, we use SQL Server and it's running on the only
Windows host in our entire stack. This is a great move and we're looking
forward to being completely on Linux.

Postgres is a great database but SQL Server has some fantastic features like
columnstores, in-memory oltp, graph queries.

Linux has better tooling than Windows and SQL Server has better tooling than
all other relational databases, it's a great match.

------
Beltiras
"Kumar also noted that many enterprises were looking for an alternative to
Oracle’s database products."

Does this translate to enterprises wanting a stick to beat Oracle with when
negotiating license fees?

------
stepik777
Interesting, looks like they are using something similar to Wine to run it on
Linux.

~~~
CrossWired
SQL Server has had its underlying SQLOS since the SQL 2005 rewrite, so the
mechanics to port to Linux has been in place for years:

[https://blog.sqlauthority.com/2015/11/11/sql-server-what-
is-...](https://blog.sqlauthority.com/2015/11/11/sql-server-what-is-sql-
server-operating-system/)

------
hacksonx
My home desktop (Intel Pentium G645) doesn't support virtualization and I
guess this means I can't run this.

~~~
bjg
There is no virtualization used in SQL server on Linux... It's not a VM. It's
a just like any other Linux process... It just happens to have something that
looks a lot like the NT Kernel running inside that process.

------
eapotapov
This seems to me as some kind of defeat and that makes me sad. It's sad for me
to look how great companies grew old

I think Microsoft is now afraid that people (developers that were hired by
enterprises) are willing to move to *nix so much so that they will force
enterprises to gave up on MS stack.

This way they could lose SQL Server customer and Windows customer at the same
time - having SQL Server version for Linux will keep SQL Server customer.

I believe this wouldn't have happened 10 years ago, and moreover, it would
have sounded just unbelievable.

This reminds me not only of things that could change very fast. It reminds
that even when things go well with your business there's always someone thing
that could "disrupt" your market, like a new dimension. And that thing won't
be invisible. It will grow nearby and you will see such company and just won't
assume that it represents any danger.

~~~
pjmlp
It is not sad, it is Microsoft playing the right moves to stay relevant,
instead of joining Sun, DEC, Wang and many others that were once upon
something great.

Look at SGI and Cray, they also had to re-invent themselves around their own
distributions of GNU/Linux and tailored made hardware, instead of keep selling
their own UNIX variants.

If I have to develop on UNIX-like OSes, but can still enjoy all the nice
Microsoft tooling I have grew to love, then great.

Love or hate it, FOSS around UNIX has commoditized the OSes.

Who knows if now we will ever move away from a UNIX monoculture on the
enterprise, specially with the increasing Linux / OS X love from Microsoft
side.

