2

Does max_length affect anything outside of the maximum number of characters you can add to a specific database field (i.e. does it affect the amount of memory that is set aside for the database?).

Would there be any unintended consequences for setting all fields to the maximum CharField length, which is ~65,000, even if it was completely unnecessary (apart from being bad practice)?

user9352220
  • 95
  • 1
  • 8

1 Answers1

1

One limitation for a CharField the max length, if you are using unique=True is 255. See the django docs here. This has to do with how the database references characters in a VarChar field.

According to this answer it does not seem that there are any size on disk benefits for limiting the max length.

tmcnicol
  • 576
  • 3
  • 14