pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dawid Kuroczko <qnex42@gmail.com>
To: pgsql-performance@postgresql.org
Subject: Re: best practices with index on varchar column
Date: Tue, 22 Mar 2005 10:49:25 +0100
Message-ID: <758d5e7f050322014953c311fe@mail.gmail.com> (raw)
In-Reply-To: <007301c52ec0$a8f64ec0$9285a8c0@moonfactory.co.jp>
References: <007301c52ec0$a8f64ec0$9285a8c0@moonfactory.co.jp>

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



view thread (7+ messages)  latest in thread

Message-ID: <758d5e7f050322014953c311fe@mail.gmail.com>
Permalink:  ../758d5e7f050322014953c311fe@mail.gmail.com/
Also on:    postgresql.org/message-id/758d5e7f050322014953c311fe@mail.gmail.com

 · 

reply

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: qnex42@gmail.com
  Subject: Re: best practices with index on varchar column
  In-Reply-To: <758d5e7f050322014953c311fe@mail.gmail.com>

* 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