Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vga6I-0006Mf-Ij for pgsql-sql@arkaria.postgresql.org; Wed, 13 Nov 2013 13:03:18 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Vga6I-0005JV-1P for pgsql-sql@arkaria.postgresql.org; Wed, 13 Nov 2013 13:03:18 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vga6H-0005I8-4u for pgsql-sql@postgresql.org; Wed, 13 Nov 2013 13:03:17 +0000 Received: from teak.britvault.co.uk ([78.33.153.148]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vga6D-0005do-FQ for pgsql-sql@postgresql.org; Wed, 13 Nov 2013 13:03:16 +0000 Received: by teak.britvault.co.uk (Postfix, from userid 1970) id 3dKQwr5JsczBBW; Wed, 13 Nov 2013 13:03:08 +0000 (GMT) Date: Wed, 13 Nov 2013 13:03:08 +0000 To: pgsql-sql@postgresql.org Subject: Re: Function args: TEXT -vs- VARCHAR? Message-ID: <20131113130308.GA17439@teak.britvault.co.uk> References: <20131112181744.GA7522@teak.britvault.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) From: skinner@britvault.co.uk (Craig R. Skinner) X-Pg-Spam-Score: 0.8 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org On 2013-11-12 Tue 19:23 PM |, Luca Vernini wrote: > I like to have constraint, so I usually use character varying. Same here, I have no text columns. All strings are stored as character varying. > Anyway, there is no performance difference: > http://www.postgresql.org/docs/9.2/static/datatype-character.html > Interesting, although that performance tip is about table storage, not casting arguments from text to character varying within a function. > So use character varying just if you can, or if you must limit the input. > Yes, I'll change the function args to be the same as the table columns so the functions fail on over length input, rather than going through the process of validating customer id & account, only to fail on data. Therefore => performace increase with character varying function args. Thanks, -- Craig Skinner | http://twitter.com/Craig_Skinner | http://linkd.in/yGqkv7 -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql