What is the importance of specifying the size of a field in the field?

Asked

Viewed 203 times

5

I would like to know if it really is, and why it is important to pre-specify the size of some string/text/... field in the Migrations in the Laravel. From what I imagine, maybe these specifications save space dedicated to each field, but :

- will save in a really significant way ?
- will be that the field in Mysql is no longer adaptable to the required size with some kind of predefined limit according to field typing ?

1 answer

5


In general, for a field VARCHAR, the amount of data stored in each field determines its footprint on the disk instead of the maximum size (as opposed to a field CHAR that always has the same footprint).

There is an upper limit on the total data stored in all fields of an index of 900 bytes ( index size limit of 900 bytes in the character length ).

The bigger you make the field, the more likely people will try to use for purposes other than what you intended, then it is good practice to try to choose the right size, rather than assume that if you are as big as possible, it will save you having to revisit the design.

Source

  • What is a "footprint"?

  • Disc quantity

Browser other questions tagged

You are not signed in. Login or sign up in order to post.