Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why is the default key size 21 byte?

byte Default key size
0
Posted

Why is the default key size 21 byte?

0

hamsterdb tries to take advantage of modern processor’s caching mechanism. Cache lines are usually 32 bytes large. Each Database key has an internal overhead of 11 bytes. If the total key size is 32 bytes, and you substract the overhead of 11 bytes, the remaining 21 bytes are for the key data. Benchmarks show that a total key size of 32 bytes result in a (small) performance advantage (i.e. compared to a size of 40 or 50 bytes). However, if your keys are smaller, a total key size of 16 bytes (which means a payload of 5 bytes) would be better, because more keys would fit on a Database page, and less page splits would happen.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123