Are indexes used with LIKE? - Mailing list pgsql-general

From Kovács Péter
Subject Are indexes used with LIKE?
Date
Msg-id 43D527B1.1030905@chemaxon.hu
Whole thread Raw
Responses Re: Are indexes used with LIKE?
List pgsql-general
Hi,

Are indexes on VARCHAR columns used with the LIKE operator, and if so,
how efficiently are they used?

I can imagine that using indexes can be easy with the starting literal
characters up to the first percent sign such as in:

LIKE 'ZOE%QQWE%'

But, after the first % sign, things can get more difficult.

The reason I am asking is that we are thinking about discriminating
between rows of a table based on a VARCHAR column containing various
one-character "flags". We could then use the LIKE operator for
formulating filter conditions.

Any help is appreciated!

Regards
Peter

pgsql-general by date:

Previous
From: Vivek Khera
Date:
Subject: Re: RAID 5 and postgresql
Next
From: Tom Lane
Date:
Subject: Re: invalid memory alloc request size