Re: Overhead changing varchar(2000) to text

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: Overhead changing varchar(2000) to text
Дата
Msg-id CACjxUsNs9jiy4-PCjQgcZLimU-6Xw7zqxyCoAKAr-DzeTp-0NA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Overhead changing varchar(2000) to text  (Kevin Grittner <kgrittn@gmail.com>)
Список pgsql-general
On Wed, Dec 9, 2015 at 5:17 PM, Kevin Grittner <kgrittn@gmail.com> wrote:
> On Wed, Dec 9, 2015 at 5:13 PM, Edson Richter <edsonrichter@hotmail.com> wrote:
>
>> I do have several tables that uses varchar(2000) as store for remarks.
>> Lately, one customer need to store more than 2000 characteres, and I'm
>> considering changing from varchar(2000) to text.
>>
>> What is the overhead?
>
> None -- they are stored in exactly the same format; the only
> difference is whether the length is limited.

I probably should have mentioned that an ALTER TABLE to change the
column type from varchar(2000) to text does not rewrite the data
(since it is in the same format) -- it just changes the catalogs to
reflect the lack of a limit on length.  Changing the other way
would require a pass to check that all existing data passes the
length check.

>> Is there any place where I can learn about storage impacto for each data
>> type?
>
> http://www.postgresql.org/docs/current/interactive/datatype-character.html

While it's fairly technical, you might also be interested in this:

http://www.postgresql.org/docs/current/interactive/storage-toast.html

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


В списке pgsql-general по дате отправления:

Предыдущее
От: Kevin Grittner
Дата:
Сообщение: Re: Overhead changing varchar(2000) to text
Следующее
От: Edson Richter
Дата:
Сообщение: Re: Overhead changing varchar(2000) to text