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

Commit 2ee858b

Browse files
committed
Update obsolete info in CREATE INDEX ref page. (I had fixed the text
description in indices.sgml, but missed the near-duplicate prose in the reference page...)
1 parent 97f0521 commit 2ee858b

File tree

1 file changed

+68
-52
lines changed

1 file changed

+68
-52
lines changed

doc/src/sgml/ref/create_index.sgml

+68-52
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_index.sgml,v 1.11 2000/04/11 05:39:15 thomas Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_index.sgml,v 1.12 2000/04/23 02:08:33 tgl Exp $
33
Postgres documentation
44
-->
55

@@ -24,9 +24,9 @@ Postgres documentation
2424
</refsynopsisdivinfo>
2525
<synopsis>
2626
CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable> ON <replaceable class="parameter">table</replaceable>
27-
[ USING <replaceable class="parameter">acc_name</replaceable> ] ( <replaceable class="parameter">column</replaceable> [ <replaceable class="parameter">ops_name</replaceable>] [, ...] )
27+
[ USING <replaceable class="parameter">acc_name</replaceable> ] ( <replaceable class="parameter">column</replaceable> [ <replaceable class="parameter">ops_name</replaceable> ] [, ...] )
2828
CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable> ON <replaceable class="parameter">table</replaceable>
29-
[ USING <replaceable class="parameter">acc_name</replaceable> ] ( <replaceable class="parameter">func_name</replaceable>( <replaceable class="parameter">col</replaceable> [, ... ]) <replaceable class="parameter">ops_name</replaceable> )
29+
[ USING <replaceable class="parameter">acc_name</replaceable> ] ( <replaceable class="parameter">func_name</replaceable>( <replaceable class="parameter">column</replaceable> [, ... ]) [ <replaceable class="parameter">ops_name</replaceable> ] )
3030
</synopsis>
3131

3232
<refsect2 id="R2-SQL-CREATEINDEX-1">
@@ -74,16 +74,16 @@ CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable>
7474
<term><replaceable class="parameter">acc_name</replaceable></term>
7575
<listitem>
7676
<para>
77-
the name of the access method which is to be used for
77+
The name of the access method to be used for
7878
the index. The default access method is BTREE.
79-
Postgres provides three access methods for secondary indexes:
79+
Postgres provides three access methods for indexes:
8080

8181
<variablelist>
8282
<varlistentry>
8383
<term>BTREE</term>
8484
<listitem>
8585
<para>
86-
an implementation of the Lehman-Yao
86+
an implementation of Lehman-Yao
8787
high-concurrency btrees.
8888
</para>
8989
</listitem>
@@ -133,8 +133,7 @@ CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable>
133133
<term><replaceable class="parameter">func_name</replaceable></term>
134134
<listitem>
135135
<para>
136-
A user-defined function, which returns a value that can
137-
be indexed.
136+
A function, which returns a value that can be indexed.
138137
</para>
139138
</listitem>
140139
</varlistentry>
@@ -199,21 +198,15 @@ ERROR: Cannot create index: 'index_name' already exists.
199198
</para>
200199

201200
<para>
202-
In the first syntax shown above, the key fields for the
203-
index are specified as column names; a column may also have
204-
an associated operator class. An operator class is used
205-
to specify the operators to be used for a particular
206-
index. For example, a btree index on four-byte integers
207-
would use the <literal>int4_ops</literal> class;
208-
this operator class includes
209-
comparison functions for four-byte integers. The default
210-
operator class is the appropriate operator class for that
211-
field type.
201+
In the first syntax shown above, the key field(s) for the
202+
index are specified as column names.
203+
Multiple fields can be specified if the index access method supports
204+
multi-column indexes.
212205
</para>
213206

214207
<para>
215208
In the second syntax shown above, an index is defined
216-
on the result of a user-defined function
209+
on the result of a user-specified function
217210
<replaceable class="parameter">func_name</replaceable> applied
218211
to one or more attributes of a single class.
219212
These <firstterm>functional indices</firstterm>
@@ -224,8 +217,8 @@ ERROR: Cannot create index: 'index_name' already exists.
224217

225218
<para>
226219
Postgres provides btree, rtree and hash access methods for
227-
secondary indices. The btree access method is an implementation of
228-
the Lehman-Yao high-concurrency btrees. The rtree access method
220+
indices. The btree access method is an implementation of
221+
Lehman-Yao high-concurrency btrees. The rtree access method
229222
implements standard rtrees using Guttman's quadratic split algorithm.
230223
The hash access method is an implementation of Litwin's linear
231224
hashing. We mention the algorithms used solely to indicate that all
@@ -243,8 +236,9 @@ ERROR: Cannot create index: 'index_name' already exists.
243236
</title>
244237

