Text column sizes in MySQL

Postgres works differently

See PostgreSQL: Difference between text and varchar columns for PostgreSQL-specific info

MySQL has 4 different column sizes. They are actually different data types under the hood:

type size limit schema.rb option
TINYTEXT 256 bytes size: :tiny
TEXT 65,535 bytes (default)
MEDIUMTEXT 16,777,215 bytes size: :medium
LONGTEXT 4,294,967,295 bytes size: :long

You can also specify a column size with the limit option. This will take an integer value in bytes and convert it to the next biggest available column type that can accommodate this amount of data.

Klaus Weidinger 12 days ago