Thursday, October 27, 2016

Re: Downside of using shortuuid as primary key

Hi,

I've inherited a project where a core model was done like this, and let me tell you right away: don't do this

The performances don't seem too much affected (see comment below the answer), but I do know there are a few limitations that come with it, and changing it later is not a straightforward operation. The first limitation that comes to my mind is with GenericForeignKey. It expects the object ID to be an integer. Even if you don't use that feature directly, some libraries that you might need, will, and you'll be blocked from using them.

On Thursday, 27 October 2016 05:34:14 UTC+1, Suren Sth wrote:
I am considering to use shortuuid as the primary key for my models.

Is there any downside to this?
Does it severely affect db indexing?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a747ce0d-cc3b-40cb-b7c0-38adfb5ba23b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment