Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jTMmO-0007bo-Bi for pgsql-admin@arkaria.postgresql.org; Tue, 28 Apr 2020 09:43:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jTMmN-0000Mn-27 for pgsql-admin@arkaria.postgresql.org; Tue, 28 Apr 2020 09:43:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jTMmM-0000Mg-R0 for pgsql-admin@lists.postgresql.org; Tue, 28 Apr 2020 09:43:50 +0000 Received: from jakobs.com ([85.214.83.89] helo=rs.plausibolo.de) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jTMmK-0006rq-9p for pgsql-admin@lists.postgresql.org; Tue, 28 Apr 2020 09:43:49 +0000 Received: from localhost (localhost [127.0.0.1]) by rs.plausibolo.de (Postfix) with ESMTP id 1E6B7BE014B for ; Tue, 28 Apr 2020 11:43:43 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at rs.plausibolo.de Received: from rs.plausibolo.de ([IPv6:::1]) by localhost (h2367442.stratoserver.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 0kpQZAfqsDTa; Tue, 28 Apr 2020 11:43:40 +0200 (CEST) Received: from [192.168.178.97] (ip-37-201-154-65.hsi13.unitymediagroup.de [37.201.154.65]) by rs.plausibolo.de (Postfix) with ESMTPSA id 6F02ABE007F; Tue, 28 Apr 2020 11:43:40 +0200 (CEST) Subject: Re: PostgreSQL CHARACTER VARYING vs CHARACTER VARYING (Length) To: pgsql-admin@lists.postgresql.org References: From: Holger Jakobs Message-ID: Date: Tue, 28 Apr 2020 11:43:39 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------921FF6D724CD101209C46B61" Content-Language: de-DE List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------921FF6D724CD101209C46B61 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit No, there is no impact. Am 28.04.20 um 11:22 schrieb Rajin Raj: > 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)); > > insert into test_1 ... 10M records > insert into test_2 ... 10M records > > vacuum (full,analyze) db_size_test_1; > vacuum (full,analyze) db_size_test_2; > > Which option is recommended? > > *Regards,* > *Rajin * -- Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012 --------------921FF6D724CD101209C46B61 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

No, there is no impact.

Am 28.04.20 um 11:22 schrieb Rajin Raj:
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));

insert into test_1 ... 10M records
insert into test_2 ... 10M records

vacuum (full,analyze) db_size_test_1;
vacuum (full,analyze) db_size_test_2;

Which option is recommended? 

Regards,
Rajin 
-- 
Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012
--------------921FF6D724CD101209C46B61--