From: Merlin Moncure <mmoncure@gmail.com>
To: chrisj <chrisj.wood@sympatico.ca>
Cc: pgsql-performance@postgresql.org
Subject: Re: seeking advise on char vs text or varchar in search table
Date: Mon, 23 Apr 2007 10:46:23 +0530
Message-ID: <b42b73150704222216l1e56c331tfc8c7daa59a22499@mail.gmail.com> (raw)
In-Reply-To: <10103002.post@talk.nabble.com>
References: <10103002.post@talk.nabble.com>
On 4/20/07, chrisj <chrisj.wood@sympatico.ca> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: mmoncure@gmail.com, chrisj.wood@sympatico.ca
Subject: Re: seeking advise on char vs text or varchar in search table
In-Reply-To: <b42b73150704222216l1e56c331tfc8c7daa59a22499@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox