pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexander B. <burbello3000@yahoo.com.br>
To: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Searching in a string with index
Date: Wed, 25 Jul 2007 10:17:41 -0300
Message-ID: <46A74D75.7000407@yahoo.com.br> (raw)

Hi,
When I search some words into a varchar column and this column has an index.
Does Postgres use index??

The search is done this way:

create table tb_gen_person (
  pes_nro_doc numeric(14) not null,
  pes_name varchar(150) not null,
  constraint pk_person PRIMARY KEY(pes_nro_doc)
);
create index ix_person_01 on tb_gen_person (pes_name);

select *
from tb_gen_person
where pes_name like '%albert%';

Not considering upper case, or tsearch2, this type of search use index
somehow?
I overhear that if the search has more than 5 characters, probably would
use index!! Is this true?

Thanks



view thread (2+ messages)  latest in thread

Message-ID: <46A74D75.7000407@yahoo.com.br>
Permalink:  ../46A74D75.7000407@yahoo.com.br/
Also on:    postgresql.org/message-id/46A74D75.7000407@yahoo.com.br

 · 

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-admin@postgresql.org
  Cc: burbello3000@yahoo.com.br
  Subject: Re: Searching in a string with index
  In-Reply-To: <46A74D75.7000407@yahoo.com.br>

* 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