So we can generate a unique id with str(uuid.uuid4()), which is 36 characters long. Is there another method to generate a unique ID which is shorter in terms of characters? EDIT: If ID is usable as primary key then even better Granularity should be better than 1ms This code could be distributed, so we can't assume time independence. Continue reading...