16.10.2015 Views

Getting Started with IBM Data Studio for DB2

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

116 <strong>Getting</strong> <strong>Started</strong> <strong>with</strong> <strong>IBM</strong> <strong>Data</strong> <strong>Studio</strong> <strong>for</strong> <strong>DB2</strong><br />

• In-place reorganization (called Incrementally reorganize the table in place in the<br />

Options tab shown in Figure 3.15) allows reorganization to occur while the table or<br />

index is fully accessible. If you select this option, you can set the table access<br />

control to allow read, or read and write access.<br />

• Offline reorganization (called Rebuild a shadow copy of the table in the Options<br />

tab) means that reorganization occurs in offline mode. You can specify whether to<br />

allow read access or not during offline reorganization.<br />

While offline reorganization is fast and allows perfect clustering of the data, online<br />

reorganization lets the table remain online to applications. If applications must write to the<br />

table while reorganization is occurring, use the in-place reorganization method. When you<br />

use in-place reorganization, you have more control over the process, and you can pause<br />

and restart the process. However, in-place reorganization requires more time to complete.<br />

You can reorganize the table by using an existing index. When you reorganize by using an<br />

existing index, the data is accessed more quickly while data is being reorganized.<br />

When you choose offline reorganization, you can use the temporary table space to store<br />

the copy of the reorganized table. You can use the temporary table space by selecting the<br />

Use system tempspace to temporarily store a copy of the reorganized table option. You<br />

can also reorganize long fields and large object data, as well as the option to reset the<br />

dictionary if data compression is enabled.<br />

4. After you choose the options that are required <strong>for</strong> your organization, you can run<br />

the command by clicking Run, as shown in Figure 3.15 above.<br />

5. Close the editor be<strong>for</strong>e you start the next task.<br />

3.2.4 Gathering statistics<br />

When an application runs a query, the <strong>DB2</strong> optimizer compiles the query and creates an<br />

access plan, which describes the sequence of steps to run the query and fetch the data<br />

that is returned. Access plans give estimations of the cost and time that is required to run a<br />

query. The sequence of steps that is created as part of the access plan depends on a<br />

number of factors, such as:<br />

<br />

<br />

<br />

<br />

Size of the database table, indexes and views<br />

Distribution of data in the specific columns of the tables<br />

Average length and the cardinality of the column values<br />

Amount of null values and the highest and lowest values of the columns<br />

As update, insert, and delete transactions happen on a database, the data grows or shrinks<br />

and often changes its distribution. This means the statistics that the optimizer currently<br />

knows about are outdated and no longer reflect reality. If the in<strong>for</strong>mation stored in the<br />

catalogs is not up to date, the steps created as part of the access plan may not be accurate<br />

and can generate a less than optimal access plan, which may negatively affect<br />

per<strong>for</strong>mance.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!