76 lines
5.0 KiB
HTML
76 lines
5.0 KiB
HTML
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<!DOCTYPE html
|
||
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
<html lang="en-us" xml:lang="en-us">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<meta name="security" content="public" />
|
||
|
<meta name="Robots" content="index,follow" />
|
||
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
||
|
<meta name="DC.Type" content="concept" />
|
||
|
<meta name="DC.Title" content="Indexes with partitioned tables" />
|
||
|
<meta name="abstract" content="Indexes can be created as partitioned or nonpartitioned. A partitioned index creates an individual index for each partition. A nonpartitioned index is a single index spanning all partitions of the table." />
|
||
|
<meta name="description" content="Indexes can be created as partitioned or nonpartitioned. A partitioned index creates an individual index for each partition. A nonpartitioned index is a single index spanning all partitions of the table." />
|
||
|
<meta name="DC.subject" content="Partitioned tables, indexes" />
|
||
|
<meta name="keywords" content="Partitioned tables, indexes" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="partitionedtables.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="../db2/rbafzmstxcindx.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="performancept.htm" />
|
||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
|
||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="indexpt" />
|
||
|
<meta name="DC.Language" content="en-us" />
|
||
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
||
|
<!-- US Government Users Restricted Rights -->
|
||
|
<!-- Use, duplication or disclosure restricted by -->
|
||
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
||
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
||
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
||
|
<title>Indexes with partitioned tables</title>
|
||
|
</head>
|
||
|
<body id="indexpt"><a name="indexpt"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Indexes with partitioned tables</h1>
|
||
|
<div><p>Indexes can be created as partitioned or nonpartitioned. A partitioned
|
||
|
index creates an individual index for each partition. A nonpartitioned index
|
||
|
is a single index spanning all partitions of the table.</p>
|
||
|
<p>Partitioned indexes allow you to take advantage of improved optimization
|
||
|
of queries. If a unique index is partitioned, columns specified in the index
|
||
|
must be the same or a superset of the data partition key.</p>
|
||
|
<p>Use the CREATE INDEX statement to create indexes on partitioned tables.
|
||
|
To create an index for each partition, use the <samp class="codeph">PARTITIONED</samp> clause.</p>
|
||
|
<pre>CREATE INDEX PRODLIB.SAMPLEINDEX
|
||
|
ON PRODLIB.PAYROLL(EMPNUM) PARTITIONED</pre>
|
||
|
<p>To create a single index that spans all partitions, use the <samp class="codeph">NOT
|
||
|
PARTITIONED</samp> clause.</p>
|
||
|
<pre>CREATE INDEX PRODLIB.SAMPLEINDEX
|
||
|
ON PRODLIB.PAYROLL(EMPNUM) NOT PARTITIONED</pre>
|
||
|
<p>You can only create a partitioned Encoded Vector Index (EVI) over a partitioned
|
||
|
table. You cannot create a nonpartitioned EVI over a partitioned table.</p>
|
||
|
<p>See the CREATE INDEX statement in the SQL Reference topic for more information
|
||
|
about creating indexes for partitioned tables.</p>
|
||
|
<p>When creating an SQL unique index, unique constraint, or primary key constraint
|
||
|
for a partitioned table, the following restrictions apply:</p>
|
||
|
<ul><li>An index can be partitioned if the keys of the unique index are the same
|
||
|
or a superset of the partitioned keys.</li>
|
||
|
<li>If a unique index is created with the default value of NOT PARTITIONED,
|
||
|
and the keys of the unique index are a superset of the partitioned keys, the
|
||
|
unique index is created as partitioned. If, however, the user explicitly specifies
|
||
|
NOT PARTITIONED, and the keys of the unique index are a superset of the partitioned
|
||
|
keys, the unique index is created as <strong>not</strong> partitioned.</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="partitionedtables.htm" title="DB2 UDB for iSeries supports partitioned tables using SQL.">Partitioned tables</a></div>
|
||
|
</div>
|
||
|
<div class="relconcepts"><strong>Related concepts</strong><br />
|
||
|
<div><a href="performancept.htm" title="Queries that reference partitioned tables need to be carefully considered because partitioned tables are often very large. It is important to understand the effects of accessing multiple partitions on your system and applications.">Query performance and optimization</a></div>
|
||
|
</div>
|
||
|
<div class="reltasks"><strong>Related tasks</strong><br />
|
||
|
<div><a href="../db2/rbafzmstxcindx.htm">CREATE INDEX</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|