Over a million developers have joined DZone.

SQLite Gets Write-Ahead Logs

· Database Zone

Build fast, scale big with MongoDB Atlas, a hosted service for the leading NoSQL database. Try it now! Brought to you in partnership with MongoDB.

There's reason to celebrate today as SQLite 3.7 is released in GA.  The lightweight, ubiquitous database includes some game-changing new features, which have arrived about two years after the 3.6 beta came out.  Today's release will feature nested transactions, constrained foreign keys, write-ahead logs, and more.

You can probably find a few devices around you right now that use SQLite.  The FOSS database engine is embedded in everything from Skype and AIR, to programming language bundles like Python and PHP, to browsers like Firefox and Chrome, and all major smartphones.  

SQLite is an in-process library that can be used when a client/server database is not the best option.  It implements a serverless, self-contained, transactional SQL DB engine that requires no configuration.  SQLite 3.7 will add query planner enhancements, nested transactions, constrained foreign keys, and write-ahead logging, which has been one of the most anticipated new features.

Write-Ahead Logging (WAL)

There are several distinct advantages to using WAL instead of SQLite's rollback journal for implementing atomic commits and rollbacks.

  1. In many cases, WAL is much faster.
  2. Better concurrency.  WAL doesn't let readers block writers and vice versa.  
  3. WAL's disk I/O operations are usually more sequential.
  4. Uses fewer fsync() operations, making it less vulnerable to issues in systems with broken fsync() system calls

Some disadvantages in this approach include an extra operation of checkpointing and less appeal as an application file-format.  WAL is only available if the VFS supports shared-memory primitives.  WAL also does not work over a network filesystem.

Oracle Joins SQLite

In related news, Oracle joined the SQLite Consortium last month.  This means that Oracle will be have access to more complete test suites for validating Berkeley DB's SQLite API, which was unveiled in March.  Oracle Senior Project Manager Gregory Burd had nothing but glowing compliments for the little engine that can.  He said that SQLite 3's ANSI C API is the "new 'ODBC'" for relational DB access, and that SQLite makes "the right trade-offs."  Now Oracle has plans to continually work with SQLite developers, which means that conservative project manager of yours can get behind using SQLite knowing that Oracle is now behind it.

The documentation should show you how to migrate from 3.6 to 3.7.  Go here to find out how to use SQLite in different languages

Now it's easier than ever to get started with MongoDB, the database that allows startups and enterprises alike to rapidly build planet-scale apps. Introducing MongoDB Atlas, the official hosted service for the database on AWS. Try it now! Brought to you in partnership with MongoDB.

Topics:

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}