NESTED LOOPS TABLE ACCESS FULL SALES TABLE ACCESS BY ROWID COMPANY INDEX UNIQUE SCAN COMPANY_PK
Starting from Nonselective Criteria
NESTED LOOPS is a directional operation; if you join two tables via a NESTED LOOPS operation, you will get different performance depending on which of the tables is the driving table.
Consider SALES and COMPANY again. What if COMPANY has 5 records, and SALES has 100,000 records?
If SALES is used as the driving table, then the execution path will require a full table scan of SALES, plus repeated accesses to the same rows in COMPANY. There would be 100,000 rows read from SALES, plus 100,000 accesses of COMPANY, for a total of 200,000 accesses.
However, if COMPANY were used as the driving table, then how many accesses would be necessary? There would be 5 accesses of COMPANY, plus 100,000 accesses of SALES - a total of 100,005 accesses. Thus, changing the choice of the driving table in this example reduces the number of accesses performed by almost 50 percent. As more and more tables are added to the query, the size of the driving set passed to each successive join has a great impact on the performance of the query.