Auto-generated IDs VS Dgraph UIDs

It would be advisable or not to use auto-generated ID (SQL Server bigint) as the Dgraph uid? So one can set the uid explicitly in all mutations rather than use the auto-increment ID generated from the xid. Are there any downside here.

I’m thinking about possible conflicts between auto-generated uids and dgraph generated uid, is this a “possible” downside? Are there any other downsides ?

1 Like

To manage your own UIDs you can use the /assign?what=uids endpoint on Zero: It’ll return a range of UIDs like so:

$ curl 'localhost:6080/assign?what=uids&num=1000'

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.