CapnSpek commented on issue #995: URL: https://github.com/apache/age/issues/995#issuecomment-1605209822
I think I have something really good here. Skipping the part of how I discovered it, (you can test it yourself) The first vertex created of any graph in any database with any name, any label, any number of properties and any values have this particular id: 844424930131969 Now when you create a vertex with the same label again, the next vertex simply gets the +1 id. (SAME LABEL IS IMPORTANT). However, when you create a vertex with another label (the label name does not matter, neither do the properties), it will get exactly this id: 1125899906842625 And the difference of the id of the first vertex with first label and id of the first vertex with second label is exactly: 281474976710656 Now this is important. Again, next when you create a vertex with second label (any properties) it will simply get second label vertex 1 id + 1 id. When you create a vertex with a third label (new label), it will get exactly this id irrespective of the properties: 1407374883553281 Again the difference of first vertex of third label and first vertex of second label is exactly: 281474976710656 Again, if you create another vertex with third label it will get first vertex of third label + 1 id. If you create a vertex with a new label (fourth label), again, irrespective of properties it will get exactly this id: 1688849860263937 And again the difference of ids of first vertex of fourth label and first vertex of third label is exactly: 281474976710656 My point being, vertex ids are not exactly tied to labels in the sense that they are tied of label names. Instead, they are tied to which numberth created label it was. Ids of vertices with first label of any created graph start with: 844424930131969 Then its a simple incrementing series for all next vertices. In case a vertex is deleted, its id is not reused, instead, the next created vertex gets the incremented last used id. Ids of vertices with second label of any created graph start with: 1125899906842625 Then it simply increments for all next vertices. And the difference between any two labels (their first vertices) is always 281474976710656. It seems this is how AGE keeps track of which label to look into. For example if there's a query MATCH (n:second_label) RETURN n Then it can simply look for vertices with ids starting from 844424930131969 + 281474976710656. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@age.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org