01
May 08

Ubuntu upgrades and fundamental problems

New job, new machine. So the last two days I’ve been setting up hardware platforms for work (one linux desktop machine, one win32 laptop, and some cool toys like an iPod Touch and a Nokia N800 – there are more to come, but it’s more than enough to start with). I’ve been using Kubuntu for work for a few years, and Xubuntu on my ancient (and now breaking) laptop at home (an Inspiron 1100, which should tell you why it’s xubuntu and not kubuntu there as well). So, no-brainer, other people have had no problems so just download the latest ISO and do a quick install, right?

Well, yes and no. Continue reading →


24
Jul 07

Mechanism, not Policy

Over on Diamond Notes, a somewhat skeptical take on the recent Postgres benchmarks news. Can’t say I agree with it, and I did comment on it, but something did go click for me while thinking about it, hence this entry. See, the problem isn’t just performance. MySQL just doesn’t do the right thing.

I mean, I can understand the principle of implementing the smallest featureset you think a user would need and then optimising the bejaysus out of it – Epiphany would be a better browser than Firefox for 90% of the time for me because of that approach (it’s just Epiphany’s way of doing bookmarks that gets in the way) because Epiphany is always faster and less of a memory hog than Firefox since it doesn’t try to do everything. Emacs and vi is another example – sure emacs can do just about anything, but vi starts in a heartbeat and if you just want to add one line to your .muttrc/aliases, there’s not much point in firing up emacs. Of course, if you’re doing a chunk of work… but that’s another story.

The point was, before the digression, while MySQL was faster than Postgres in previous benchmarks, it wasn’t doing the job right. Sure, it was faster… but only if you wrote your SQL the MySQL way. Don’t use JOINs because MySQL doesn’t do those well. Yes, I know, there are better ways to do things than JOINs (and if you grok set theory, easier ways), but forcing end users to write SQL a certain way – and punishment with poor performance is forcing them – is the same as putting policy in the kernel. It violates one of the core tenets of unix kernel philosophy: Mechanism, not Policy.

There was also the point that MySQL didn’t really do SQL. I mean, transactions. Obvious example, I know, and everyone and her aunt has commented on it, so no need here beyond the usual “come on” response to the “oh, but you don’t need transactions” line. You might be right that there are other ways to do things, but guess what? That’s my choice as the developer, not yours. That’s the entire point to SQL – it lets me abstract away from the actual storage policy and just worry about the arrangement of the data in tables. In other words, it’s a Mechanism for me to implement my Policy with. And that’s a very powerful thing. But MySQL didn’t fully implement that Policy and it implements some parts of it more favorably than others, thus imposing it’s Policy on me through what’s meant to be an impartial Mechanism.

And yes, I know, Postgres adds to the SQL standard with its OO features. But that’s not the same thing. Adding to the standard is fine – so long as you implement the standard first.
So frankly, seeing Postgres doing so well in the performance benchmarks isn’t just a nice sight from the point of view of performance – it’s a nice sight from the point of view of doing the right thing. It means that the last thing that was holding back the better way of doing things has now  been taken away. LAPP stacks? About time too!


13
Jul 07

Postgres performance

For a long time now, most who’ve used both have felt that Postgres was a better database than MySQL, myself included. But until now, the stick that MySQL keep beating Postgres over the head with was performance. MySQL might be a toy database (okay, it’s moving away from that these days, but only in the last few versions and that’s not really enough dev time to be stable enough for critical stuff), but it was fast on cheap hardware, and for pragmatic web development, that meant it beat out Postgres every day of the week.

Not any more

Basicly, for the first time in a seriouly major benchmark, postgres not only outperformed mysql, but it nearly matched oracle (which was running on hardware that cost more than twice as much).

There’s also this earlier post, which basicly showed that Mysql on a single-CPU machine starts off faster than Postgres, but falls off as the number of concurrent users
rises, until it’s way behind postgres, which remains pretty invariant as the number of users rises. It also shows that postgres takes advantage of multiple CPUs better than MySQL does (up to 16 CPUs anyway, where the postgres team say they still have work to do).

Something to think about. Do you expect to ever have more than one or two users on your site? Better start with postgres so, and save yourself the cost and hassle of a later switch (I don’t care how good your database abstraction layer is, no DAL is so good that you don’t have to change your app when you switch database. Maybe more on that later.)