ibm-information-center/dist/eclipse/plugins/i5OS.ic.sqlp_5.4.0.1/rbafycrtindx.htm

74 lines
4.8 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<?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="reference" />
<meta name="DC.Title" content="Add indexes" />
<meta name="abstract" content="You can use indexes to sort and select data. In addition, indexes help the system retrieve data faster for better query performance." />
<meta name="description" content="You can use indexes to sort and select data. In addition, indexes help the system retrieve data faster for better query performance." />
<meta name="DC.subject" content="CREATE INDEX statement, example, examples, creating, index, add" />
<meta name="keywords" content="CREATE INDEX statement, example, examples, creating, index, add" />
<meta name="DC.Relation" scheme="URI" content="rbafysqltech.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafyussisql.htm" />
<meta name="DC.Relation" scheme="URI" content="../db2/rbafzmstxcindx.htm" />
<meta name="DC.Relation" scheme="URI" content="../rzajq/efindex.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="rbafycrtindx" />
<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>Add indexes</title>
</head>
<body id="rbafycrtindx"><a name="rbafycrtindx"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Add indexes</h1>
<div><p>You can use indexes to sort and select data. In addition, indexes
help the system retrieve data faster for better query performance.</p>
<div class="section"><p>Use the CREATE INDEX statement to create indexes. The following
example creates an index over the column <em>LASTNAME</em> in the CORPDATA.EMPLOYEE
table: </p>
<pre> <strong>CREATE INDEX</strong> CORPDATA.INX1 <strong>ON</strong> CORPDATA.EMPLOYEE (LASTNAME)</pre>
</div>
<div class="section"><p>You can create any number of indexes. However, because the indexes
are maintained by the system, a large number of indexes can adversely affect
performance. One type of index, the encoded vector index (EVI), allows for
faster scans that can be more easily processed in parallel. </p>
</div>
<div class="section"><p>If an index is created that has exactly the same attributes as
an existing index, the new index shares the existing indexes' binary tree.
Otherwise, another binary tree is created. If the attributes of the new index
are exactly the same as another index, except that the new index has fewer
columns, another binary tree is still created. It is still created because
the extra columns prevent the index from being used by cursors or UPDATE statements
that update those extra columns.</p>
</div>
<div class="section"><p>Indexes are created with the sort sequence in effect at the time
the CREATE INDEX statement is run. The sort sequence applies to all SBCS character
fields, or UCS-2 or UTF-16 graphic fields of the index. </p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafysqltech.htm" title="Data definition language (DDL) describes the portion of SQL that allows you to create, alter, and destroy database objects. These database objects include schemas, tables, views, sequences, catalogs, indexes, and aliases.">Data definition language (DDL)</a></div>
</div>
<div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="rbafyussisql.htm" title="A sort sequence defines how characters in a character set relate to each other when they are compared or ordered. Normalization allows you to compare strings that contain combining characters.">Sort sequences and normalization in SQL</a></div>
</div>
<div class="relinfo"><strong>Related information</strong><br />
<div><a href="../db2/rbafzmstxcindx.htm">CREATE INDEX</a></div>
<div><a href="../rzajq/efindex.htm">Create an index strategy</a></div>
</div>
</div>
</body>
</html>