Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
05-30-2019 09:39 AM
for Neo4j enterprise :
Solved! Go to Solution.
05-30-2019 01:44 PM
In general we would not recommend using a Cypher solution to implement a sequence id, as you'd likely run into race conditions against concurrently running queries. We'd recommend sticking with a UUID instead.
Keep in mind that one huge case for sequence IDs in SQL is as foreign keys between tables to relate entries to each other, and this isn't needed in Neo4j as we use relationships instead, which are not dependent upon these (they are dependent upon the graph ids Neo4j automatically assigns to nodes, but these are not guaranteed to be sequential, as they can be reused after node deletion, and that same characteristic can make them a bad fit for saving outside of Neo4j as a means of node lookup).
05-30-2019 10:13 AM
2.https://neo4j.com/docs/cypher-manual/current/schema/constraints/
05-30-2019 11:18 AM
thanks you for reply.
apoc.create.uuid() The string is a guid.
Does it create problems for performance?
I must create a unique id number-based?
05-30-2019 11:39 AM
do you mean sequence number, as a node property for the data ?
05-30-2019 12:49 PM
Yes. for node propery id
05-30-2019 01:07 PM
If you want to have integer based number that mimics a row_number for distinct elements you could do something like:
Match (n:User) with n limit 10 with apoc.coll.zip(range(1,length(collect(n))),collect(n)) as pairs unwind pairs as pair return pair
Now you could take pair[0] and set it as a property on pair[1]
05-30-2019 01:44 PM
In general we would not recommend using a Cypher solution to implement a sequence id, as you'd likely run into race conditions against concurrently running queries. We'd recommend sticking with a UUID instead.
Keep in mind that one huge case for sequence IDs in SQL is as foreign keys between tables to relate entries to each other, and this isn't needed in Neo4j as we use relationships instead, which are not dependent upon these (they are dependent upon the graph ids Neo4j automatically assigns to nodes, but these are not guaranteed to be sequential, as they can be reused after node deletion, and that same characteristic can make them a bad fit for saving outside of Neo4j as a means of node lookup).
05-30-2019 03:22 PM
thanks you.
i am trying to learn new
All the sessions of the conference are now available online