Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 

 
 

Oracle SQL and-equal data access method

Oracle Database Tips by Donald Burleson


When Oracle prepares an execution plan for SQL statements, he builds a costed decision tree with different access methods.  The and-equal is one such access method which was widely used in the rule-based optimizer (RBO) but is now largely obsolete. (the and-equal hint is still supported in the CBO).

Using ?and_equal? Hints To Concatenate Indexes:

 

Index1           column1_primary key

Index2           column2

Index3           column1        column2 ?

Index4           column2        column1 ?

In this case index3 and 4 were created for multiple column queries with some lead columns on 1 and some lead columns on 2.  In this case Index 3 and 4 could be removed and multi-column queries that use column1 and 2 can use the ?and_equal? hint to cause the optimizer to use index1 and index2 before accessing the table with rowids.  Using the ?and_equal? hint does have additional overhead since two indexes must be read.  You have to balance the overhead of two reading two indexes against the overhead of the additional indexes. 

I also find cases where Index3 and Index4 were added to support queries that contained both column1 and column2 in separate WHERE clauses.  These indexes were added because in some queries column1 is more restrictive (so it is the lead column) and in other queries column2 is more restrictive (and thus the lead column).  In fact either Index3 or Index4 (or using the ?and_equal? hint) will satisfy the query and will have equivalent performance.  You are also relying on the optimizer to pick the correct index to use, which is unlikely.  Having the lead column the most restrictive column will not affect the index performance.  In this case you can drop either Index3 or Index4 and not affect query performance. 

Remember that leading columns are only important in that they must be used in the WHERE clause for the index to be used.  Oracle 9i introduced the index skip scan that allows you to use an index where  the lead column is not in the where clause, but this requires more overhead than performance benefit.


This page has excellent notes on the and-equal access method:

SELECT *
FROM   my_table
WHERE  column5 = 230
AND    column8 = 'BLORT'

SELECT STATEMENT
TABLE ACCESS MY_TABLE BY ROWID
AND-EQUAL
NON-UNIQUE INDEX RANGE SCAN MY_TABLE_I5
NON-UNIQUE INDEX RANGE SCAN MY_TABLE_I8

The and-equal access method scans all nominated single column indexes used in AND col1 = xxx and col2=yyy, where both col1 and col2 have non-unique single key indexes on them.

The and-equal hint is specified in this form:

/*+ AND_EQUAL ( table index index [index] [index] [index] ) */

 
Get the Complete
Oracle SQL Tuning Information 

The landmark book "Advanced Oracle SQL Tuning  The Definitive Reference"  is filled with valuable information on Oracle SQL Tuning. This book includes scripts and tools to hypercharge Oracle 11g performance and you can buy it for 30% off directly from the publisher.

 

   

 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2017

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

Remote Emergency Support provided by Conversational