What is the difference between randomUUID and GraphAware UUID ? which one should i use to generate UUID ?
https://neo4j.com/docs/cypher-manual/3.5/functions/scalar/#functions-randomuuid is a shortuct of implementation UUID (Java Platform SE 8 )
i'm not familiar with the innerworkings of GraphAware's implementation
GraphAware's implementation is the same.
Will it generate unique ID everytime when using it in query ? or should i use GraphAware ?, GraphAware need two statements to return UUID, CREATE statement and then MATCH statement (cause it runs on the server). @bob.bierman
If your use case is just to manually generate a UUID from a function, then they should be functionally identical. GraphAware implemented this before we included it in the product, but it's important enough that we added UUID generation in as well.
I believe GraphAware's UUID module covers more than just this, doing automatic assigning of UUIDs to nodes and relationships and extra validation on top of that.
We installed the GraphAware uuid generator as a plugin to automatically create distinct uuid's on every node added, and it works well for that (it has configurable options to generate uuid's only on specific node and relationship types, or use your own generator function, and some other options, if desired). In my java code however, I call the java.util function and use that value directly in the uuid property of CREATE statements because (as you note) the GA plugin requires a separate call to retrieve the newly added node's uuid, and this approach negates the need for that call. Note that if you supply the uuid property on a CREATE/MERGE for a new node, then GA will not override that field, it uses what you supply. Note also that you cannot change a uuid property on an existing node (no matter how it was added), GA will throw an exception.
And yes, the generator method creates a universally distinct value on every call, statistically speaking.