ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzajq_5.4.0.1/insertnrows.htm

79 lines
5.6 KiB
HTML
Raw 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="Use INSERT n ROWS" />
<meta name="abstract" content="Applications that perform many INSERT statements in succession may be improved by using INSERT n ROWS. With this clause, you can insert one or more rows of data from a host structure array into a target table. This array must be an array of structures where the elements of the structure correspond to columns in the target table." />
<meta name="description" content="Applications that perform many INSERT statements in succession may be improved by using INSERT n ROWS. With this clause, you can insert one or more rows of data from a host structure array into a target table. This array must be an array of structures where the elements of the structure correspond to columns in the target table." />
<meta name="DC.subject" content="improving performance, using, INSERT n ROWS, performance improvement, using INSERT n ROWS, INSERT n ROWS, improving performance, ROWS, INSERT n, statements, INSERT, n ROWS" />
<meta name="keywords" content="improving performance, using, INSERT n ROWS, performance improvement, using INSERT n ROWS, INSERT n ROWS, improving performance, ROWS, INSERT n, statements, INSERT, n ROWS" />
<meta name="DC.Relation" scheme="URI" content="progtech.htm" />
<meta name="DC.Relation" scheme="URI" content="../db2/rbafzmstbackup.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="insertnrows" />
<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>Use INSERT n ROWS</title>
</head>
<body id="insertnrows"><a name="insertnrows"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Use INSERT n ROWS</h1>
<div><p>Applications that perform many INSERT statements in succession
may be improved by using INSERT n ROWS. With this clause, you can insert
one or more rows of data from a host structure array into a target table.
This array must be an array of structures where the elements of the structure
correspond to columns in the target table.</p>
<div class="section"><p>An SQL application that loops over an INSERT...VALUES statement
(without the n ROWS clause) can be improved by using the INSERT n ROWS statement
to insert multiple rows into the table. After the application has looped
to fill the host array with rows, a single INSERT n ROWS statement can be
run to insert the entire array into the table. The statement runs faster
because the SQL run-time was only called once and all the data was simultaneously
inserted into the target table.</p>
</div>
<div class="section"><p>In the following table, the program attempted to INSERT 100 rows
into a table. Note the differences in the number of calls to SQL run-time
and to the database manager when blocking can be performed.</p>
</div>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="hsides" border="1" rules="all"><caption>Table 1. Number of Calls Using an INSERT
Statement</caption><thead align="left"><tr valign="bottom"><th valign="bottom" width="33.33333333333333%" id="d0e55">&nbsp;</th>
<th valign="bottom" width="33.33333333333333%" id="d0e56">Database Manager Not Using Blocking</th>
<th valign="bottom" width="33.33333333333333%" id="d0e58">Database Manager Using Blocking</th>
</tr>
</thead>
<tbody><tr><td align="left" valign="top" width="33.33333333333333%" headers="d0e55 ">Single-Row INSERT Statement</td>
<td align="left" valign="top" width="33.33333333333333%" headers="d0e56 ">100 SQL run-time calls 100 database calls</td>
<td align="left" valign="top" width="33.33333333333333%" headers="d0e58 ">100 SQL run-time calls 1 database call</td>
</tr>
<tr><td align="left" valign="top" width="33.33333333333333%" headers="d0e55 ">Multiple-Row INSERT Statement</td>
<td align="left" valign="top" width="33.33333333333333%" headers="d0e56 ">1 SQL run-time call 100 database calls</td>
<td align="left" valign="top" width="33.33333333333333%" headers="d0e58 ">1 SQL run-time call 1 database call</td>
</tr>
</tbody>
</table>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="progtech.htm" title="By changing the coding of your queries, you can improve their performance.">Programming techniques for database performance</a></div>
</div>
<div class="relinfo"><strong>Related information</strong><br />
<div><a href="../db2/rbafzmstbackup.htm">INSERT statement</a></div>
</div>
</div>
</body>
</html>