Archives For database

NoSQL Standouts

September 8, 2011

InfoWorld just posted a good and long article discussing the particular strengths and weaknesses of various NoSQL (aka, non-relational) databases. If you’re intrigued about what NoSQL databases are all about, and maybe even thinking about starting to play around with one, it’s well worth your time to read.

As for me personally, CouchDB and MongoDB are still most attractive, in some part due to their use of JavaScript and JSON, and in part because of existing PHP libraries for interacting with these database applications.

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.

There are a number of non-relational databases out there; the key ones I’ve come across are MongoDB (I’ve written more about MongoDB separately), Neo4j, Cassandra, and CouchDB (Cassandra and CouchDB are both Apache projects, which is a always a good thing). The benefits of using non-relational databases are most important for sites with a lot of activity and data. And by “a lot”, I mean on a Facebook or near-Facebook level. I believe non-relational databases should be on the Web developer’s radar, but I’m not suggesting we should all jump ship on relational databases just yet; most sites don’t have the performance issues that non-relational database solve and do have the need for data integrity that relational databases offer.

The creators of CouchDB and SQLite have just announced a new query language called UnSQL, for “Unstructured Data Query Language”, pronounced “Uncle”. The hope is that UnQL can do for non-relational databases what SQL did for relational ones: provide a common way of interacting with the underlying database, without too much regard for the database application itself. The project is also being supported by Microsoft, for whatever that’s worth.

For a long discussion of non-relational databases, check out this article at InfoWorld. I also benefited from the posts at Sean Coates’s blog, discussing the initial adoption of CouchDB, and the switch to MongoDB on a project.

Looking Ahead: MongoDB

April 12, 2011

Someone, I forget who (sorry), referred me to MongoDB, some time back. I haven’t written about this yet, as I was having trouble “getting” MongoDB. This isn’t going to be an exhaustive introduction to MongoDB, but I want to explain what I finally “got”. And although that I’m still not sure MongoDB is right for me, today at least, it definitely seems to be something worth keeping an eye on going into the future. Continue Reading…

Designing Databases

December 3, 2009

A few months back I came across a resource for designing databases (it was posted in a MySQL discussion list). Database Answers has tons of sample designs (a.k.a., models) for various situations. What the site lacks in attractive design in more than makes up for in its usefulness. There are hundreds of designs for you to consider, covering everything from “dog whisperer” to event reservations to online banking. Definitely worth looking at when you’re thinking about the database scheme for your next project.

In 2008, Sun purchased MySQL for a reported $1 billion (US) and Sun has since been purchased by Oracle. Monty Widenius, the original creator of MySQL, has since left Sun, apparently over philosophical differences. In particular there seems to be a difference of opinion when it comes to the appropriateness of the 5.1 release of MySQL (i.e., was it too buggy for public release). Widenius is now working on MariaDB, an offshoot of MySQL that uses the Maria storage engine (aka table type) by default. This is definitely a project to keep an eye on, as MySQL users will logically move to MariaDB if they do find MySQL to be increasingly unstable or they just disagree with how Sun/Oracle is managing the product. As with many things, the popularity of MariaDB will partially depend upon the adoption rates by hosting companies. Or, for those that do stick with MySQL, version 6 will include support for the Maria storage engine. See this page for more on MariaDB compared with MySQL.

The intention behind MariaDB is to release free and stable, but very similar, alternative to MySQL. The Maria storage engine is a crash-safe version of the MyISAM table type but Maria still doesn’t use transactions (like InnoDB). Version 1.5 of MariaDB is now in beta, with the focus on stability. Version 2 of Maria should include transactions and ACID compliance. Version 2.5 is where the developes intend to really focus on performance. This may seem a little backwards, but it’s much easier to retroactively improve software performance than it is its quality.