01.09.2016 Views

Beginning Oracle Database 11g Administration From Novice to Professional

Create successful ePaper yourself

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

CHAPTER 17 SQL TUNING 391<br />

are the procedures. They can<br />

be used <strong>to</strong> cus<strong>to</strong>mize how the collects statistics. The available<br />

options are similar <strong>to</strong> those of the procedures.<br />

Caution One class of statistics that is not collected au<strong>to</strong>matically is the system statistics; an example is<br />

, the time taken <strong>to</strong> read one random block from disk. System statistics must be collected manually<br />

by using the procedure. For details, refer <strong>to</strong> <strong>Oracle</strong> <strong>Database</strong> <strong>11g</strong> PL/SQL Packages<br />

and Types Reference.<br />

Tuning by Example<br />

Let’s experience the process of tuning an SQL statement by creating two tables, <br />

and , modeled after and , two dictionary views. Every<br />

record in describes one table, and every record in describes one<br />

index. The exercise is <strong>to</strong> print the details (, , and ) of tables<br />

that have at least one bitmap index.<br />

Note that you will need the and privileges for this<br />

exercise. You may need the help of your database administra<strong>to</strong>r or you may need <strong>to</strong> use<br />

your own <strong>Oracle</strong> database on your lap<strong>to</strong>p or PC.<br />

Creating and Populating the Tables<br />

Create and populate the two tables as follows. When I performed the experiment, 1,574<br />

rows of information were inserted in<strong>to</strong> , and 1,924 rows of information were<br />

inserted in<strong>to</strong> .

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

Saved successfully!

Ooh no, something went wrong!