Re: PostgreSQL CHARACTER VARYING vs CHARACTER VARYING (Length)

Поиск
Список
Период
Сортировка
От Ashutosh Bapat
Тема Re: PostgreSQL CHARACTER VARYING vs CHARACTER VARYING (Length)
Дата
Msg-id CAExHW5vcOh-X-cz_Z=pWxqCi1Bm3FmGZz_UtxT+DFCg1PPaGmA@mail.gmail.com
обсуждение исходный текст
Ответ на PostgreSQL CHARACTER VARYING vs CHARACTER VARYING (Length)  (Rajin Raj <rajin.raj@opsveda.com>)
Ответы Re: PostgreSQL CHARACTER VARYING vs CHARACTER VARYING (Length)  (Holger Jakobs <holger@jakobs.com>)
Список pgsql-admin
On Tue, Apr 28, 2020 at 2:53 PM Rajin Raj <rajin.raj@opsveda.com> wrote:
>
> Is there any impact of using the character varying without providing the length while creating tables?
> I have created two tables and inserted 1M records. But I don't see any difference in pg_class. (size, relpage)
>
> create table test_1(name varchar);
> create table test_2(name varchar(50));

I don't think there's a difference in the way these two are stored
on-disk. But if you know that your strings will be at most 50
characters long, better set that limit so that server takes
appropriate action (i.e. truncates the strings to 50).

-- 
Best Wishes,
Ashutosh Bapat



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

Предыдущее
От: Holger Jakobs
Дата:
Сообщение: Re: PostgreSQL CHARACTER VARYING vs CHARACTER VARYING (Length)
Следующее
От: Ashok kumar Mani
Дата:
Сообщение: failover database replication failing!