What if you used some id that does not allow to count objs like guid?

Uuid4 is extremely random, which makes it bad for most database indexes. You can use uuid7 instead.

Uuid7 would not have helped GitHub, though, because it doesn't solve the sharding issue.