From rjessil@yahoo.com Mon Jul 23 18:34:00 2007 Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id A6BB79FB2B4 for ; Mon, 23 Jul 2007 15:34:00 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 21086-10 for ; Mon, 23 Jul 2007 15:33:54 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from web56408.mail.re3.yahoo.com (web56408.mail.re3.yahoo.com [216.252.111.87]) by postgresql.org (Postfix) with SMTP id 4466D9FA4A3 for ; Mon, 23 Jul 2007 15:33:55 -0300 (ADT) Received: (qmail 84998 invoked by uid 60001); 23 Jul 2007 18:33:54 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=usENlsU7vSSgAN0BrTzu7rM/Z07KMDyc3q3zTFxHOAaGr1GJFT3LIEo9yKc6YiL2zA3RTx0AD4INvzDb5hUKyjE+aap/pobSdUHGKI7K0eL/lhm0bQ6MaXw6glMqogTd/rPF+qVnTIYB/7bqqv3R7oIo3Y9xris4YcE/rZ+1r4E=; X-YMail-OSG: ir2F7JoVM1leNPtuvczrHdwqqNWjMayTQDSbYVbvVp3NcfHnpvpPEKQVHfQYgy00Lmz5ZgfoCNURcGQ40WTCjvtuCF.SW.017L2l6FJ9a1NbvoRS4cGQ3ZfCCWg5Vrs- Received: from [198.119.134.32] by web56408.mail.re3.yahoo.com via HTTP; Mon, 23 Jul 2007 11:33:54 PDT Date: Mon, 23 Jul 2007 11:33:54 -0700 (PDT) From: Jessica Richard Subject: varchar vs text columns To: pgsql-admin@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-438413896-1185215634=:84815" Content-Transfer-Encoding: 8bit Message-ID: <835361.84815.qm@web56408.mail.re3.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.242 tagged_above=0 required=5 tests=AWL=0.426, BAYES_40=-0.185, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200707/249 X-Sequence-Number: 26230 --0-438413896-1185215634=:84815 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit What is the difference between varchar and text for a string column? What is the benefit of using each one? Is text better than varchar performance wise? Thanks. --------------------------------- Park yourself in front of a world of choices in alternative vehicles. Visit the Yahoo! Auto Green Center. --0-438413896-1185215634=:84815 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit What is the difference between varchar and text for a string column?
What is the benefit of using each one?
Is text better than varchar performance wise?

Thanks.


