~ubuntu-branches/debian/squeeze/pgadmin3/squeeze

« back to all changes in this revision

Viewing changes to docs/en_US/pg/indexes-partial.html

  • Committer: Bazaar Package Importer
  • Author(s): Raphael Enrici, src/frm/frmBackup.cpp, debian/control
  • Date: 2006-10-06 21:06:48 UTC
  • mfrom: (1.1.3 upstream) (3 etch)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20061006210648-8ebo8o2zu28ydg0d
Tags: 1.4.3-2
* Patched frmBackup.cpp to ensure the schema is specified when backing up
  individual tables. (Closes: #387256)
  [src/frm/frmBackup.cpp]
* Cleaned up and updated description of the package. (Closes: #379188)
  [debian/control]

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
<title>11.7.�Partial Indexes</title>
5
5
<link rel="stylesheet" href="stylesheet.css" type="text/css">
6
6
<link rev="made" href="pgsql-docs@postgresql.org">
7
 
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
8
 
<link rel="start" href="index.html" title="PostgreSQL 8.1.3 Documentation">
 
7
<meta name="generator" content="DocBook XSL Stylesheets V1.70.0">
 
8
<link rel="start" href="index.html" title="PostgreSQL 8.1.4 Documentation">
9
9
<link rel="up" href="indexes.html" title="Chapter�11.�Indexes">
10
10
<link rel="prev" href="indexes-expressional.html" title="11.6.�Indexes on Expressions">
11
11
<link rel="next" href="indexes-opclass.html" title="11.8.�Operator Classes">
 
12
<link rel="copyright" href="ln-legalnotice.html" title="Legal Notice">
12
13
</head>
13
14
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="sect1" lang="en">
14
15
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
15
16
<a name="indexes-partial"></a>11.7.�Partial Indexes</h2></div></div></div>
16
 
<a name="id576409"></a><p>   A <em class="firstterm">partial index</em> is an index built over a
 
17
<a name="id628948"></a><p>   A <em class="firstterm">partial index</em> is an index built over a
17
18
   subset of a table; the subset is defined by a conditional
18
19
   expression (called the <em class="firstterm">predicate</em> of the
19
20
   partial index).  The index contains entries for only those table
32
33
  </p>
33
34
<div class="example">
34
35
<a name="indexes-partial-ex1"></a><p class="title"><b>Example�11.1.�Setting up a Partial Index to Exclude Common Values</b></p>
 
36
<div class="example-contents">
35
37
<p>    Suppose you are storing web server access logs in a database.
36
38
    Most accesses originate from the IP address range of your organization but
37
39
    some are from elsewhere (say, employees on dial-up connections).
72
74
    maintenance work to change the index definition from time to time.
73
75
   </p>
74
76
</div>
75
 
<p>   Another possible use for a partial index is to exclude values from the
 
77
</div>
 
78
<br class="example-break"><p>   Another possible use for a partial index is to exclude values from the
76
79
   index that the
77
80
   typical query workload is not interested in; this is shown in <a href="indexes-partial.html#indexes-partial-ex2" title="Example�11.2.�Setting up a Partial Index to Exclude Uninteresting Values">Example�11.2, &#8220;Setting up a Partial Index to Exclude Uninteresting Values&#8221;</a>.  This results in the same
78
81
   advantages as listed above, but it prevents the
83
86
  </p>
84
87
<div class="example">
85
88
<a name="indexes-partial-ex2"></a><p class="title"><b>Example�11.2.�Setting up a Partial Index to Exclude Uninteresting Values</b></p>
 
89
<div class="example-contents">
86
90
<p>    If you have a table that contains both billed and unbilled orders,
87
91
    where the unbilled orders take up a small fraction of the total
88
92
    table and yet those are the most-accessed rows, you can improve
116
120
    orders.
117
121
   </p>
118
122
</div>
119
 
<p>   <a href="indexes-partial.html#indexes-partial-ex2" title="Example�11.2.�Setting up a Partial Index to Exclude Uninteresting Values">Example�11.2, &#8220;Setting up a Partial Index to Exclude Uninteresting Values&#8221;</a> also illustrates that the
 
123
</div>
 
124
<br class="example-break"><p>   <a href="indexes-partial.html#indexes-partial-ex2" title="Example�11.2.�Setting up a Partial Index to Exclude Uninteresting Values">Example�11.2, &#8220;Setting up a Partial Index to Exclude Uninteresting Values&#8221;</a> also illustrates that the
120
125
   indexed column and the column used in the predicate do not need to
121
126
   match.  <span class="productname">PostgreSQL</span> supports partial
122
127
   indexes with arbitrary predicates, so long as only columns of the
145
150
  </p>
146
151
<div class="example">
147
152
<a name="indexes-partial-ex3"></a><p class="title"><b>Example�11.3.�Setting up a Partial Unique Index</b></p>
 
153
<div class="example-contents">
148
154
<p>    Suppose that we have a table describing test outcomes.  We wish
149
155
    to ensure that there is only one &#8220;<span class="quote">successful</span>&#8221; entry for
150
156
    a given subject and target combination, but there might be any number of
164
170
    successful tests and many unsuccessful ones.
165
171
   </p>
166
172
</div>
167
 
<p>   Finally, a partial index can also be used to override the system's
 
173
</div>
 
174
<br class="example-break"><p>   Finally, a partial index can also be used to override the system's
168
175
   query plan choices.  It may occur that data sets with peculiar
169
176
   distributions will cause the system to use an index when it really
170
177
   should not.  In that case the index can be set up so that it is not