2 ms·
Fun fact: Postgres is one of the few databases to do this right. "varchar" is just an alias for the "text" data type, which has a limit of 2GB (last I checked).
by lobster_johnson 9y ago
Fun fact: Postgres is one of the few databases to do this right. "varchar" is just an alias for the "text" data type, which has a limit of 2GB (last I checked). A small amount of text is stored inside the row, and the overflow is compressed and stored in a series of linked child rows. The system is called TOAST, and quite fast. So the underlying storage is completely abstracted, and setting a limit doesn't impact storage; it only enforces a limit on what input is allowed. MySQL's text type, on the other hand, is like a binary blob and has (last I checked) different semantics than the varchar type.