Opened 11 years ago
Closed 11 years ago
#23139 closed Uncategorized (duplicate)
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 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
see as well https://code.djangoproject.com/ticket/23138 which asks for min_length to be added to models.fields.Field.
For optimization purposes, if I have a model that wants exactly N characters for a field, then CHAR uses less bytes than VARCHAR.
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?).
Change History (2)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
| Resolution: | → duplicate |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Six years ago, this was discussed (and closed wont fix) in #9349.