Re: Top -N Query performance issue and high CPU usage

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Top -N Query performance issue and high CPU usage
Date: 2026-02-03 16:07:39
Message-ID: 55d333e9-5172-4ece-9723-a64d6137acee@aklaver.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
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(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Florents Tselai 2026-02-03 16:40:49 Re: Emitting JSON to file using COPY TO
Previous Message Ron Johnson 2026-02-03 15:59:51 Re: Top -N Query performance issue and high CPU usage