Wednesday, November 27, 2013

PostgreSQL: Don't Use CHAR or VARCHAR (blog.jonanin.com)

Earlier this week, while browsing some stack overflow questions about postgres' textual data types, I came across a link to a set of benchmarks that compare the performance of the CHAR, VARCHAR, and TEXT types in PostgreSQL — I highly recommend reading through the article if you have the time. It turns out that many variable length data types (and some that are fixed length, like CHAR) are represented internally with the same varlena data structure, which is simply a byte array prefixed with a 32-bit length field. Read more...