3 ms·
The decision to embed SQLite had more to do with query capabilities than storage. We need to expose a query interface that is both flexible and powerful, and id
by mstade 7y ago
The decision to embed SQLite had more to do with query capabilities than storage. We need to expose a query interface that is both flexible and powerful, and ideally it’s not something esoteric. We need something BAs can pick up without much or any additional training. With SQLite we both get the query engine and storage, but really it’s the former that’s important. While it may have started as a “what if” kind of PoC I think it’s gonna stick, unless we can find something that essentially gives us SQL the query language (superset is fine, subset not so much) and whatever storage backend is available, be it IndexedDB or something else. We tried various options, like AlaSQL and others, but embedding SQLite was pretty painless and gives a lot of bang for the buck.
The only downside so far is that the embedded size is quite large, so we do take a small hit in startup latency (sub second still) and if we ever end up having a requirement to work across the internet (I doubt it) it’s going to hurt because we’d be looking at a 3mb+ download (quite cacheable though.)
Anyway, point is our need was mainly SQL the language and not so much the storage, that’s kind of secondary, though SQLite really makes that part easy too.
- exikyut 7y agoThe thing is, I can't/don't disagree with you, in terms of arguing for SQLite over alternatives. Hearing the practical specifics of your edge case is (depressingly) insightful. I just realized the links I posted didn't include the article I had in mind when I went link-digging (and didn't properly check the results, woops). I found it: https://nolanlawson.com/2014/04/26/web-sql-database-in-memoriam/ https://nolanlawson.com/2014/04/26/web-sql-database-in-memor... Potentially interestingly, I re-found the link above via hn.algola.com, which also found me the comments (for the only time the above link was posted), at https://news.ycombinator.com/item?id=7661236 https://news.ycombinator.com/item?id=7661236. The top comment thread there points to https://github.com/kripken/sql.js https://github.com/kripken/sql.js, which was started pre-WebAssembly but now builds for WASM, and the network tab in devtools is telling me it's a 497KB download. It says it takes the position of providing a first-class JavaScript API instead of C bindings, and that you have to implement your own save/load<->import/export layer. You may have already discovered and discarded this possibility. FWIW, if using SQLite does stick, I reckon that an article (even a small one) about the journey/decision process/implementation gotchas/etc - and particularly details about the use cases, and why SQLite shines for your scenario - would probably be received very positively. Thanks for replying! (My fast response time was due to fun timing: I literally just opened my laptop this morning, checked HN, and saw your comment posted "0 minutes ago" :D)