Good day.
There is the following query:
select B.f_base_id from base B where B.f_groupbase_id = 123 Plan:
---------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ---------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 81 | 648 | 2 (0)| 00:00:01 | |* 1 | VIEW | index$_join$_001 | 81 | 648 | 2 (0)| 00:00:01 | |* 2 | HASH JOIN | | | | | | |* 3 | INDEX RANGE SCAN | FK_R_GROUPBASE_BASE | 81 | 648 | 1 (0)| 00:00:01 | | 4 | INDEX FAST FULL SCAN| PK_BASE | 81 | 648 | 1 (0)| 00:00:01 | ---------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 1 - filter("B"."F_GROUPBASE_ID"=123) 2 - access(ROWID=ROWID) 3 - access("B"."F_GROUPBASE_ID"=123)
Interested in the question of exactly how the selection of rows? Do I understand correctly that Oracle first in the FK_R_GROUPBASE_BASE index searches for ROWID records with a value of 123, after which the PK_BASE index is completely scanned (without reference to the table itself) and then through HASH JOIN the rows are joined, where the ROWID in the FK_R_GROUPBASE_BASE index equals the ROWID in PK_BASE? I can’t quite understand why an operation is needed.1 - filter("B"."F_GROUPBASE_ID"=123) .
Also, I don’t understand why Orakl chose this particular plan, and not the scan (INDEX RANGE SCAN) of the FK_R_GROUPBASE_BASE index, and then TABLE ACCESS BY INDEX ROWID. How can a plan be better?
thank
baseis a table or view. If view it is necessary to see the request which is inside this view. In addition, you need to know exactly how all the tables are created, is it particularly interesting with the non-IOT (index organized table) case? - Mike"почему Оракл выбрал именно этот план"you need to know a lot about your data and indexes. For example: (answers to @Mike questions) +data skewness,index clustering factor, characteristics of indices for columns:f_base_id, f_groupbase_idand all indexes in which these columns participate - MaxU