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 1mj01x-0005Ez-B9 for pgsql-docs@arkaria.postgresql.org; Fri, 05 Nov 2021 14:17:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mj01w-0006wF-61 for pgsql-docs@arkaria.postgresql.org; Fri, 05 Nov 2021 14:17:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mj01v-0006w6-VT for pgsql-docs@lists.postgresql.org; Fri, 05 Nov 2021 14:17:19 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mj01t-0001F7-1k for pgsql-docs@lists.postgresql.org; Fri, 05 Nov 2021 14:17:19 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1mj01o-0001jf-9Q; Fri, 05 Nov 2021 10:17:12 -0400 Date: Fri, 5 Nov 2021 10:17:12 -0400 From: Bruce Momjian To: Laurenz Albe Cc: Grega Jesih , "David G. Johnston" , Tom Lane , Pg Docs Subject: Re: text fields and performance for ETL Message-ID: <20211105141712.GA19812@momjian.us> References: <163594615980.678.1904941309603792278@wrigleys.postgresql.org> <686716cb5c4242c28e5967d9b6fcfc75@actual-it.si> <137264.1635961048@sss.pgh.pa.us> <70cf9fe110c246afb4eab054caab0c04@actual-it.si> <516dc58b80fa418091f5262879019213@actual-it.si> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Nov 5, 2021 at 03:15:35PM +0100, Laurenz Albe wrote: > On Fri, 2021-11-05 at 09:51 +0000, Grega Jesih wrote: > > Suggested current text addendum: > > > > But, if you consider doing ETL from Postgres database to some outer target > > environment and you seek performance in such interfaces, follow the logic > > of limited size (varchar or char) data types in your database model. > > Because if you make a dataflow of known size types, interface code can take > > a big block of data while for text fields you need to check each record. > > I am opposed to that. > > It is not our business to discuss the limitations of a certain third-party software product. > If that were something wide-spread, perhaps. But I myself have never seen a problem > with "text", as long as the actual size of the data is moderate. Agreed. > > Optional additional remark: > > > > Another good aspect of known data sizes is easier understanding of field > > content and implicit data (length) control. > > Something like that makes more sense to me. > > Perhaps, right before the tip you quoted, something like that: > > If your use case requires a length limit on character data, or compliance > with the SQL standard is important, use "character varying". > Otherwise, you are usually better off with "text". I can support that if others think it is valuable. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com If only the physical world exists, free will is an illusion.