3 ms·
The funny thing is that SQLite is faster for storing JSON blobs than the file system is: https://www.sqlite.org/fasterthanfs.html https://www.sqlite.org/fastert
by conradev 4y ago
The funny thing is that SQLite is faster for storing JSON blobs than the file system is: https://www.sqlite.org/fasterthanfs.html https://www.sqlite.org/fasterthanfs.html
I would also say that the second you need any sort of writing or mutating in any sort of production environment SQLite is also simpler than the file system!
Race conditions in file system operations are easy to hit, and files have a lot more moving pieces (directory entries, filenames, file descriptors, advisory locks, permissions, the read/write API, etc) than a simple SQL schema
Whenever I see “full-blown” next to “SQLite” there is usually some sort of misconception. It’s often simpler and more reliable than the next best option!
- jck 4y agoIt looks like sqlite is not much faster than fs on Linux. I've also found that ripgrep performs surprisingly well with folders containing large numbers of text files - this makes raw json on disk more convenient for many simple usecases which don't require complex queries.
- samatman 4y agoIt's on write that using SQLite really shines. Imagining a moderately large JSON object, a lot of them actually, not hard to read or write exactly but they do carry some common references. SQLite can: only rewrite the changed fields with a query, and transact the update across the objects. The filesystem can do atomic swaps of each file, usually, if nothing goes wrong. SQLite would also be faster in this case, but I'm more motivated by the ACID guarantees.