Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 415799FA183 for ; Mon, 23 Apr 2007 02:16:58 -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 43729-01 for ; Mon, 23 Apr 2007 02:16:47 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.170]) by postgresql.org (Postfix) with ESMTP id E89529FA0C0 for ; Mon, 23 Apr 2007 02:16:24 -0300 (ADT) Received: by ug-out-1314.google.com with SMTP id k3so1069282ugf for ; Sun, 22 Apr 2007 22:16:23 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=EKoSiN1nu1XG1Zn3KHYGD3MSx73u0u4RDE5Q07h//f5D4X0EmzpZtSHiL9uvdxYsz7iGxbDowZrOB4Pr9NYFzGEbI+juH7okc929KJd5/vYa49aFR+K1QiCT/EO0iFpqlO7vnAxwlegHqQMN1GunTCwZvvUkkpB/5I8BESTt7u4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=P4tr+K7E2gykOVvQ3tu47wd3m2V7nGKysX/6SJmHBId38vgjo0gV0nAcVSH/KpRgmH+vWflGSeJ5yCKM/z4ZlAc1a4BoOVmaXnpTa2ZKBLQXJndkS4ubvt2334+xC6N3rxXTdP1ym2iqvnr3HTmMm7w6CB4lrlf0DITkq+9tqPo= Received: by 10.78.97.7 with SMTP id u7mr953976hub.1177305383295; Sun, 22 Apr 2007 22:16:23 -0700 (PDT) Received: by 10.78.56.20 with HTTP; Sun, 22 Apr 2007 22:16:23 -0700 (PDT) Message-ID: Date: Mon, 23 Apr 2007 10:46:23 +0530 From: "Merlin Moncure" To: chrisj Subject: Re: seeking advise on char vs text or varchar in search table Cc: pgsql-performance@postgresql.org In-Reply-To: <10103002.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <10103002.post@talk.nabble.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/384 X-Sequence-Number: 24261 On 4/20/07, chrisj wrote: > > I have a table that contains a column for keywords that I expect to become > quite large and will be used for web searches. I will either index the > column or come up with a simple hashing algorithm add the hash key to the > table and index that column. > > I am thinking the max length in the keyword column I need to support is 30, > but the average would be less than10 > > Any suggestions on whether to use char(30), varchar(30) or text, would be > appreciated. I am looking for the best performance option, not necessarily > the most economical on disk. Don't use char...it pads out the string to the length always. It also has no real advantage over varchar in any practical situation. Think of varchar as text with a maximum length...its no faster or slower but the database will throw out entries based on length (which can be good or a bad thing)...in this case, text feels better. Have you looked at tsearch2, gist, etc? merlin