Search code examples
arangodbarangojspyarangopython-arangoarangodb-php

arangodb document key length best practice


I am wokring on arangodb and was wondering weather doucment key size will affect database size.

I am not sure how arango db stores data but does key length of document affects db size ?

{
'username': 'testuser',
'password': 'testpass'
.
.
.
.
}

VS

{
'u': 'testuser',
'p': 'testpass'
.
.
.
.
}

Solution

  • ArangoDB internally uses a format called VelocyPack to persist your data. VelocyPack is designed to be more compact than JSON, however, it still has to keep attribute names. So yes, attribute names are part of the documents stored in the database, and they therefore do have an effect on the size. That said, I would still recommend to always go with longer and more descriptive names, so prefer "username" and "password" over "u" an "p".

    Lower levels in RocksDB will typically be compressed and duplicated attribute names should provide a pretty good compression factor, so size of attribute names should be less of a concern.