From: Michael Ryan S. Puncia <mpuncia@census.gov.ph>
To: pgsql-performance@postgresql.org
Subject: Re: best practices with index on varchar column
Date: Wed, 23 Mar 2005 12:11:56 +0800
Message-ID: <200503230402.j2N42ax1022249@mail.census.gov.ph> (raw)
In-Reply-To: <op.sn1ccygeth1vuj@localhost>
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@postgresql.org
__________ NOD32 1.1023 (20050310) Information __________
This message was checked by NOD32 Antivirus System.
http://www.nod32.com
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: mpuncia@census.gov.ph
Subject: Re: best practices with index on varchar column
In-Reply-To: <200503230402.j2N42ax1022249@mail.census.gov.ph>
* 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