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

Commit e1b47c2

Browse files
committed
Minor copy-editing.
1 parent 9688939 commit e1b47c2

File tree

5 files changed

+62
-60
lines changed

5 files changed

+62
-60
lines changed

doc/src/sgml/datatype.sgml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.129 2003/11/04 09:55:38 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.130 2003/11/06 22:21:47 tgl Exp $
33
-->
44

55
<chapter id="datatype">
@@ -250,8 +250,8 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.129 2003/11/04 09:55:38 p
250250
<type>varchar</type>, <type>date</type>, <type>double
251251
precision</type>, <type>integer</type>, <type>interval</type>,
252252
<type>numeric</type>, <type>decimal</type>, <type>real</type>,
253-
<type>smallint</type>, <type>time</type>, <type>timestamp</type>
254-
(both with or without time zone).
253+
<type>smallint</type>, <type>time</type> (with or without time zone),
254+
<type>timestamp</type> (with or without time zone).
255255
</para>
256256
</note>
257257

doc/src/sgml/datetime.sgml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.36 2003/09/20 20:12:04 tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.37 2003/11/06 22:21:47 tgl Exp $
33
-->
44

55
<appendix id="datetime-appendix">
@@ -995,7 +995,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.36 2003/09/20 20:12:04 tg
995995
<para>
996996
The Julian Date was invented by the French scholar
997997
Joseph Justus Scaliger (1540-1609)
998-
and probably takes its name from the Scaliger's father,
998+
and probably takes its name from Scaliger's father,
999999
the Italian scholar Julius Caesar Scaliger (1484-1558).
10001000
Astronomers have used the Julian period to assign a unique number to
10011001
every day since 1 January 4713 BC. This is the so-called Julian Date
@@ -1007,7 +1007,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.36 2003/09/20 20:12:04 tg
10071007
The <quote>Julian Date</quote> is different from the <quote>Julian
10081008
Calendar</quote>. The Julian calendar
10091009
was introduced by Julius Caesar in 45 BC. It was in common use
1010-
until the 1582, when countries started changing to the Gregorian
1010+
until the year 1582, when countries started changing to the Gregorian
10111011
calendar. In the Julian calendar, the tropical year is
10121012
approximated as 365 1/4 days = 365.25 days. This gives an error of
10131013
about 1 day in 128 years.
@@ -1042,7 +1042,8 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.36 2003/09/20 20:12:04 tg
10421042
So, 1700, 1800, 1900, 2100, and 2200 are not leap years. But 1600,
10431043
2000, and 2400 are leap years.
10441044

1045-
By contrast, in the older Julian calendar only years divisible by 4 are leap years.
1045+
By contrast, in the older Julian calendar all years divisible by 4 are leap
1046+
years.
10461047
</para>
10471048

10481049
<para>

doc/src/sgml/indices.sgml

Lines changed: 44 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/indices.sgml,v 1.45 2003/09/30 03:22:33 tgl Exp $ -->
1+
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/indices.sgml,v 1.46 2003/11/06 22:21:47 tgl Exp $ -->
22

33
<chapter id="indexes">
44
<title id="indexes-title">Indexes</title>
@@ -77,7 +77,7 @@ CREATE INDEX test1_id_index ON test1 (id);
7777
than a sequential table scan. But you may have to run the
7878
<command>ANALYZE</command> command regularly to update
7979
statistics to allow the query planner to make educated decisions.
80-
Also read <xref linkend="performance-tips"> for information about
80+
See <xref linkend="performance-tips"> for information about
8181
how to find out whether an index is used and when and why the
8282
planner may choose <emphasis>not</emphasis> to use an index.
8383
</para>
@@ -106,8 +106,8 @@ CREATE INDEX test1_id_index ON test1 (id);
106106

