Changes between Initial Version and Version 1 of Ticket #24082, comment 5


Ignore:
Timestamp:
Jan 6, 2015, 11:00:45 PM (10 years ago)
Author:
djbug

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #24082, comment 5

    initial v1  
     1> Imposing uniqueness on text columns is almost always nonsense.
     2
     3For PostgreSQL, `CharField` maps to `varchar(n)` and `TextField` maps to `text`. According to the official docs, there's no performance difference between the two. Most DBA recommend `text` over `varchar(n)` ([http://stackoverflow.com/a/20334221/781695 Ref 1]) ([http://blog.endpoint.com/2012/11/postgres-alter-column-problems-and.html Ref 2]). That said, the above discussion about unique & index is true for `CharField` too as far as Django is concerned.
    14
    25> the issue here really is whether `unique=True` implies `db_index=True`. This holds for most field types, so I think most people would expect it to hold for text fields as well.
Back to Top