Running long identifiers

I have been wondering about this for some time. In CouchDB, we have several log identifiers ... for example:

"000ab56cb24aef9b817ac98d55695c6a"

Now, if we look for this element and look at the tree structure created by the view. It seems to be a simple integer, since the identifier will be much faster. If we were to use 64-bit integers, that would be plain CMP, followed by JMP (assuming the Erlang code uses JIT, but you understand my point).

For strings, I assume that we generate a hash from an identifier or something else, but at some point we must perform a character comparison on all 33 characters ... will this not affect performance?

+5
source share
2 answers

Short answer: yes, of course, this will affect performance, because the length of the key will directly affect the time required to navigate the tree.

This also affects storage, since longer keys take up more space and space takes time.

However, the nuance you need is that while Couch CAN (and does) allocated you new identifiers, this is not required. He will be more than happy to accept your own identifiers, rather than generate them. So, if the key length bothers you, you can use shorter keys.

, "json" , "" . , Couch ( , , , , BASE64, ).

, , , 64-, , Couch , " " .

, , - JSON- ( ). , ​​, , .

Couch, , 64- , ( ). 8 64- "long int". , , 8- . erlang , .

+2

CouchDB: :

- , , btree, UUID, , , . ids, , . . , , .

, , , , , .

+2

All Articles