107107
<para>
108108
<productname>PostgreSQL</productname> provides several index types:
109-
B-tree, R-tree, GiST, and Hash. Each index type is more appropriate for
110-
a particular query type because of the algorithm it uses.
109+
B-tree, R-tree, GiST, and Hash. Each index type uses a different
110+
algorithm that is best suited to different types of queries.
111111
<indexterm>
112112
<primary>index</primary>
113113
<secondary>B-tree</secondary>
@@ -116,9 +116,10 @@ CREATE INDEX test1_id_index ON test1 (id);
116116
<primary>B-tree</primary>
117117
<see>index</see>
118118
</indexterm>
119-
By
120-
default, the <command>CREATE INDEX</command> command will create a
121-
B-tree index, which fits the most common situations. In
119+
By default, the <command>CREATE INDEX</command> command will create a
120+
B-tree index, which fits the most common situations. B-trees can
121+
handle equality and range queries on data that can be sorted into
122+
some ordering. In
122123
particular, the <productname>PostgreSQL</productname> query planner
123124
will consider using a B-tree index whenever an indexed column is
124125
involved in a comparison using one of these operators:
@@ -154,7 +155,7 @@ CREATE INDEX test1_id_index ON test1 (id);
154155
<primary>R-tree</primary>
155156
<see>index</see>
156157
</indexterm>
157-
R-tree indexes are especially suited for spatial data. To create
158+
R-tree indexes are suited for queries on spatial data. To create
158159
an R-tree index, use a command of the form
159160
<synopsis>
160161
CREATE INDEX <replaceable>name</replaceable> ON <replaceable>table</replaceable> USING RTREE (<replaceable>column</replaceable>);
@@ -185,6 +186,7 @@ CREATE INDEX <replaceable>name</replaceable> ON <replaceable>table</replaceable>
185186
<primary>hash</primary>
186187
<see>index</see>
187188
</indexterm>
189+
Hash indexes can only handle simple equality comparisons.
188190
The query planner will consider using a hash index whenever an
189191
indexed column is involved in a comparison using the
190192
<literal>=</literal> operator. The following command is used to
@@ -195,19 +197,18 @@ CREATE INDEX <replaceable>name</replaceable> ON <replaceable>table</replaceable>
195197
<note>
196198
<para>
197199
Testing has shown <productname>PostgreSQL</productname>'s hash
198-
indexes to be similar or slower than B-tree indexes, and the
199-
index size and build time for hash indexes is much worse. Hash
200-
indexes also suffer poor performance under high concurrency. For
200+
indexes to perform no better than B-tree indexes, and the
201+
index size and build time for hash indexes is much worse. For
201202
these reasons, hash index use is presently discouraged.
202203
</para>
203204
</note>
204205
</para>
205206

