Re: best practices with index on varchar column - Mailing list pgsql-performance

From Dawid Kuroczko
Subject Re: best practices with index on varchar column
Date
Msg-id 758d5e7f05032301351b685c44@mail.gmail.com
Whole thread Raw
In response to Re: best practices with index on varchar column  ("Michael Ryan S. Puncia" <mpuncia@census.gov.ph>)
Responses Re: best practices with index on varchar column
List pgsql-performance
On Wed, 23 Mar 2005 12:11:56 +0800, Michael Ryan S. Puncia
<mpuncia@census.gov.ph> wrote:
>
> I have an experience using LIKE in a VARCHAR column and select statement
> suffers a lot so I decided to go back in CHAR
>
> Note: my database has about 50 millions records a b tree index

Strange...

According to the PostgreSQL's documentation:

     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.


To my best knowledge char and varchar are stored in a same way
(4-byte length plus textual value), so using char should make tables
bigger in your case.  Then again, having each row exactly the same
size makes it easier to delete and then later insert a new row in
a same spot.  Am I thinking correct?  Is it a case where using char(n)
makes that table avoid hmm fragmentation of some sort?

   Regards,
      Dawid

pgsql-performance by date:

Previous
From: "Michael Ryan S. Puncia"
Date:
Subject: Re: best practices with index on varchar column
Next
From: Oleg Bartunov
Date:
Subject: Re: Tsearch2 performance on big database