nerdexam
Oracle

1Z0-117 · Question #42

Examine Exhibit 1 to view the query and its execution plan. Examine Exhibit 2 to view the structure and indexes for the EMPLOYEES and DEPARTMENTS tables. Examine Exhibit 3 to view the initialization…

The correct answer is A. Because the OPTIMIZER_MODE parameter is set to ALL_ROWS. B: There is not an inequality condition in the statement. C: Merge joins are beneficial if the columns are sorted. D: All regular joins should be able to use Hash or Sort Merge, except LIKE, !=, and NOT ... joins. A sort merge join is a join optimization method where two tables…

Understanding and Influencing the Optimizer

Question

Examine Exhibit 1 to view the query and its execution plan. Examine Exhibit 2 to view the structure and indexes for the EMPLOYEES and DEPARTMENTS tables. Examine Exhibit 3 to view the initialization parameters for the instance. Why is sort-merge join chosen as the access method?

Exhibits

1Z0-117 question #42 exhibit 1
1Z0-117 question #42 exhibit 2
1Z0-117 question #42 exhibit 3

Options

  • ABecause the OPTIMIZER_MODE parameter is set to ALL_ROWS.
  • BBecause of an inequality condition.
  • CBecause the data is not sorted in the LAST_NAME column of the EMPLOYEES table
  • DBecause of the LIKE operator used in the query to filter out records

How the community answered

(55 responses)
  • A
    76% (42)
  • B
    4% (2)
  • C
    7% (4)
  • D
    13% (7)

Explanation

B: There is not an inequality condition in the statement. C: Merge joins are beneficial if the columns are sorted. D: All regular joins should be able to use Hash or Sort Merge, except LIKE, !=, and NOT ... joins. * A sort merge join is a join optimization method where two tables are sorted and then joined. * A "sort merge" join is performed by sorting the two data sets to be joined according to the join keys and then merging them together. The merge is very cheap, but the sort can be prohibitively expensive especially if the sort spills to disk. The cost of the sort can be lowered if one of the data sets can be accessed in sorted order via an index, although accessing a high proportion of blocks of a table via an index scan can also be very expensive in comparison to a full table scan. * Sort merge joins are useful when the join condition between two tables is an inequality condition (but not a nonequality) like <, <=, >, or >=. Sort merge joins perform better than nested loop joins for large data sets. You cannot use hash joins unless there is an equality condition. * When the Optimizer Uses Sort Merge Joins The optimizer can choose a sort merge join over a hash join for joining large amounts of data if any of the following conditions are true: / The join condition between two tables is not an equi-join. / Because of sorts already required by other operations, the optimizer finds it is cheaper to use a sort merge than a hash join.

Topics

#sort-merge join#optimizer mode#ALL_ROWS#join method selection

Community Discussion

No community discussion yet for this question.

Full 1Z0-117 Practice