Swap
Swap

Reputation: 175

In mysql, why varchar require size and text does not?

Why does varchar require a specific size but text does not?

Upvotes: 1

Views: 48

Answers (1)

arkascha
arkascha

Reputation: 42984

Obviously columns of type text also require storage space, but there is one fundamental difference to columns of type char or varchar:

The content of columns of type text is not stored inside the table itself, but at a separate location. That way the table itself does not get bloated by the huge space text cells actually require.

In contrary to that the cells of column types char or varchar are store right inside the table. Thus their size is considered in things like maximum index length and the like.

Upvotes: 3

Related Questions