Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id C6D089FB478 for ; Sat, 16 Jun 2007 09:16:36 -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 28782-08 for ; Sat, 16 Jun 2007 09:16:25 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mx1.ipf.is (mack.ipf.is [85.197.192.164]) by postgresql.org (Postfix) with ESMTP id A05369FB3FD for ; Sat, 16 Jun 2007 09:16:32 -0300 (ADT) Received: (qmail 27085 invoked by uid 1010); 16 Jun 2007 12:16:21 +0000 Received: from 88.149.106.19 by mack (envelope-from , uid 1008) with qmail-scanner-1.25-st-qms (clamdscan: 0.88.4/1639. spamassassin: 3.1.4. perlscan: 1.25-st-qms. Clear:RC:1(88.149.106.19):SA:0(-2.4/4.5):. Processed in 0.289176 secs); 16 Jun 2007 12:16:21 -0000 X-Antivirus-HIVE-Mail-From: gnari@hive.is via mack X-Antivirus-HIVE: 1.25-st-qms (Clear:RC:1(88.149.106.19):SA:0(-2.4/4.5):. Processed in 0.289176 secs Process 27078) Received: from dsl-149-106-19.hive.is (HELO ?192.168.1.33?) (88.149.106.19) by mx1.ipf.is with SMTP; 16 Jun 2007 12:16:20 +0000 Subject: Re: determining maxsize for character varying From: Ragnar To: okparanoid@free.fr Cc: pgsql-performance@postgresql.org In-Reply-To: <1181993709.4673caedd6fe8@imp.free.fr> References: <1181987590.4673b306d4baf@imp.free.fr> <20070616105525.GA13754@KanotixBox> <1181993709.4673caedd6fe8@imp.free.fr> Content-Type: text/plain Date: Sat, 16 Jun 2007 12:30:20 +0000 Message-Id: <1181997020.5953.170.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.8.1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/285 X-Sequence-Number: 25318 On lau, 2007-06-16 at 13:35 +0200, okparanoid@free.fr wrote: > Thanks > > if i understand well that means that if i choose character varying(3) or > character varying(8) or character varying(32) or character varying with no max > length the fields will take the same place in the disk (8kb) except for fields > too long to take place in the 8kb whose are stored in another place ? > > Is that correct ? not at all a varchar will occupy the bytelength of your actual string, + a small fixed overhead+padding, except when the total rowsize causes TOASTing in single-byte encodings, the string 'okparanoid' will occupy the same amount of diskspace in a varchar, varchar(10) or a varchar(1000) column, namely around 16 bytes. hope this helps gnari