Larry Ullman

Translating Geek Into English

More on Non-relational (aka, NoSQL) Databases

Non-relational databases seem to be getting all the attention these days (apparently we’ve moved on from HTML5). If you’re not familiar with the concept of a non-relational database, they are sometimes called NoSQL databases, but that’s a misnomer, as these databases do use SQL. What a non-relational database does not do is organize its data in related tables (i.e., data is stored in a non-normalized way). For example, in a conventional database, a blog might have one table that stores posts and another table that stores comments. A JOIN is then required to pull out all the comments along with a particular post. With a non-relational database, one “collection” (the non-relational version of a table) would store all of the posts. Each comment associated with a post would be stored as part of that post’s record within the collection. This means that one record (or “document”, in non-relational terms) might contain just the post and no comments, another record might contain a much longer post and hundreds of comments. The benefit is that when you go to retrieve an individual post, you’re automatically retrieving all the associated information (e.g., the comments for that post). Non-relational databases really are the opposite of a normalized database, taking more of an object-oriented approach to data storage and retrieval. The hardest thing about using a non-relational database may be going against years of relational database training.

MySQL 5.6 Preview

MySQL (aka, Oracle) has announced a preview of features for the next major release of the MySQL database application, version 5.6. As every company pretty much says about every new release, one focus is on improved performance. Of course. But the most interesting change will be support for full-text searching with InnoDB tables. Historically, MyISAM was the default table type, with the best performance and support for full-text searching. For a long time, InnoDB was the most popular other option, and was the storage engine (aka table type) of choice if you need to perform transactions. The MySQL documentation now claims that InnoDB performs better than MyISAM, although I take that claim with a grain of salt as Oracle bought InnoDB a few years ago, prior to their acquisition of Sun (and therefore MySQL). In any case, should MySQL 5.6, when it comes out in a few months, allow for full-text searching of InnoDB tables, that may be the nail in the coffin of the MyISAM table type. On the other hand, full-text searching in MySQL is of limited use as is, so this addition may not have that big of an impact. Regardless of the impact, I know many people are just waiting for MySQL to shrivel up and die from a lack of Oracle backing, a death not likely to come in the foreseeable future.

The Modernizr JavaScript Library

HTML5 and CSS3 add useful and cool new features, but, as always, browser support is still an issue. If you want to develop sites using cutting edge options, while still being backwards-compatible, a great tool to use is Modernizr. The concept is simple (and brilliant): Modernizr identifies what features the user’s browser supports and adds corresponding classes to the opening HTML tag. In your CSS, you can then add styling to just those classes. The result is that browsers that support, say, @font-face or canvas, will get the stylized version, and browsers that don’t, won’t. Modernizr also creates a JavaScript object that represents the browser’s capabilities. This object could be used to customize your JavaScript accordingly, too. And Modernizr has IE-specific tools, that add HTML5-like functionality to that browser.

For good, quick introductions, see the Modernizr site, this article at A List Apart, and this article at Web Designer Notebook. Modernizr just came out in version 2 and is open source.

Improving Site Performance: "Smushing" Images

In trying to improve my site’s performance, starting with using the YSlow! Firefox extension, I came across the concept of “smushing” images. Smush.it is a Yahoo! service (which is why it’s tied to YSlow!) that optimizes images in such a way as to reduce their size without adversely affecting image quality. I believe I reduced my total image size by about 10-15%, which isn’t huge, but when you’re talking about Web site optimization, every little bit helps. The only thing to be aware of is that sometimes GIFs will get turned into more efficient PNGs, meaning you’ll need to change your HTML accordingly.