The types of indexes required for an Online Transaction systems ( OLTP Systems ) will be different from those required for Reporting Applications or Decision support Systems ( DSS Systems).
The number of records fetched or number of blocks required to be scanned in an OLTP System is very few. Normally OLTP applications are based on the user input to either query or update the record for a single key value. So fetching the table record based on the index scan will have least block reads and CPU time.
The primary key will allow the application developers to use a unique number to represent data record. The concept of primary key is required to implement referential integrity constraints or foreign keys.
The reporting queries of DSS Systems has to read the entire table in order to do sorting or aggregate function or perform join operations. If more than 25% of data in a table is to be selected then a full table scan can be chosen instead of an index scan.
Based on the percent of table data scanned either index scan or full table sacn can be used. The performance optimizer can choose the best plan if the table statistics are updated and the optimizer mode is set to either cost based or choose. If the queries contain either sorting or aggregate functions, then all the required data needs to be read either using a full table scan or an index range scan.
For tables that contain large text columns or if the average row length is high, then scanning the table invloves fetching large number of blocks and this may involve more disk reads. If all columns required for the query is present in an index then the table fetch can be avoided. This may reduce the amount of physical reads considerably.
The following information about the database will be useful in performance optimization
Information from Static Data Dictionary views
Information from Dynamic Performace views
-- TOP 10 UNIQUE SCAN indexes ordered by physical reads select * from( select OPERATION,OPTIONS,OBJECT_OWNER,OBJECT_NAME, sum(EXECUTIONS) EXECUTIONS, sum(OUTPUT_ROWS) OUTPUT_ROWS, sum(CR_BUFFER_GETS+CU_BUFFER_GETS) BUFFER_GETS, sum(DISK_READS) DISK_READS, sum(DISK_WRITES) DISK_WRITES, sum(ELAPSED_TIME) ELAPSED_TIME from v$sql_plan_statistics_all where operation = 'INDEX' and options = 'UNIQUE SCAN' GROUP BY OPERATION,OPTIONS,OBJECT_OWNER,OBJECT_NAME ORDER BY DISK_READS DESC) WHERE rownum<11;
Manage Locks in Oracle
Scripts to generate schema objects
Using Index Fast Full Scan
Using Returning clause
Managing Tablespaces and Datafiles
Script to reorganize tables
Hidden Parameters in Oracle
Using Multiple block sizes for tablespaces
Index Optimization Scripts
Managing Constraints
Oracle Installation
Oracle Tips
Oracle links
Oracle Books
Indexing strategies
Segment usage statistics