Taylor Mitchell
Taylor Mitchell

Reputation: 613

Generating a unique numeric id in neo4j

I am aware of the UUID module but as far as I know that module does not allow you to use only numeric characters. We expect our database to have millions of records and a number search is faster than a character search.

Is there a better way of generating a unique ID for each node?

If you tell me to use UUID, in traversing a graph database with millions and a possible billion of nodes how badly would the performance suffer?

Upvotes: 1

Views: 1590

Answers (1)

Christophe Willemsen
Christophe Willemsen

Reputation: 20175

The property type used for a single lookup will not differ by using numbers or uuid strings, it will always remain an O(1)+1 operation (if you back it up by a unique constraint).

On another side, the uuid module benefit recently from a sequential ID generator that you can choose instead of the default uuid generator :

https://github.com/graphaware/neo4j-uuid/blob/master/README.md#specifying-the-generator-through-configuration

Upvotes: 5

Related Questions