From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Edson Richter <edsonrichter(at)hotmail(dot)com> |
Cc: | Sergey Konoplev <gray(dot)ru(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Which is faster: char(14) or varchar(14) |
Date: | 2012-12-04 21:14:55 |
Message-ID: | CAFj8pRAY=iYRAWKf+qK+dc0nHg-KiK_06JPWzz4ABznUSJJF0g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello
2012/12/4 Edson Richter <edsonrichter(at)hotmail(dot)com>:
> Em 04/12/2012 18:49, Sergey Konoplev escreveu:
>
>> 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.
>
>
> Yes, good education as well. I've read, and I'll consider the different
> datatypes and more domain use in future.
>
> But I don't see much changes in our schema, so using varchar(14) seems to be
> as good as text.
>
> My experience with other databases (MS SQL Server and Oracle) seems to not
> apply 1:1 here (I've studied MSSQL internals and - at least up to 2005
> version - is much more efficient with char than with varchar than with text
> - for all operations).
sure - PostgreSQL has different design than "older" SQL servers that
was developed for fixed length records. So some knowledges related to
these databases are wrong here.
Regards
Pavel Stehule
>
> Thanks again,
>
> Edson
>
>
>
>>
>> --
>> 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
>>
>>
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
From | Date | Subject | |
---|---|---|---|
Next Message | Bryan Montgomery | 2012-12-04 21:59:21 | Postgresql logfilename and times in GMT - not EST |
Previous Message | Edson Richter | 2012-12-04 21:09:16 | Re: Which is faster: char(14) or varchar(14) |