206207
<para>
207-
The B-tree index is an implementation of Lehman-Yao
208+
The B-tree index method is an implementation of Lehman-Yao
208209
high-concurrency B-trees. The R-tree index method implements
209210
standard R-trees using Guttman's quadratic split algorithm. The
210-
hash index is an implementation of Litwin's linear hashing. We
211+
hash index method is an implementation of Litwin's linear hashing. We
211212
mention the algorithms used solely to indicate that all of these
212213
index methods are fully dynamic and do not have to be optimized
213214
periodically (as is the case with, for example, static hash methods).
@@ -233,7 +234,7 @@ CREATE TABLE test2 (
233234
name varchar
234235
);
235236
</programlisting>
236-
(Say, you keep your <filename class="directory">/dev</filename>
237+
(say, you keep your <filename class="directory">/dev</filename>
237238
directory in a database...) and you frequently make queries like
238239
<programlisting>
239240
SELECT name FROM test2 WHERE major = <replaceable>constant</replaceable> AND minor = <replaceable>constant</replaceable>;
@@ -263,8 +264,8 @@ CREATE INDEX test2_mm_idx ON test2 (major, minor);
263264
<literal>a</literal> and <literal>b</literal>, or in queries
264265
involving only <literal>a</literal>, but not in other combinations.
265266
(In a query involving <literal>a</literal> and <literal>c</literal>
266-
the planner might choose to use the index for
267-
<literal>a</literal> only and treat <literal>c</literal> like an
267+
the planner could choose to use the index for
268+
<literal>a</literal>, while treating <literal>c</literal> like an
268269
ordinary unindexed column.) Of course, each column must be used with
269270
operators appropriate to the index type; clauses that involve other
270271
operators will not be considered.
@@ -310,16 +311,16 @@ CREATE UNIQUE INDEX <replaceable>name</replaceable> ON <replaceable>table</repla
310311
<para>
311312
When an index is declared unique, multiple table rows with equal
312313
indexed values will not be allowed. Null values are not considered
313-
equal.
314+
equal. A multicolumn unique index will only reject cases where all
315+
of the indexed columns are equal in two rows.
314316
</para>
315317

316318
<para>
317-
<productname>PostgreSQL</productname> automatically creates unique
318-
indexes when a table is declared with a unique constraint or a
319-
primary key, on the columns that make up the primary key or unique
320-
columns (a multicolumn index, if appropriate), to enforce that
321-
constraint. A unique index can be added to a table at any later
322-
time, to add a unique constraint.
319+
<productname>PostgreSQL</productname> automatically creates a unique
320+
index when a unique constraint or a primary key is defined for a table.
321+
The index covers the columns that make up the primary key or unique
322+
columns (a multicolumn index, if appropriate), and is the mechanism
323+
that enforces the constraint.
323324
</para>
324325

325326
<note>
@@ -328,6 +329,9 @@ CREATE UNIQUE INDEX <replaceable>name</replaceable> ON <replaceable>table</repla
328329
<literal>ALTER TABLE ... ADD CONSTRAINT</literal>. The use of
329330
indexes to enforce unique constraints could be considered an
330331
implementation detail that should not be accessed directly.
332+
One should, however, be aware that there's no need to manually
333+
create indexes on unique columns; doing so would just duplicate
334+
the automatically-created index.
331335
</para>
332336
</note>
333337
</sect1>
@@ -362,6 +366,14 @@ CREATE INDEX test1_lower_col1_idx ON test1 (lower(col1));
362366
</programlisting>
363367
</para>
364368

369+
<para>
370+
If we were to declare this index <literal>UNIQUE</>, it would prevent
371+
creation of rows whose <literal>col1</> values differ only in case,
372+
as well as rows whose <literal>col1</> values are actually identical.
373+
Thus, indexes on expressions can be used to enforce constraints that
374+
are not definable as simple unique constraints.
375+
</para>
376+
365377
<para>
366378
As another example, if one often does queries like this:
367379
<programlisting>
@@ -409,7 +421,7 @@ CREATE INDEX <replaceable>name</replaceable> ON <replaceable>table</replaceable>
409421
In practice the default operator class for the column's data type is
410422
usually sufficient. The main point of having operator classes is
411423
that for some data types, there could be more than one meaningful
412-
ordering. For example, we might want to sort a complex-number data
424+
index behavior. For example, we might want to sort a complex-number data
413425
type either by absolute value or by real part. We could do this by
414426
defining two operator classes for the data type and then selecting
415427
the proper class when making an index.
@@ -419,20 +431,6 @@ CREATE INDEX <replaceable>name</replaceable> ON <replaceable>table</replaceable>
419431
There are also some built-in operator classes besides the default ones:
420432

421433
<itemizedlist>
422-
<listitem>
423-
<para>
424-
The operator classes <literal>box_ops</literal> and
425-
<literal>bigbox_ops</literal> both support R-tree indexes on the
426-
<type>box</type> data type. The difference between them is
427-
that <literal>bigbox_ops</literal> scales box coordinates down,
428-
to avoid floating-point exceptions from doing multiplication,
429-
addition, and subtraction on very large floating-point
430-
coordinates. If the field on which your rectangles lie is about
431-
20 000 square units or larger, you should use
432-
<literal>bigbox_ops</literal>.
433-
</para>
434-
</listitem>
435-
436434
<listitem>
437435
<para>
438436
The operator classes <literal>text_pattern_ops</literal>,
@@ -644,7 +642,8 @@ SELECT * FROM orders WHERE order_nr = 3501;
644642
create, it would probably be too slow to be of any real use.)
645643
The system can recognize simple inequality implications, for example
646644
<quote>x &lt; 1</quote> implies <quote>x &lt; 2</quote>; otherwise
647-
the predicate condition must exactly match the query's <literal>WHERE</> condition
645+
the predicate condition must exactly match part of the query's
646+
<literal>WHERE</> condition
648647
or the index will not be recognized to be usable.
649648
</para>
650649

