Auto-generated IDs VS Dgraph UIDs

To manage your own UIDs you can use the /assign?what=uids endpoint on Zero: https://dgraph.io/docs/deploy/#more-about-dgraph-zero. It’ll return a range of UIDs like so:

$ curl 'localhost:6080/assign?what=uids&num=1000'
{"startId":"2","endId":"1001"}

This range between startId and endId you can use in your own mutations to create nodes. Any nodes created via blank nodes would have UIDs above this lease and not conflict with this given range.

SQL Server bigints are signed int64 (max 2^63-1). Dgraph UIDs are unsigned int64 (max 2^64-1), so you should be OK with SQL Server bigints as long as you stay in the positive range.

2 Likes