Re: Top -N Query performance issue and high CPU usage
Adrian Klaver <adrian.klaver@aklaver.com>
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Ron Johnson <ronljohnsonjr@gmail.com>,
"pgsql-generallists.postgresql.org" <pgsql-general@lists.postgresql.org>
Date: 2026-02-03T16:07:39Z
Lists: pgsql-general
On 2/3/26 07:59, Ron Johnson wrote: > > > There is no VARCHAR or CHAR; there is only TEXT. Thus, this is 100% > expected and normal. What Ron is saying is that there are varchar and char types, but they boil down to text per: https://www.postgresql.org/docs/current/datatype-character.html "text is PostgreSQL's native string data type, in that most built-in functions operating on strings are declared to take or return text not character varying. For many purposes, character varying acts as though it were a domain over text." As to performance see: " 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. " > > -- > Death to <Redacted>, and butter sauce. > Don't boil me, I'm still alive. > <Redacted> lobster! -- Adrian Klaver adrian.klaver@aklaver.com