SQLite is a great database to use with Ruby on Rails apps for MVPs. It simplifies deployment and configuration since it is just a single executable and database file. SQLite is fast and scales quite well for smaller applications. Configuration for the database and engine lives within the Rails application itself, allowing for granular control and experiences like branch-specific databases.
Notion recently improved its browser performance by using SQLite for client-side caching. This led to a 20% increase in page navigation speeds through a SharedWorker architecture to manage concurrency and prevent database corruption. SQLite was implemented using WebAssembly for local data storage and offline functionality. In this post, the team at Notion goes through challenges they faced with slow disk reads and initial page load times.
Sqlean-time is a high-precision date/time extension for SQLite. It provides a structured API and a rich set of functions for working with Time and Duration values. The extension enables storing and manipulating dates for billions of years in the past and future with nanosecond precision.
Notion implemented WebAssembly (WASM) SQLite in its web app. This resulted in a 20% reduction in page navigation latency. To achieve this, its team used Web Workers to offload database operations to background threads and a SharedWorker with the Web Locks API to fix data integrity issues. They also addressed issues of slow disk reads by implementing a "race" between disk cache and network requests.