Re: Which is faster: char(14) or varchar(14)

From: hari(dot)fuchs(at)gmail(dot)com
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Which is faster: char(14) or varchar(14)
Date: 2012-12-04 16:59:21
Message-ID: 87hao1pxcm.fsf@hf.protecting.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Edson Richter <edsonrichter(at)hotmail(dot)com> writes:

> In this specific case, the full length (14) is mandatory... so seems
> there is no loss or gain.
> Also, I see all varchar(...) created are by default "storage =
> EXTENDED" (from "Pg Admin"), while other datatypes (like numeric,
> smallint, integer) are "storage = MAIN".
> Can I have a gain using fixed length datatype in place of current
> varchar (like "numeric (14,0)")?
> Or changing to "char(14) check length(doc)=14" and "storage=MAIN"?

Sounds like premature optimization to me. I'd first express what I want
as clear as possible, e.g. "CREATE DOMAIN BrazilianCompanyId AS char(14)",
and try to spot and fix performance problems when I'm done with all that.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Edson Richter 2012-12-04 17:06:05 Re: Which is faster: char(14) or varchar(14)
Previous Message Edson Richter 2012-12-04 15:01:13 Re: Which is faster: char(14) or varchar(14)