mysql backend should use CHAR instead of VARCHAR if model has a CharField of fixed length.
|Reported by:||Damien Nozay||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.6|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
see as well https://code.djangoproject.com/ticket/23138 which asks for min_length to be added to
For optimization purposes, if I have a model that wants exactly N characters for a field, then
CHAR uses less bytes than
One way to detect that intent is if you have
CharField(min_length=N, max_length=N) -- in other words
min_length == max_length.
common example: a hash always has the same length (always?).