dcramer / django-uuidfield

A UUIDField for Django
BSD 3-Clause "New" or "Revised" License
262 stars 115 forks source link

Support for BinaryField in Django 1.6+ #37

Closed kevinlondon closed 10 years ago

kevinlondon commented 10 years ago

As of 1.6, BinaryField has been added to Django, which enables the kind of storage you mentioned originally wanting for UUIDs.

Although, based on a look at the Django source code, it looks like BinaryField is actually stored as a "longblob" in my MySQL, which has a different size requirement than 16 bytes. In this case, it would be up to 20 bytes total for the field, according to the documentation on MySQL Storage Requirements.

One more potential downside is that, according to the docs, you cannot filter on a BinaryField. So, overall, this might not be that useful or we might have to do more work to add filter support.

Would it be a good idea to add this?

Other links:

kevinlondon commented 10 years ago

After doing some testing, I don't think it's worthwhile to implement a Django BinaryField version of the UUID. It may, however, be worthwhile for some users to implement a binary(16) version still, as that's about 70% faster