Hacker News new | ask | show | jobs
by sarciszewski 4227 days ago
I too am biased towards PG. At one of my previous gigs, I had to develop a HTML5 mobile app around a MS SQL database (though eventually we migrated to PostgreSQL). Among the problems we ran into:

A) Indexes disappeared without rhyme or reason. (This might have been a "too many cooks in the kitchen" thing, where someone restored from a backup and didn't tell anyone.)

B) In the default configuration provided by the php5-mssql package in Ubuntu, text fields were chopped at 255 characters.

C) Our Windows Server did updates, then came back up with a "you need to renew your license" lock that prevented any I/O and cost us half a day of productivity (on top of the licensing costs).

And of course, D) it screwed up the file encoding when we did the final export during the "migrate to PostgreSQL" step.

Incidentally, migrating our platform to PostgreSQL and kicking the tires was one of the last projects I completed at that job, and everyone was much happier for it.

5 comments

I don't think your experiences with SQL Server are representative. I'm not a fanboy, I've run into more than my fair share of issues with MS SQL, but none of your problems are a result of any SQL Server version I've heard of. Your response screams FUD, to me.

Now, you say that you possibly had too many cooks in the kitchen. So perhaps your complaints are due to the other cooks, or maybe some of your complaints came to you second-hand. But here is my analysis of your complaints, having run SQL Server for a number of years:

A) Just doesn't happen. Index-related statements are transactional and ACID-compliant. (i.e.: you can, in a transaction, add, drop, and update triggers, indexes, entire tables, etc. along with data.) This has been the case since at least I've started using SQL Server with the 2005 release.

B) I don't know why this is the case with php5-mssql, but I would blame the authors of the package. varchar, nvarchar, text, etc fields all support > 255 characters.

C) I don't know of any version of SQL Server or Windows Server that does this. No Windows Server version "locks IO" on a license check failure (this would obviously cause huge problems with filesystem consistency). As far as I know, no SQL Server version does live license checking or phones home. I have no idea what your symptom was, but I suspect someone else broke something. A running SQL Server installation does not "stop", nor does it need the license to be renewed at any point. Cumulative and service pack updates don't do license checks either, as far as I know. In fact, an expired license doesn't affect anything, and probably even reflects a misunderstanding of how licensing works. If you purchased a license, even if you paid yearly for 2-3 years, your SQL Server license is good forever. Forever! New versions require software assurance, but you have to choose to install those manually, it's opt-in, not opt-out. Automatic updates should never break SQL Server.

D) Is it at all possible this was the migrate to PostgreSQL tool's fault? Because I've run weekly backups and restores of SQL Server databases for the past several versions for many years, and had no problem with a .bak file being corrupt.

D) Nope. I wrote the tool and tested it multiple times. The data kept coming out malformed, and playing with mb_convert_encoding() didn't really help much.

I appreciate the feedback though. This was my only time ever using MS SQL.

(Re: the 255 char thing, I had to edit the /etc/tsql/tsql.conf to change the sybase version to make the problem go away. Not a MSSQL problem, but definitely a problem with using it from a PHP + nginx on Linux env.)

a) i can't say with 100% certainty, but with 99% certainty someone dropped the index. they don't just disappear.

b) i really wouldn't recommend hitting mssql from anything other than the home grown system.data.sqlclient built into .net.

c) there are best practices on when and how to install updates. this is not it.

d) that is totally a pain in the butt and something msft should probably figure out how to have a reasonable option for.

one, very legitimate gripe i have for mssql is the default lock levels on reads. not everything needs to be fully synchronized and having to litter queries with (nolock) feels like bad design.

one, very legitimate gripe i have for pg; no stored procedures. functions are not stored procedures. also multiple result sets for a single query, but i digress.

Genuine curiosity: what do you mean about functions not being stored procedures? What is it you want to be able to do with them that you can't in postgres?
pl/pgsql functions require you to define the schema that it returns in the declaration itself; this isn't an issue really as it should more or less be known after you've writing the guts of a query, but it's just more boilerplate.

the key difference is the multiple result sets with different schemas (which you can do with stored procedures but not with functions)

A) Indexes do not just disappear. Someone dropped them or restored an older version of the DB.

B) What? That's not SQL Server's fault, it's either a broken third party package or the display settings on your UI chopped the data to fit on a screen or something.

C) Never heard about this. I even tried to google it but I can't find any information about this. Do you have a source?

D) Third party tool problem probably. Not SQL Server's fault. Did the BAK file restore normally using SQL Server?

I wrote the "third party tool" actually. It was tested thoroughly but on the few records with non-ASCII characters, the data came out weird. It was only about 10 or so records so I just manually corrected it. (I don't recommend this approach, it was a "we're under the gun, just change history and don't fret" decision)
I've been using MSSQL since the 7.0 days in the 1990s and have never seen nor heard of A) happening. As you said, I'm certain this was "too many cooks in the kitchen."
I didn't have DBA access so I couldn't do much to prove someone had maliciously dropped indexes. It was about an every-other-month occurrence, and it would make our response time go from 200 ms to 90s.
it sounds like your issues had nothing to do with MS SQL Server and more to do with system administration nightmares and with php.