245238
<para>
246-
The Postgres query optimizer will consider using btree indices in a scan
247-
whenever an indexed attribute is involved in a comparison using one of:
239+
The <productname>Postgres</productname>
240+
query optimizer will consider using a btree index whenever
241+
an indexed attribute is involved in a comparison using one of:
248242

249243
<simplelist type="inline">
250244
<member>&lt;</member>
@@ -255,19 +249,6 @@ ERROR: Cannot create index: 'index_name' already exists.
255249
</simplelist>
256250
</para>
257251

258-
<para>
259-
Both box classes support indices on the <literal>box</literal> data
260-
type in <productname>Postgres</productname>.
261-
The difference between them is that <literal>bigbox_ops</literal>
262-
scales box coordinates down, to avoid floating point exceptions from
263-
doing multiplication, addition, and subtraction on very large
264-
floating-point coordinates. If the field on which your rectangles lie
265-
is about 20,000 units square or larger, you should use
266-
<literal>bigbox_ops</literal>.
267-
The <literal>poly_ops</literal> operator class supports rtree
268-
indices on <literal>polygon</literal> data.
269-
</para>
270-
271252
<para>
272253
The <productname>Postgres</productname>
273254
query optimizer will consider using an rtree index whenever
@@ -292,26 +273,56 @@ ERROR: Cannot create index: 'index_name' already exists.
292273
</para>
293274

294275
<para>
295-
Currently, only the BTREE access method supports multi-column
296-
indexes. Up to 7 keys may be specified.
297-
</para>
298-
299-
<para>
300-
Use <xref linkend="sql-dropindex-title" endterm="sql-dropindex-title">
301-
to remove an index.
276+
Currently, only the btree access method supports multi-column
277+
indexes. Up to 16 keys may be specified by default (this limit
278+
can be altered when building Postgres).
302279
</para>
303280

304-
<para>
305-
The <literal>int24_ops</literal>
306-
operator class is useful for constructing indices on int2 data, and
307-
doing comparisons against int4 data in query qualifications.
308-
Similarly, <literal>int42_ops</literal>
309-
support indices on int4 data that is to be compared against int2 data
310-
in queries.
311-
</para>
281+
<para>
282+
An <firstterm>operator class</firstterm> can be specified for each
283+
column of an index. The operator class identifies the operators to
284+
be used by the index for that column. For example, a btree index on
285+
four-byte integers would use the <literal>int4_ops</literal> class;
286+
this operator class includes comparison functions for four-byte
287+
integers. In practice the default operator class for the field's
288+
datatype is usually sufficient. The main point of having operator classes
289+
is that for some datatypes, there could be more than one meaningful
290+
ordering. For example, we might want to sort a complex-number datatype
291+
either by absolute value or by real part. We could do this by defining
292+
two operator classes for the datatype and then selecting the proper
293+
class when making an index. There are also some operator classes with
294+
special purposes:
295+
296+
<itemizedlist>
297+
<listitem>
298+
<para>
299+
The operator classes <literal>box_ops</literal> and
300+
<literal>bigbox_ops</literal> both support rtree indices on the
301+
<literal>box</literal> datatype.
302+
The difference between them is that <literal>bigbox_ops</literal>
303+
scales box coordinates down, to avoid floating point exceptions from
304+
doing multiplication, addition, and subtraction on very large
305+
floating-point coordinates. If the field on which your rectangles lie
306+
is about 20,000 units square or larger, you should use
307+
<literal>bigbox_ops</literal>.
308+
</para>
309+
</listitem>
310+
311+
<listitem>
312+
<para>
313+
The <literal>int24_ops</literal>
314+
operator class is useful for constructing indices on int2 data, and
315+
doing comparisons against int4 data in query qualifications.
316+
Similarly, <literal>int42_ops</literal>
317+
support indices on int4 data that is to be compared against int2 data
318+
in queries.
319+
</para>
320+
</listitem>
321+
</itemizedlist>
322+
</para>
312323

313324
<para>
314-
The following select list returns all ops_names:
325+
The following query shows all defined operator classes:
315326

316327
<programlisting>
317328
SELECT am.amname AS acc_name,
@@ -328,6 +339,11 @@ SELECT am.amname AS acc_name,
328339
</refsect2>
329340
</refsect1>
330341

342+
<para>
343+
Use <xref linkend="sql-dropindex-title" endterm="sql-dropindex-title">
344+
to remove an index.
345+
</para>
346+
331347
<refsect1 id="R1-SQL-CREATEINDEX-2">
332348
<title>
333349
Usage

0 commit comments

Comments
 (0)