Skip to content

Commit 5fdae77

Browse files
committed
Add mention of functional indexes for case-insensitive comparisons.
1 parent 465cf16 commit 5fdae77

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

doc/src/FAQ/FAQ.html

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ <H2>Operational Questions</H2>
112112
<A href="#4.11">4.11</A>) What is an R-tree index?<BR>
113113
<A href="#4.12">4.12</A>) What is the Genetic Query Optimizer?<BR>
114114
<A href="#4.13">4.13</A>) How do I perform regular expression
115-
searches and case-insensitive regular expression searches?<BR>
115+
searches and case-insensitive regular expression searches? How do I
116+
use an index for case-insensitive searches?<BR>
116117
<A href="#4.14">4.14</A>) In a query, how do I detect if a field
117118
is <SMALL>NULL</SMALL>?<BR>
118119
<A href="#4.15">4.15</A>) What is the difference between the
@@ -957,13 +958,29 @@ <H4><A name="4.12">4.12</A>) What is the Genetic Query
957958
search.</P>
958959

959960
<H4><A name="4.13">4.13</A>) How do I perform regular expression
960-
searches and case-insensitive regular expression searches?</H4>
961+
searches and case-insensitive regular expression searches? How do I
962+
use an index for case-insensitive searches?</H4>
961963

962964
<P>The <I>~</I> operator does regular expression matching, and
963965
<I>~*</I> does case-insensitive regular expression matching. The
964966
case-insensitive variant of <SMALL>LIKE</SMALL> is called
965967
<SMALL>ILIKE</SMALL> in PostgreSQL 7.1 and later.</P>
966968

969+
<P>Case-insensitive equality comparisons are normally expressed as:
970+
971+
<PRE>
972+
SELECT *
973+
FROM tab
974+
WHERE lower(col) = 'abc'
975+
</PRE>
976+
977+
This will not use an standard index. However, if you create a
978+
functional index, it will be used:
979+
980+
<PRE>
981+
CREATE INDEX tabindex on tab (lower(col));
982+
</PRE>
983+
967984
<H4><A name="4.14">4.14</A>) In a query, how do I detect if a field
968985
is <SMALL>NULL</SMALL>?</H4>
969986

0 commit comments

Comments
 (0)