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

From Michael Ryan S. Puncia
Subject Re: best practices with index on varchar column
Date
Msg-id 200503230402.j2N42ax1022249@mail.census.gov.ph
Whole thread Raw
In response to Re: best practices with index on varchar column  (PFC <lists@boutiquenumerique.com>)
Responses Re: best practices with index on varchar column  (Dawid Kuroczko <qnex42@gmail.com>)
List 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@postgresql.org

__________ NOD32 1.1023 (20050310) Information __________

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



pgsql-performance by date:

Previous
From: Rick Jansen
Date:
Subject: Re: Tsearch2 performance on big database
Next
From: Dawid Kuroczko
Date:
Subject: Re: best practices with index on varchar column