0

Let's assume that in some particular case I know that I will need CharField for single words. I wonder does the length of CharField influences the performance of the query, or the size of DB when it's defined as bigger.

In this case, I assume that all data fit the size of CharField because - let's assume - that in every row in the column each cell has a word with length 3. For example:

enter image description here

What changes when I define the length of CharField to 3, or 250?

I'm aware that there are (many) other reasons to define CharFiled in some way (define a particular allowed range), but are there any reasons to try to make the available range smaller for the sake of performance or the size of DB? Is it worth considering and if so, when?

Would it be the same for SQLite and PostgreSQL?

Paweł Pedryc
  • 368
  • 2
  • 5
  • 19

1 Answers1

1

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

ilyasbbu
  • 1,468
  • 4
  • 11
  • 22