66 lines
3.7 KiB
HTML
66 lines
3.7 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="reference" />
|
||
|
<meta name="DC.Title" content="Check constraint optimization" />
|
||
|
<meta name="abstract" content="The optimizer uses check constraints (either user-added or the implicit check constraints added for the partition key) to reduce the partitions examined." />
|
||
|
<meta name="description" content="The optimizer uses check constraints (either user-added or the implicit check constraints added for the partition key) to reduce the partitions examined." />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzaf3sqept.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="creatept.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="rzaf3ptcheck" />
|
||
|
<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>Check constraint optimization</title>
|
||
|
</head>
|
||
|
<body id="rzaf3ptcheck"><a name="rzaf3ptcheck"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Check constraint optimization</h1>
|
||
|
<div><p>The optimizer uses check constraints (either user-added or the
|
||
|
implicit check constraints added for the partition key) to reduce the partitions
|
||
|
examined.</p>
|
||
|
<div class="section"><p>For additional information about the implicitly added partitioning
|
||
|
key constraints see Creating partitioned tables. In the following example,
|
||
|
assume that PAYROLL is partitioned by range:</p>
|
||
|
<pre>SELECT LASTNAME, SALARY
|
||
|
FROM PRODLIB.PAYROLL
|
||
|
WHERE EMPNUM = :hv1</pre>
|
||
|
<p>The optimizer adds new predicates
|
||
|
to each partition in the table:</p>
|
||
|
<pre>SELECT LASTNAME, SALARY FROM
|
||
|
(SELECT LASTNAME, SALARY FROM PRODLB.PAYROLL(PART00001)
|
||
|
WHERE EMPNUM=:hv1 AND :hv1 <= 500
|
||
|
UNION ALL
|
||
|
SELECT LASTNAME, SALARY FROM PRODLB.PAYROLL(PART00002)
|
||
|
WHERE EMPNUM=:hv1 AND :hv1 >= 501 AND :hv1 <=1000
|
||
|
UNION ALL
|
||
|
SELECT LASTNAME, SALARY FROM PRODLB.PAYROLL(PART00003)
|
||
|
WHERE EMPNUM=:hv1 AND (:hv1 IS NULL OR :hv1 >= 1001))
|
||
|
X (LASTNAME, SALARY)</pre>
|
||
|
<p>If the value of hv1 is
|
||
|
603, then only the rows of partition PART00002 are examined.</p>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzaf3sqept.htm" title="The SQL Query Engine (SQE) provides targeted optimization for partitioned tables using dynamic partition expansion optimization.">Queries using SQL Query Engine</a></div>
|
||
|
</div>
|
||
|
<div class="relconcepts"><strong>Related concepts</strong><br />
|
||
|
<div><a href="creatept.htm" title="New partitioned tables can be created using the CREATE TABLE statement.">Creation of partitioned tables</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|