Park yourself in front of a world of choices in alternative vehicles.
Visit the Yahoo! Auto Green Center. --0-438413896-1185215634=:84815-- From ajs@crankycanuck.ca Mon Jul 23 19:11:25 2007 Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 1FDE19FB20E for ; Mon, 23 Jul 2007 16:11:25 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 36260-05 for ; Mon, 23 Jul 2007 16:11:19 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from main2.mycybernet.net (main2.mycybernet.net [209.222.63.140]) by postgresql.org (Postfix) with ESMTP id 083269FB1D4 for ; Mon, 23 Jul 2007 16:11:21 -0300 (ADT) Received: from 227-54-222-209.mycybernet.net ([209.222.54.227] helo=phlogiston.dydns.org) by main2.mycybernet.net with esmtp (Exim 4.62) (envelope-from ) id 1ID3JR-00058F-5p for pgsql-admin@postgresql.org; Mon, 23 Jul 2007 15:11:21 -0400 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id D37073FAF; Mon, 23 Jul 2007 15:11:15 -0400 (EDT) Date: Mon, 23 Jul 2007 15:11:15 -0400 From: Andrew Sullivan To: pgsql-admin@postgresql.org Subject: Re: varchar vs text columns Message-ID: <20070723191115.GI9196@phlogiston.dyndns.org> References: <835361.84815.qm@web56408.mail.re3.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <835361.84815.qm@web56408.mail.re3.yahoo.com> User-Agent: Mutt/1.5.9i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/250 X-Sequence-Number: 26231 On Mon, Jul 23, 2007 at 11:33:54AM -0700, Jessica Richard wrote: > What is the difference between varchar and text for a string column? > What is the benefit of using each one? > Is text better than varchar performance wise? From peter_e@gmx.net Mon Jul 23 19:20:40 2007 Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id C0D7A9FB214 for ; Mon, 23 Jul 2007 16:20:40 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 36588-03 for ; Mon, 23 Jul 2007 16:20:38 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by postgresql.org (Postfix) with SMTP id D8DD19FB20E for ; Mon, 23 Jul 2007 16:20:39 -0300 (ADT) Received: (qmail invoked by alias); 23 Jul 2007 19:20:37 -0000 Received: from xdsl-87-78-219-248.netcologne.de (EHLO colt.pezone.net) [87.78.219.248] by mail.gmx.net (mp015) with SMTP; 23 Jul 2007 21:20:37 +0200 X-Authenticated: #495269 X-Provags-ID: V01U2FsdGVkX19DoZ1/6HxDCaFRZ9h+UloJB3kICZygMQxotxT/wk lR63BW5JjirqZ9 From: Peter Eisentraut To: pgsql-admin@postgresql.org Subject: Re: varchar vs text columns Date: Mon, 23 Jul 2007 21:20:35 +0200 User-Agent: KMail/1.9.5 Cc: Jessica Richard References: <835361.84815.qm@web56408.mail.re3.yahoo.com> In-Reply-To: <835361.84815.qm@web56408.mail.re3.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200707232120.36127.peter_e@gmx.net> X-Y-GMX-Trusted: 0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/251 X-Sequence-Number: 26232 Jessica Richard wrote: > What is the difference between varchar and text for a string column? Nothing, if you don't use a limit for varchar. -- Peter Eisentraut http://developer.postgresql.org/~petere/ From lew@lewscanon.nospam Tue Jul 24 13:34:02 2007 Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id C063A9FB5DA for ; Tue, 24 Jul 2007 10:34:02 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 50579-04 for ; Tue, 24 Jul 2007 10:33:53 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by postgresql.org (Postfix) with ESMTP id 0640F9FA456 for ; Tue, 24 Jul 2007 10:34:02 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.13.8/8.13.8) with ESMTP id l6ODXruG051118 for ; Tue, 24 Jul 2007 10:33:53 -0300 (ADT) (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.13.8/8.13.8/Submit) id l6ODGhdn046627 for pgsql-admin@postgresql.org; Tue, 24 Jul 2007 10:16:43 -0300 (ADT) (envelope-from news) Date: Tue, 24 Jul 2007 09:16:49 -0400 From: Lew User-Agent: Thunderbird 2.0.0.4 (X11/20070615) MIME-Version: 1.0 X-Newsgroups: pgsql.admin Subject: Re: varchar vs text columns References: <835361.84815.qm@web56408.mail.re3.yahoo.com> <20070723191115.GI9196@phlogiston.dyndns.org> In-Reply-To: <20070723191115.GI9196@phlogiston.dyndns.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Lines: 23 X-Usenet-Provider: http://www.giganews.com X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.35 To: pgsql-admin@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/263 X-Sequence-Number: 26244 Andrew Sullivan wrote: > On Mon, Jul 23, 2007 at 11:33:54AM -0700, Jessica Richard wrote: >> What is the difference between varchar and text for a string column? >> What is the benefit of using each one? >> Is text better than varchar performance wise? > > From the manual: > > Tip: There are no performance differences between these > three types, apart from the increased storage size when using > the blank-padded type. While character(n) has performance > advantages in some other database systems, it has no such > advantages in PostgreSQL. In most situations text or > character varying should be used instead. > > Note that varchar(n) will have a performance effect, because on > insert or update you have to check to make sure the input doesn't > exceed the specified length. See also Peter Koczan's reply in the '"_" in a serach pattern' thread. -- Lew