Performance: Field options (max_length, null, blank, default)
MEDIUM IMPACT
These field options affect database schema size, query speed, and form validation performance.
name = models.CharField(max_length=100, blank=True, default='')
name = models.CharField(max_length=255, null=True, blank=True)
| Pattern | Database Size | Query Complexity | Index Size | Verdict |
|---|---|---|---|---|
| CharField with null=True | Larger due to NULL storage | Higher due to NULL checks | Larger | [X] Bad |
| CharField with blank=True and default='' | Smaller | Lower | Smaller | [OK] Good |
| CharField with large max_length | Normal | Normal | Very Large | [X] Bad |
| TextField for large text | Normal | Normal | Small | [OK] Good |
| Field with default=None | Larger | Higher | Larger | [X] Bad |
| Field with meaningful default | Smaller | Lower | Smaller | [OK] Good |