Re: partial TEXT search on an index - Mailing list pgsql-general

From Thomas Pundt
Subject Re: partial TEXT search on an index
Date
Msg-id 49D1C6CC.9080304@rp-online.de
Whole thread Raw
In response to partial TEXT search on an index  (Ow Mun Heng <Ow.Mun.Heng@wdc.com>)
Responses Re: partial TEXT search on an index  (Oleg Bartunov <oleg@sai.msu.su>)
List 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

pgsql-general by date:

Previous
From: Brendan Jurd
Date:
Subject: Re: [HACKERS] string_to_array with empty input
Next
From: Richard Huxton
Date:
Subject: Re: Schema for J2EE project