]> begriffs open source - ai-pg/blob - full-docs/txt/indexes-collations.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / indexes-collations.txt
1
2 11.11. Indexes and Collations #
3
4    An index can support only one collation per index column. If multiple
5    collations are of interest, multiple indexes may be needed.
6
7    Consider these statements:
8 CREATE TABLE test1c (
9     id integer,
10     content varchar COLLATE "x"
11 );
12
13 CREATE INDEX test1c_content_index ON test1c (content);
14
15    The index automatically uses the collation of the underlying column. So
16    a query of the form
17 SELECT * FROM test1c WHERE content > constant;
18
19    could use the index, because the comparison will by default use the
20    collation of the column. However, this index cannot accelerate queries
21    that involve some other collation. So if queries of the form, say,
22 SELECT * FROM test1c WHERE content > constant COLLATE "y";
23
24    are also of interest, an additional index could be created that
25    supports the "y" collation, like this:
26 CREATE INDEX test1c_content_y_index ON test1c (content COLLATE "y");