Re: best practices with index on varchar column

From: "Michael Ryan S(dot) Puncia" <mpuncia(at)census(dot)gov(dot)ph>
To: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: best practices with index on varchar column
Date: 2005-03-23 04:11:56
Message-ID: 200503230402.j2N42ax1022249@mail.census.gov.ph
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


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

> Can I use an index on a varchar column to optimize the SELECT queries
> that
> use " column LIKE 'header%' "?

Yes

> If yes what is the best tree algotithm to use ?

Btree

Note that if you want case insensitive matching you need to make an
index
on lower(column) and SELECT WHERE lower(column) LIKE 'header%'

Locales may bite you.

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

__________ NOD32 1.1023 (20050310) Information __________

This message was checked by NOD32 Antivirus System.
http://www.nod32.com

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Simon Riggs 2005-03-23 08:40:30 Re: BUG #1552: massive performance hit between 7.4 and 8.0.1
Previous Message Karim Nassar 2005-03-23 02:21:06 Re: Hardware questions