Free Oracle Tips

Oracle Consulting Oracle Training Development

Remote DBA

 

Remote DBA Plans
Remote DBA Service

 
Remote DBA Oracle Home
Remote DBA Oracle Training
Remote DBA SQL Tuning Consulting
Remote DBA Oracle Tuning Consulting
Remote DBA Data Warehouse Consulting
Remote DBA Oracle Project Management
Remote DBA Oracle Security Assessment
Remote DBA Unix Consulting
Burleson Books
Burleson Articles
Burleson Web Courses
Burleson Qualifications
Oracle Internals Magazine
Oracle Links
Remote DBA Oracle Monitoring
Remote DBA Support Benefits
Remote DBA Plans & Prices
Our Automation Strategy
What We Monitor
Oracle Apps Support
Print Our Brochure
Contact Us (e-mail)
Oracle Job Opportunities
Oracle Consulting Prices





   

 


        
 
     Oracle:

 
Create Oracle indexes
 
This exercise will give you an opportunity to see how the SQL optimizer accesses indexes to generate an efficient access plan.
 
Procedure
Your assignment involves creating these indexes in your pubs schema and noting how they change the execution plan for your SQL.  Because the pubs database is so small, the cost-based optimizer will choose full-table scans because it knows that the tables reside on only a few database blocks.  Hence, we will force the use of the indexes with an index hint inside the SQL statement.
 
Step 1 – Save these SQL queries as test_idx.sql in your c: directory
 
select
   initcap(store_name),
   store_state
from
  store
where
   lower(store_name) = lower('Borders')
;
 
Step 2 – Run this script and save the execution plan for the queries.
 
Step 3 – Create two indexes on the store table, as follows.
 
 
create bitmap index
   Store_state_idx
on
   store
( store_state );
 
create index
   store_name_idx
on
   store
lower(store_name);
 
 
Above, we create a bitmap index on store_state.  Because there are only 50 distinct column values, we can use a bitmap index.
 
We also create a function-based index on store_name because out SQL is transforming the column using the lower BIF.
 
Step 4 – Re-run the query in test_idx.sql and note all changes to the execution plan.


 

     

Remote DBA Service
 

Oracle Tuning Book

Free Oracle dictionary reference poster

BC Oracle support

Oracle books by Rampant

Oracle monitoring software

North Carolina Oracle Users Group

 

 Arabian horse breeder

Seeing eye horses

 

 

 

 

 

Burleson is the American Team

American Flag

 

 

BC Remote Oracle Support
P.O. Box 511 • Kittrell, NC, 27544

Remote DBA

Remote DBA Services

 

Copyright © 1996 -  2011 by Burleson Enterprises. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation.