Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7259cc1

Browse files
committed
Clarify use of btree indexes for ILIKE and ~*.
1 parent ccebb67 commit 7259cc1

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

doc/src/sgml/indices.sgml

+14-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/indices.sgml,v 1.55 2005/11/07 17:36:44 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/indices.sgml,v 1.56 2006/01/18 21:29:45 momjian Exp $ -->
22

33
<chapter id="indexes">
44
<title id="indexes-title">Indexes</title>
@@ -141,17 +141,21 @@ CREATE INDEX test1_id_index ON test1 (id);
141141

142142
<para>
143143
The optimizer can also use a B-tree index for queries involving the
144-
pattern matching operators <literal>LIKE</>,
145-
<literal>ILIKE</literal>, <literal>~</literal>, and
146-
<literal>~*</literal>, <emphasis>if</emphasis> the pattern is a constant
147-
and is anchored to the beginning of the string &mdash; for example,
148-
<literal>col LIKE 'foo%'</literal> or <literal>col ~ '^foo'</literal>,
149-
but not <literal>col LIKE '%bar'</literal>. However, if your server does
150-
not use the C locale you will need to create the index with a
151-
special operator class to support indexing of pattern-matching queries.
152-
See <xref linkend="indexes-opclass"> below.
144+
pattern matching operators <literal>LIKE</> and <literal>~</literal>
145+
<emphasis>if</emphasis> the pattern is a constant and is anchored to
146+
the beginning of the string &mdash; for example, <literal>col LIKE
147+
'foo%'</literal> or <literal>col ~ '^foo'</literal>, but not
148+
<literal>col LIKE '%bar'</literal>. However, if your server does not
149+
use the C locale you will need to create the index with a special
150+
operator class to support indexing of pattern-matching queries. See
151+
<xref linkend="indexes-opclass"> below. It is also possible to use
152+
B-tree indexes for <literal>ILIKE</literal> and
153+
<literal>~*</literal>, but only if the pattern starts with
154+
non-alphabetic characters, i.e. characters that are not affected by
155+
upper/lower case conversion.
153156
</para>
154157

158+
155159
<para>
156160
<indexterm>
157161
<primary>index</primary>

0 commit comments

Comments
 (0)