From: | Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> |
---|---|
To: | Rajin Raj <rajin(dot)raj(at)opsveda(dot)com> |
Cc: | pgsql-admin(at)lists(dot)postgresql(dot)org, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PostgreSQL CHARACTER VARYING vs CHARACTER VARYING (Length) |
Date: | 2020-04-28 11:46:03 |
Message-ID: | CAExHW5vcOh-X-cz_Z=pWxqCi1Bm3FmGZz_UtxT+DFCg1PPaGmA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin pgsql-hackers |
On Tue, Apr 28, 2020 at 2:53 PM Rajin Raj <rajin(dot)raj(at)opsveda(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Ashok kumar Mani | 2020-04-28 12:36:12 | failover database replication failing! |
Previous Message | Holger Jakobs | 2020-04-28 09:43:39 | Re: PostgreSQL CHARACTER VARYING vs CHARACTER VARYING (Length) |
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Frost | 2020-04-28 12:01:30 | Re: Raw device on PostgreSQL |
Previous Message | Pavel Stehule | 2020-04-28 11:41:34 | Re: proposal - plpgsql - all plpgsql auto variables should be constant |