11.07.2015 Views

Oracle Database 11 g - Online Public Access Catalog

Oracle Database 11 g - Online Public Access Catalog

Oracle Database 11 g - Online Public Access Catalog

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

206 CHAPTER 4 ■ PERFORMANCE MANAGEMENTSQL> select table_name, last_analyzed, num_rows fromuser_tableswhere table_name='PRODUCT_DESCRIPTIONS';TABLE_NAME LAST_ANALYZED NUM_ROWS-------------- ----------------- ------------------SQL>The query on the USER_TABLES view shows public statistics only, and thus there is nothingshowing that the database actually collected any statistics for the product_descriptions table.However, if you query the USER_TAB_PENDING_STATS view, which holds information about privatestatistics, you’ll see something else:SQL> select table_name, last_analyzed, num_rows fromuser_tab_pending_statswhere table_name='PRODUCT_DESCRIPTIONS';TABLE_NAME LAST_ANALYZED NUM_ROWS-------------------- -------------- -----------------PRODUCT_DESCRIPTIONS 29-MAY-07 8634SQL>The USER_TAB_PENDING_STATS view shows pending statistics for tables, partitions, andsubpartitions owned by the user issuing the command.Testing, Publishing, and Deleting Pending StatisticsYou can use the export_table_statistics procedure to export the pending statistics to a differentdatabase and test them there. If the query results aren’t encouraging with the pending statistics,you can delete pending statistics by executing the delete_pending_stats procedure, as shown here:SQL> exec dbms_stats.delete_pending_stats('HR','EMPLOYEES');You can choose to make pending statistics permanent, that is, publish them, by using thepublish_pending_statistics procedure, as shown in this example:SQL> exec dbms_stats.publish_pending_stats('HR','EMPLOYEES');If you want to publish all statistics collected for a particular schema, you can do so byexecuting this procedure:SQL> exec dbms_stats.publish_pending_stats('HR',null);You can publish all pending statistics in the database by executing the following procedure:SQL> exec dbms_stats.publish_pending_stats(null, null);By default, private statistics are turned off, as shown by the default setting of false for thenew <strong>Oracle</strong> <strong>Database</strong> <strong>11</strong>g initialization parameter optmizer_use_private_statistics.

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

Saved successfully!

Ooh no, something went wrong!