TL;DR: Compile SQLite to JS with emscripten, implement a virtual fs in JS to stream chunks of a statically hosted (readonly) SQL database. If queries make use of indices, only a fraction of the database needs to be downloaded. Also, you can use SQLite to query the DOM.
Hosting SQLite databases on GitHub Pages or any static file hoster
21–30 of 252 posts
Re: Hosting SQLite databases on GitHub Pages or any static file hoster
#22The innovation here is getting sql.js to use http and range requests for file access rather than all being in memory. I wonder when people using next.js will start using this for faster builds for larger static sites?
Re: Hosting SQLite databases on GitHub Pages or any static file hoster
#23TL;DR: Compile SQLite to JS with emscripten, implement a virtual fs in JS to stream chunks of a statically hosted (readonly) SQL database. If queries make use of indices, only a fraction of the database needs to be downloaded. Also, you can use SQLite to query the DOM.
I can't figure out exactly how it knows which chunk to download. Does it always download the whole index first? Or does it include it in the built JS file itself?
Re: Hosting SQLite databases on GitHub Pages or any static file hoster
#24Re: Hosting SQLite databases on GitHub Pages or any static file hoster
#25Over high latency links this would be virtually unusable. Why not just download the entire database into memory over XHR on page load? SQLite databases of pure data usually aren’t over 10MB in size.
Why do you think this?
Re: Hosting SQLite databases on GitHub Pages or any static file hoster
#26Over high latency links this would be virtually unusable. Why not just download the entire database into memory over XHR on page load? SQLite databases of pure data usually aren’t over 10MB in size.
Re: Hosting SQLite databases on GitHub Pages or any static file hoster
#27Re: Hosting SQLite databases on GitHub Pages or any static file hoster
#28The innovation here is getting sql.js to use http and range requests for file access rather than all being in memory. I wonder when people using next.js will start using this for faster builds for larger static sites?
Re: Hosting SQLite databases on GitHub Pages or any static file hoster
#29TL;DR: Compile SQLite to JS with emscripten, implement a virtual fs in JS to stream chunks of a statically hosted (readonly) SQL database. If queries make use of indices, only a fraction of the database needs to be downloaded. Also, you can use SQLite to query the DOM.
I can't figure out exactly how it knows which chunk to download. Does it always download the whole index first? Or does it include it in the built JS file itself?