3 ms·
Usually, when you compress, it's with, say, gzip, rather than something custom for the data. The compression dictionary is kinda implicitly built and encoded al
by pronoiac 9y ago
Usually, when you compress, it's with, say, gzip, rather than something custom for the data. The compression dictionary is kinda implicitly built and encoded along with the data.
If you have, like, some standard data (handwave), you can build a dictionary of frequently-used terms and refer to it when you compress and decompress, and you can get better compression for being able to point at that pre-built dictionary.
I might be totally offbase here, as I think database normalization would remove much of the redundancy that a dictionary would target.
- smueller1234 9y agoDatabase normalization has little to do with this. It's about structurally removing redundancy from your schema. Like not having the same column and data twice in two tables. It's not going to do anything if you have two rows with common data such as two people with the same first name. In the context of compression, dictionaries also don't generally correspond to a set of words or records per se but rather arbitrary (sub)strings or blobs.
- mbreese 9y agoI think they were trying to say if you had a normalized database where instead of repeated varchar fields, you had a foreign key — that would act like a dictionary. CREATE TABLE customer( id SERIAL, name VARCHAR(1024), status VARCHAR(1024) ) Vs CREATE TABLE customer( id SERIAL, name VARCHAR(1024), status INT REFERENCES status(id) ) CREATE TABLE status( id SERIAL, name VARCHAR(1024), ) It wasn’t very clear from the parent above, but I think this is where they were trying to go. The normalized version is smaller because you’ve swapped a repeated varchar ‘status’ for an int — so that’s effectively a dictionary. It’s not entirely correct, but it’s not that far off.
- smueller1234 9y agoThat makes sense, thanks for pointing out my misreading of the parent comment.