Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Oracle Database 11gR2 Performance Tuning Cookbook

You're reading from  Oracle Database 11gR2 Performance Tuning Cookbook

Product type Book
Published in Jan 2012
Publisher Packt
ISBN-13 9781849682602
Pages 542 pages
Edition 1st Edition
Languages
Author (1):
Ciro Fiorillo Ciro Fiorillo
Profile icon Ciro Fiorillo

Table of Contents (21) Chapters

Oracle Database 11gR2 Performance Tuning Cookbook
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
1. Starting with Performance Tuning 2. Optimizing Application Design 3. Optimizing Storage Structures 4. Optimizing SQL Code 5. Optimizing Sort Operations 6. Optimizing PL/SQL Code 7. Improving the Oracle Optimizer 8. Other Optimizations 9. Tuning Memory 10. Tuning I/O 11. Tuning Contention Dynamic Performance Views A Summary of Oracle Packages Used for Performance Tuning Index

Collecting statistics


To work well, the optimizer relies on information about both—the data structures involved in the query and the data contained in them; the latter information is provided by statistics.

In this recipe, we will see how to collect statistics on database objects and see its effects on the optimizer's performance.

How to do it...

The following steps will show how to collect statistics on database objects:

  1. Connect to SH schema:

    CONNECT sh@TESTDB/sh
    
  2. Collect statistics on the CUSTOMERS table:

    EXEC DBMS_STATS.GATHER_TABLE_STATS (OWNNAME => 'SH', -
      TABNAME => 'CUSTOMERS', -
      ESTIMATE_PERCENT => 20, BLOCK_SAMPLE => TRUE, -
      CASCADE => TRUE, DEGREE => 4);
    
  3. Query for some statistic data collected in the previous step:

    SET PAGESIZE 100
    SET LINESIZE 90
    SELECT
      NUM_ROWS, BLOCKS, EMPTY_BLOCKS, AVG_SPACE, CHAIN_CNT,
      AVG_ROW_LEN, AVG_SPACE_FREELIST_BLOCKS, NUM_FREELIST_BLOCKS,
      SAMPLE_SIZE, GLOBAL_STATS, USER_STATS, LAST_ANALYZED
    FROM DBA_TABLES
    WHERE TABLE_NAME ...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}