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

From: Sergey Konoplev <gray(dot)ru(at)gmail(dot)com>
To: Edson Richter <edsonrichter(at)hotmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Which is faster: char(14) or varchar(14)
Date: 2012-12-04 20:49:15
Message-ID: CAL_0b1vTOR026zf31zTCQS9UNGVRfBAXnCgdXb+pzoybE=Zqsw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Dec 4, 2012 at 5:57 AM, Edson Richter <edsonrichter(at)hotmail(dot)com> wrote:
> 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"?

May be I am late with my reply but I would also recommend to take into
consideration the article from depesz where he explains and tests all
the textual types
http://www.depesz.com/2010/03/02/charx-vs-varcharx-vs-varchar-vs-text/.

Very useful one.

--
Sergey Konoplev
Database and Software Architect
http://www.linkedin.com/in/grayhemp

Phones:
USA +1 415 867 9984
Russia, Moscow +7 901 903 0499
Russia, Krasnodar +7 988 888 1979

Skype: gray-hemp
Jabber: gray(dot)ru(at)gmail(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Frank Cavaliero 2012-12-04 20:50:36 pg_shadow and pgcrypto
Previous Message Paul Jungwirth 2012-12-04 20:07:02 Re: UPDATE using subquery with joined tables