An 5-Minute Introduction to

SQLite

And How It Relates To Linux

Resources

Everywhere

  • 200 or more SQLite databases on every Android phone × 2.5 billion Android phones
  • Over 5GB of SQLite I/O per device per day
  • Many, many other uses

https://sqlite.org/mostdeployed.html

Fast

An SQL query for a 10KB blob like this:

SELECT value FROM blob WHERE key=$key;

Runs faster than:

  stat();
  open();
  read();
  close();

See https://sqlite.org/fasterthanfs.html

Different

  • A subroutine call, not a separate process or thread
  • Single-file database
  • Lives on the edge of the network, not in the datacenter
  • No control or knowledge of filesystem or mount options

https://sqlite.org/about.html

ACID

Three ways to do atomic transactions:

  1. Rollback journal
  2. Write-ahead log
  3. Atomic write capabilities of F2FS on Linux

https://sqlite.org/lpc2019/doc/trunk/briefing.md

Things to discuss

  • Reliable ways to discover detailed filesystem properties
  • fbarrier()
  • Notify the OS about unused regions in the database file

https://sqlite.org/lpc2019/doc/trunk/briefing.md

Resources