Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gBzMj-00086f-9B for pgsql-general@arkaria.postgresql.org; Mon, 15 Oct 2018 09:40:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gBzMg-0003lT-1O for pgsql-general@arkaria.postgresql.org; Mon, 15 Oct 2018 09:40:42 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gBzMf-0003kv-Lw for pgsql-general@lists.postgresql.org; Mon, 15 Oct 2018 09:40:41 +0000 Received: from mx1.mailbox.org ([80.241.60.212]) by makus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gBzMc-00038S-9c for pgsql-general@lists.postgresql.org; Mon, 15 Oct 2018 09:40:40 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id 070434292D; Mon, 15 Oct 2018 11:40:33 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter03.heinlein-hosting.de (spamfilter03.heinlein-hosting.de [80.241.56.117]) (amavisd-new, port 10030) with ESMTP id 4VdDCEoBP5o1; Mon, 15 Oct 2018 11:40:32 +0200 (CEST) Message-ID: <127747635e62a00d2abb7f25bea0c3a5aaaa2967.camel@cybertec.at> Subject: Re: Regarding varchar max length in postgres From: Laurenz Albe To: Durgamahesh Manne , Adrian Klaver Cc: pgsql-general@lists.postgresql.org, andreas@a-kretschmer.de Date: Mon, 15 Oct 2018 11:40:31 +0200 In-Reply-To: References: Organization: Cybertec Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Durgamahesh Manne wrote: > was there any specific reason that you have given max length for varchar is limited to 10485760 value? > > why you have not given max length for varchar is unlimited like text datatype ? > > character varying(n), varchar(n)variable-length with limit > character(n), char(n)fixed-length, blank padded > textvariable unlimited length The data type "text" has the same size limit of 1GB. "character varying" (without type modifier) and "text" are pretty much identical. Since data of these types are loaded into memory when you read them from or write them to the database, you usually start having problems long before you reach that limit. If you want to store huge text files, either store them outside the database or use Large Objects, which can be read and written in chunks. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com