Live data from Hacker News

Das Problem mit German Strings

polarsignals.com

21–25 of 25 posts

Re: Das Problem mit German Strings

#21
post #20

> Because it is difficult to assume what the best encoding will be for any given workload, database systems should dynamically choose encodings based on storage and workload characteristics. It would be better just to take the storage requirement on the chin and not add a gratuitous variation in encoding which will bite you on the ass somehow (or someone else). As much as possible, pick one way of doing one thing. Yo…

The combinatorial explosion problem is nicely solved by defining good interfaces. C++ gives you iterators and algorithms that work on iterators. Clojure has sequence interfaces and functions that work on all sequence types.

That just improves the organization of the program; it doesn't get rid of the increased risks of doing the same thing in N ways that could be pined down to one.

Re: Das Problem mit German Strings

#22
post #20

Earlier quoted context omitted.

The combinatorial explosion problem is nicely solved by defining good interfaces. C++ gives you iterators and algorithms that work on iterators. Clojure has sequence interfaces and functions that work on all sequence types.

That just improves the organization of the program; it doesn't get rid of the increased risks of doing the same thing in N ways that could be pined down to one.

Please elaborate. What are the risks of doing the same thing in N ways, other than code organization issues leading to duplicate or messy code?

Re: Das Problem mit German Strings

#24
post #22

Earlier quoted context omitted.

That just improves the organization of the program; it doesn't get rid of the increased risks of doing the same thing in N ways that could be pined down to one.

Please elaborate. What are the risks of doing the same thing in N ways, other than code organization issues leading to duplicate or messy code?

Do this thing in 3 ways, do that one in 4, do another one in 2 and you have 3x4x2 = 24 combinations which are entirely gratuitous compared to the 1 combination that exists if all three things are done one way each.

Oh, you don't have to test the combinations because the code is bug free, is that the argument? Which is because of some good organization?

Those things are nicely isolated so 3 + 4 + 2 unit tests, and we are done?

Re: Das Problem mit German Strings

#25
post #12

Earlier quoted context omitted.

Here is the paper in question: Umbra: A Disk-Based System with In-Memory Performance https://db.in.tum.de/~freitag/papers/p29-neumann-cidr20.pdf Section 3.1 covers string handling. This article (also linked from tfa) explains German strings in more detail. https://cedardb.com/blog/german_strings

my tl;dr: after reading the article: - two 64-bits words representation - fixed, 32 bits length - short strings ( - long strings store a 4 byte prefix in-place + pointer to the rest - two bits are used as flags in the pointer to further optimize some use-cases

Seems like they missed an opportunity to have a 8 byte version for strings that fit in the 4 byte prefix.
Post reply on HN