hn.today

Running 1k Standalone SQLite Databases Inside SQL Server

sqlartist.github.io3 points0 comments
Screenshot of Running 1k Standalone SQLite Databases Inside SQL Server

The design revisits an older idea: use a metadata layer to unify many incompatible data sources without forcing them into one schema. The author argues that modern ontology and data-platform systems can add unnecessary machinery when datasets are awkward but not truly large; local execution may be enough. A past SQL Server implementation made flexible virtual objects practical by building physical indexes based on selectivity and using query history to direct distributed work. It also treated the transaction log as the source of truth: each ingestion batch created a new version, allowing the semantic layer to remain consistent and roll back by switching a version pointer rather than repairing partially updated data.

The proposed system stores each tenant’s complete, downloadable SQLite database as a VARBINARY(MAX) value in SQL Server, then opens it in memory for queries through a C# SQLCLR assembly using Windows’ built-in SQLite library. Because SQL Server cannot index inside a binary file, a companion metadata record exposes selected fields as JSON and persisted computed columns, enabling ordinary B-tree indexes to eliminate most candidate databases before their blobs are loaded. A relational change log handles recent inserts, updates, and deletes, avoiding costly rewrites of entire SQLite files; version pointers support clean rollback. Separating binary storage from metadata also allows hot indexes and cold database files to reside on different filegroups. The approach targets large collections of small, independently schematized databases without the operational burden of thousands of SQL Server databases or the limits of a shared fixed schema.

Read on sqlartist.github.io0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.