3 ms·
No. If you did that, SQLite would have to (logically) decompress about your entire database on every query. For example, how would it read the database schema t
by Someone 4y ago
No. If you did that, SQLite would have to (logically) decompress about your entire database on every query. For example, how would it read the database schema to determine whether “select foo from bar” is valid sql for the database? If it figures that out, how would it figure out there’s an appropriate index to use? How would it read that index?
Databases do a lot of seeking into database files and typically only read a small part of them. That’s not a scenario that’s a good fit with whole-file compression.
Compressing individual pages is a bit better, but I think this can still be better.
Your file system probably would cache the decompressed database file, but that would use memory, lots of it if your database is large.
- formerly_proven 4y agoFS-level compression is usually limited to compressing relatively small blocks (think ~dozens of sectors), they don't normally compress a large file as a single solid block.
- Someone 4y agoYes, but still, the file system would do more decompression than needed, and that will cost performance (CPU and caching)