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 1ltX9z-0003Ct-3A for pgsql-general@arkaria.postgresql.org; Wed, 16 Jun 2021 15:08:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ltX9x-0005rK-R4 for pgsql-general@arkaria.postgresql.org; Wed, 16 Jun 2021 15:08:53 +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 1ltX9w-0005rB-VY for pgsql-general@lists.postgresql.org; Wed, 16 Jun 2021 15:08:52 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ltX9u-0000tq-Hs for pgsql-general@lists.postgresql.org; Wed, 16 Jun 2021 15:08:51 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 15GF8ncV677776; Wed, 16 Jun 2021 11:08:49 -0400 From: Tom Lane To: Martin Mueller cc: "pgsql-general@lists.postgresql.org" Subject: Re: A simple question about text fields In-reply-to: References: Comments: In-reply-to Martin Mueller message dated "Wed, 16 Jun 2021 15:02:25 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <677774.1623856129.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 16 Jun 2021 11:08:49 -0400 Message-ID: <677775.1623856129@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Martin Mueller writes: > Are there performance issues with the choice of 'text' vs. varchar and s= ome character limit? For instance, if I have a table with ten million rec= ords and text fields that may range in length from 15 to 150, can I expect= a measurable improvement in response time for using varchar(150) or will = text do just or nearly as well. = There is no situation where varchar outperforms text in Postgres. If you need to apply a length constraint for application semantic reasons, do so ... otherwise, text is the native type. It's useful to think of varchar as being a domain over text, though for various reasons it's not implemented quite that way. regards, tom lane