Re: partial TEXT search on an index

From: Thomas Pundt <mlists(at)rp-online(dot)de>
To: Ow Mun Heng <Ow(dot)Mun(dot)Heng(at)wdc(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: partial TEXT search on an index
Date: 2009-03-31 07:31:24
Message-ID: 49D1C6CC.9080304@rp-online.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

Ow Mun Heng schrieb:
> I don't think I understand how PG implements fulltext searching or if my
> search actually needs to use fulltext search.

No, that's something different. See the fine manual.

> basically, I have a btree index on a SERIAL_NUMBER which is of sort like
> ABC12345 or AAA123434 or AAB131441
>
> I would like to have search on the specific text of the SERIAL_NUMBER
>
> eg:
> select * from table where serial_number LIKE 'AAA%'

Depending on the PostgreSQL version and locale you are using chances
are, that you need to create another index on that column to make the
query use an index. C.f.

http://www.postgresql.org/docs/8.3/interactive/indexes-opclass.html

CREATE INDEX another_index ON your_table (serial_number
varchar_pattern_ops);

> does not use the index. What Do i need to do to have it recognise the
> "partial index?" (is it called?)

No, that's not a partial index (look at e.g. wiki for an explanation).

Ciao,
Thomas

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2009-03-31 08:34:57 Re: Schema for J2EE project
Previous Message Heikki Linnakangas 2009-03-31 07:24:03 Re: [GENERAL] pgstattuple triggered checkpoint failure and database outage?