I read that it is possible to compress sqlite databases with extensions like sqlite-zstd.
In Sqlite3, are there methods, ready to use in Python, that allow both:
- compression of a text column (let's say 1 billion of rows, with at least one text column of < 20 characters)
- keep the fast lookup that we have when this column has an INDEX (and even full text search e.g.
LIKE 'foo%'
)
?
I was about to write some code with LZ4-compressed rows, but then a single search/lookup would require a full scan (to decompress all values to see if there is match).
Are there Sqlite techniques adapted to this (or other data structures)?
LIKE %foo%
FTS requirement and only keep theLIKE foo%"
prefix search, for which a B-tree is probably ok. Would you have an example of compressed Sqlite code, in Python? Would be very interesting :) – WindsuckingLIKE 'foo%'
standard index is enough. – HarmonCREATE TABLE data (id INTEGER PRIMARY KEY, description TEXT)
CREATE UNIQUE INDEX idx ON data(description);
3) no other column except an ID for this simple example but in real code, there might be another integer or text column (without index) 4) I want to be ready for 1 billion of rows, average char length ofdescription
is 20 characters, always < 32. 5) only prefix is ok to start with"foo%"
– Windsucking