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 758d5e7f050322014953c311fe@mail.gmail.com
Whole thread Raw
In response to best practices with index on varchar column  ("Layet Benjamin" <benjamin@moonfactory.co.jp>)
List pgsql-performance
On Tue, 22 Mar 2005 18:22:24 +0900, Layet Benjamin
<benjamin@moonfactory.co.jp> wrote:
> Can I use an index on a varchar column to optimize the SELECT queries that
> use " column LIKE 'header%'  "?
> If yes what is the best tree algotithm to use ?

Yes, that is the correct place.  The best tree algorithm is B-Tree,
which is the default.  So no need for giving 'USING ...' to CREATE INDEX.

The other types of indexes are either not trees (HASH), different
and more complex (GiST, RTREE) kinds of trees which are there
for different kinds of data (spatial, full text, etc).

Remember to VACUUM ANALYZE this table from time to time,
so the planner can judge efficiently whether to use this new
index or not.

Use EXPLAIN ANALYZE SELECT .... to see whether the index
is really used.

> I don't care about optimising INSERT, DELETE and UPDATE queries, as they are
> only done at night when the load is very low.
> Thank you very much for any help,

Oh, they can benefit from the index anyhow. :)

  Regards,
     Dawid

pgsql-performance by date:

Previous
From: "Layet Benjamin"
Date:
Subject: best practices with index on varchar column
Next
From: Dawid Kuroczko
Date:
Subject: Re: What about utility to calculate planner cost constants?