Introduction to SQLite: The Most Popular Database in the World


Published on

Introduction to SQLite, given at the Champaign Urbana Database Users Group (cuDBug) on 20 June 2013.

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Introduction to SQLite: The Most Popular Database in the World

  1. 1. An Introduction toSQLiteThe Most Popular Database In theWorldJay Kreibichjay@kreibi.chcuDBug20 June 2013
  2. 2. My history with DBs• Undergrad at UIUC, the Web 1.0 era• Full time software developer for 17 years• 8 years at CITES, including many networkmonitoring and management tools• Almost 7 years atVolition, the last three yearsdoing data collection and analysis
  3. 3. Relationship with DBs• School: Databases are for COBOLprogrammers• Early work: Databases are useful• Later work: Database theory is amazing
  4. 4. My history with SQLite• First learned about it at WWDC 2004• Used for a number of work projects• Tried to stuff Wikipedia dump onto anebook reader
  5. 5. So I wrote a book...
  6. 6. So I wrote a book...• Great White Heron• No, I didn’t get to choose•August 2010• 2.5 years to write & edit
  7. 7. What is SQLite?The power of a full RDBMS......without all the headaches.
  8. 8. What is SQLite?• Database-in-a-file• Self-Contained• Serverless• Zero-configuration• Concurrent Access• ACID compliant• In the Public DomainSQLite is an SQL based RDBMS that is...
  9. 9. Database-in-a-File• Database instance is a common file• File contains schema, data, blobs, etc.• Files are cross-platform• Endian• Word size (32 bit & 64 bit)• Encoding (UTF-8, UTF-16be, UTF-16le)
  10. 10. Self-Contained• The database engine is compiled directlyinto the application• No external libraries or processes
  11. 11. ServerlessApplication Client lib ServerServerProcsTypical Client/ServerSQLiteApplication SQLite
  12. 12. Zero Configuration• No server means no server admin, no DBA• Application can self-configure DB
  13. 13. Concurrent Access• SQLite uses file locking to allow safeconcurrent access from multipleconnections, threads, or processes• Local processes only• Network storage typically does not work
  14. 14. ACID Compliant• SQLite provides full ACID transactions• Two different transaction methods:• Rollback Journal• Write-Ahead Log• Different levels of locking and access
  15. 15. Public Domain• Core source code and algorithms arein the Public Domain• Rigorously enforced• “SQLite” name is still under trademark• Causes more problems than it solves
  16. 16. SQLite Types• Signed 64-bit Integers• IEEE 754 64-bit Float Point• Unicode Text• BLOBs• NULL• (No date/time types; no “numeric” type)
  17. 17. Other Features• Connection can “attach” multiple DBs• SQLite uses manifest typing• Column types are not rigidly enforced• Very few issues• DDL is transactional
  18. 18. Other Features• Supports in-memory DBs (very fast)• Depends on file access for Auth/Auth• Right Outer Joins not supported (Left is)• Triggers are supported• Custom functions/aggs, but not in-DB
  19. 19. Other Features• Virtual TablesVirtual DBEngineQuery PlannerOptimizerAPIVirtual DBEngineQuery PlannerOptimizerAPIApplicationCode
  20. 20. Good Uses for SQLite• Database Junior• Application Cache• Archives and Data Stores• Client/Server Stand-in• Application File Format• Teaching Tool• Generic SQL Engine (external data source)
  21. 21. Bad Uses for SQLite• High Transaction Rates• Very Large Datasets• Detailed Access Control• Client/Server or Multi-Host• Advanced Replication
  22. 22. SQLite Distribution• Code for SQLite library• Code for sqlite3 CLI application
  23. 23. Most popular?SQLite is, most likely, themost popular database in the worldby number of database instances.You use it all the time.
  24. 24. Most popular?• Firefox, Safari,Chrome• iTunes, MacOS X• Thunderbird, Mail• McAfee• Adobe Air• Dropbox• Skype• QuickBooks,TurboTax• Python, PHP,WebSQLLots of Desktop Apps:
  25. 25. Most popular?• 550M iOS devices• 750M Android devices• ~500M Symbian (Nokia) devices• ~100M Blackberry devicesLots of Mobile Devices:
  26. 26. Most popular?~10,000,000,000 active database instances
  27. 27. Q & AJay