MySQL 5.1

The MySQL developers seem to be developing a habit of rolling out useful new features in their .1 releases. MySQL 4 was a good release, but it’s the group_concat feature from 4.1 that I miss most often when forced to use a 3.x or 4.0 install. MySQL 5 made some huge leaps forward, but already there’s plenty of talk about the new features coming in 5.1.

In particular, I’m looking forward to support for XPath and event scheduling.

With the former it will now be a simple matter to query arbitrary XML data stored in text fields. It’s by no means an XML database, and it remains to be seen what performance looks like, but for those of us who sometimes need to store smaller snippets of XML or who want another option for flexibly searching the data we’re storing, it looks to be a nice addition.

The latter means we’ll be able to dispense with all those quick maintenance scripts dispatched by cron and instead (if the current syntax makes it into the release) set up triggers such as:

UPDATE session SET expired = 1
DATE_SUB(CURDATE(), INTERVAL 7 DAY) > last_updated;

Naturally, developers will need to decide how much control to cede to the data layer and how much ought to be kept in their application, and backup strategies will need to be adjusted accordingly. But for those of us tired of having to maintain configuration data across multiple scripts (or load in the configuration framework for quick, standalone scripts) this is a very handy addition.

Tags: , , ,

1 comment

  1. I generally don’t keep tabs on whats new in MySQL, but XPath, and Events, will be a greate feature, in particular Events. One thing I cannot justify is MySQL’s implementation of XPath, as it just seems to be obscure.

    How would MySQL evaluate values in the current & global context or embed arguments in MySQL (I guess using CONCAT)?
    for example, heres an example to translate a DocBook with XSL.

    <xsl:variable name=”GlobalPosition”>
    <!– Predicate context evaluates to the contexts position(); Selects global position for article –>
    <xsl:value-of select=”position()” />
    <xsl:if test=”($PathID = @id or parent::article/article or (boolean((//project/article[1][not(boolean($PathID))][boolean($GlobalPosition=5)]/@id))) )”>