New ask Hacker News story: Ask HN: Is SQLite suitable for command sourcing application?

Ask HN: Is SQLite suitable for command sourcing application?
2 by aabbcc1241 | 1 comments on Hacker News.
I used to work with LevelDB (with typescript). It's very easy and fast to develop with. Recently I'm playing with sqlite, aim to save some disk space by normalizing the data. I spend quite some time to define the tables and write insert queries in normalized format. I even try to "compact the data" by using a table to store all unique string then reference to it's primary key. I suppose storing the data in the rigid and compact format should result in smaller file size but it seems I am wrong. The data I'm storing are immutable request log (timestamp, type, and input) for command-sourcing style of server. The current state of server are not persisted. Each time the server is restarted, it just replay all the request logs to restore the state. The architecture is inspired from cqrs and event sourcing, except the write model is simply the storage, the read model is in a single process's memory, and it's sourcing from the commands, not events. (Though some kind of attempt-commands spawn verified-commands and are skipped when replay to avoid applying side-effect twice) File size for reference: JSON Files 409M, SQLite 114M, LevelDB 63M. The SQLite file is smaller than LevelDB after zip, but access sqlite over zip file doesn't sound a good solution.

Comments