The Postgres manual states that varchar and text don't have any real performance difference, and having a hard limit on a varchar just means that's one extra exception the database might raise. We can enforce lengths in the Java type system more efficiently.
There is no performance difference among these three types, apart from increased storage space when using the blank-padded type, and a few extra CPU cycles to check the length when storing into a length-constrained column. While character(n) has performance advantages in some other database systems, there is no such advantage in PostgreSQL; in fact character(n) is usually the slowest of the three because of its additional storage costs. In most situations text or character varying should be used instead.
The Postgres manual states that
varchar
andtext
don't have any real performance difference, and having a hard limit on avarchar
just means that's one extra exception the database might raise. We can enforce lengths in the Java type system more efficiently.https://www.postgresql.org/docs/current/datatype-character.html