VARCHAR and TEXT in PostgreSQL

There is not performance between varchar and text datatype in PostgreSQL. The use of varchar and text are interchangeable. To quote the PG doc (bold emphasis by me.),
"Tip: 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."
Further discussion at Reddit.

No comments:

Post a Comment