@@ -723,7 +722,8 @@ CREATE UNIQUE INDEX tests_success_constraint ON tests (subject, target)
723722
maintenance and tuning, it is still important to check
724723
which indexes are actually used by the real-life query workload.
725724
Examining index usage for an individual query is done with the
726-
<command>EXPLAIN</> command; its application for this purpose is
725+
<xref linkend="sql-explain" endterm="sql-explain-title">
726+
command; its application for this purpose is
727727
illustrated in <xref linkend="using-explain">.
728728
It is also possible to gather overall statistics about index usage
729729
in a running server, as described in <xref linkend="monitoring-stats">.
@@ -740,7 +740,8 @@ CREATE UNIQUE INDEX tests_success_constraint ON tests (subject, target)
740740
<itemizedlist>
741741
<listitem>
742742
<para>
743-
Always run <command>ANALYZE</command> first. This command
743+
Always run <xref linkend="sql-analyze" endterm="sql-analyze-title">
744+
first. This command
744745
collects statistics about the distribution of the values in the
745746
table. This information is required to guess the number of rows
746747
returned by a query, which is needed by the planner to assign
@@ -813,8 +814,8 @@ CREATE UNIQUE INDEX tests_success_constraint ON tests (subject, target)
813814
run-time parameters (described in <xref linkend="runtime-config">).
814815
An inaccurate selectivity estimate is due to
815816
insufficient statistics. It may be possible to help this by
816-
tuning the statistics-gathering parameters (see <command>ALTER
817-
TABLE</command> reference).
817+
tuning the statistics-gathering parameters (see
818+
<xref linkend="sql-altertable" endterm="sql-altertable-title">).
818819
</para>
819820

820821
<para>

doc/src/sgml/queries.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/queries.sgml,v 1.26 2003/11/04 09:55:38 petere Exp $ -->
1+
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/queries.sgml,v 1.27 2003/11/06 22:21:47 tgl Exp $ -->
22

33
<chapter id="queries">
44
<title>Queries</title>
@@ -44,7 +44,7 @@ SELECT * FROM table1;
4444
client application. For example, the
4545
<application>psql</application> program will display an ASCII-art
4646
table on the screen, while client libraries will offer functions to
47-
retrieve individual rows and columns.) The select list
47+
extract individual values from the query result.) The select list
4848
specification <literal>*</literal> means all columns that the table
4949
expression happens to provide. A select list can also select a
5050
subset of the available columns or make calculations using the

doc/src/sgml/syntax.sgml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.87 2003/11/04 19:18:15 tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.88 2003/11/06 22:21:47 tgl Exp $
33
-->
44

55
<chapter id="sql-syntax">
@@ -205,7 +205,7 @@ UPDATE "my_table" SET "a" = 5;
205205
should be equivalent to <literal>"FOO"</literal> not
206206
<literal>"foo"</literal> according to the standard. If you want
207207
to write portable applications you are advised to always quote a
208-
particular name or never quote it.
208+
particular name or never quote it.)
209209
</para>
210210
</sect2>
211211

@@ -241,13 +241,13 @@ UPDATE "my_table" SET "a" = 5;
241241
<secondary>escaping</secondary>
242242
</indexterm>
243243
A string constant in SQL is an arbitrary sequence of characters
244-
bounded by single quotes (<quote>'</quote>), e.g., <literal>'This
244+
bounded by single quotes (<literal>'</literal>), e.g., <literal>'This
245245
is a string'</literal>. SQL allows single quotes to be embedded
246-
in strings by typing two adjacent single quotes (e.g.,
247-
<literal>'Dianne''s horse'</literal>). In
246+
in strings by typing two adjacent single quotes, e.g.,
247+
<literal>'Dianne''s horse'</literal>. In
248248
<productname>PostgreSQL</productname> single quotes may
249-
alternatively be escaped with a backslash (<quote>\</quote>,
250-
e.g., <literal>'Dianne\'s horse'</literal>).
249+
alternatively be escaped with a backslash (<literal>\</literal>),
250+
e.g., <literal>'Dianne\'s horse'</literal>.
251251
</para>
252252

253253
<para>
@@ -838,7 +838,7 @@ SELECT 3 OPERATOR(pg_catalog.+) 4;
838838
<itemizedlist>
839839
<listitem>
840840
<para>
841-
A constant or literal value; see <xref linkend="sql-syntax-constants">.
841+
A constant or literal value.
842842
</para>
843843
</listitem>
844844

0 commit comments

Comments
 (0)