Re: Top -N Query performance issue and high CPU usage - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Top -N Query performance issue and high CPU usage
Date
Msg-id 55d333e9-5172-4ece-9723-a64d6137acee@aklaver.com
Whole thread Raw
In response to Re: Top -N Query performance issue and high CPU usage  (Ron Johnson <ronljohnsonjr@gmail.com>)
Responses Re: Top -N Query performance issue and high CPU usage
List 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



pgsql-general by date:

Previous
From: Ron Johnson
Date:
Subject: Re: Top -N Query performance issue and high CPU usage
Next
From: yudhi s
Date:
Subject: Re: Top -N Query performance issue and high CPU usage