I’m fairly convinced that the relational database paradigm - which in practice means SQL databases - is on its last leg. There are is a growing array of excellent options for document or key-value datastores which sidestep all the scaling issues and complexity of SQL databases: CouchDB, Redis, Tokyo Tyrant, Memcachedb, and MongoDB are some of the front-runners.
But although many of these are approaching mature enough for production use, one thing that’s missing is knowledge. That is: how the hell do you create a fully-functional application without explicit relations, joins, locking, sequences, transactions, and a complex query language in your database?
Redis has an excellent tutorial on writing a Twitter clone in PHP, with Redis as the datastore. This explains many of the key concepts, such as keeping track of references between records, and querying for data in the form you want to display on a particular page. For example, constructing a user’s timeline based on the updates of everyone they are following, sorted in chronological order.
Even better, Dan Lucraft has written a Ruby version, called Retwis. It’s a mere 350 lines of Ruby (not counting the Redis client library) and supports all the basic Twitter-style functionality: updates, followers, timeline, and @replies.
So if you’re scratching your head about to build a fully-functional app backend by a non-relational database, take a close look at the Retwis models.