[keycloak-dev] Use UUID for IDs

Bill Burke bburke at redhat.com
Wed Feb 12 09:56:50 EST 2014

On 2/12/2014 9:18 AM, Stian Thorgersen wrote:
> We've come full circle ;)
> My reasoning for not to use db generated ids are:
> * ID format would be different depending on the store (H2, MySQL, PostgreSQL, Oracle, Mongo, etc.) / for example apps will want to refer to users by id, and they need to know how to store it

Dbs will support long primary keys :)

> * What happens to a "sequences" (or whatever mechanism the db chooses to use) if you export to json, then import again. Especially if you change the underlying db (e.g. from H2 to PostgreSQL)

Export to json does not have to contain ids.  Our import format doesn't 
require ids.  I'm not even sure it honors ids :)

> Further (this is a stupid reason) if we want to support huge deployments shards will be involved, in which case it'd be simpler to use UUIDs.

That is beyond my experience so I don't have a counter argument to that.

Bill Burke
JBoss, a division of Red Hat

More information about the keycloak-dev mailing list