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