View the Exhibit1 and examine the structure and indexes for the MYSALES table.
The application uses the MYSALES table to insert sales record. But this table is also extensively
used for generating sales reports. The PROD_ID and CUST_ID columns are frequently used in
the WHERE clause of the queries. These columns are frequently used in WHERE clause of the
queries. These columns have few distinct values relative to the total number of rows in the table.
View exhibit 2 and examine one of the queries and its auto trace output.
What should you do to improve the performance of the query?
A.
Use the INDEX_COMBINE hint in the query.
B.
Create composite index involving the CUST_ID and PROD_ID columns.
C.
Gather histograms statistics for the CUST_ID and PROD_ID columns.
D.
Gather index statistics for the MYSALES_PRODID_IDX and MYSALES_CUSTID_IDX indexes.
Explanation:
Note:
* Statistics quantify the data distribution and storage characteristics of tables, columns, indexes,and partitions.
* INDEX_COMBINE
Forces a bitmap index access path on tab.
Primarily this hint just tells Oracle to use the bitmap indexes on table tab. Otherwise Oracle will
choose the best combination of indexes it can think of based on the statistics. If it is ignoring a
bitmap index that you think would be helpful, you may specify that index plus all of the others taht
you want to be used. Note that this does not force the use of those indexes, Oracle will still make
cost based choices.
* Histograms Opportunities
Any column used in a where clause with skewed data
Histograms are NOT just for indexed columns.
– Adding a histogram to an un-indexed column that is used in
Two bitmap converstion from and then bitmap conversion to.
Composite index is needed.
B should be correct.
yes, B Should be correct answer, as by creating Composite index, selectivity would be improved
Instead of B in real exam I saw text: gather multicolumn statistics
I think D because MYSALES_PRODID_IDX is a unique index and statistics says need 104 physical read.
It’s kind of erratum. If we have UNIQUE index on PROD_ID column which is used in WHERE clause we can expect INDEX UNIQUE SCAN in the query plan. It is the best plan and nothing else
composite index can destroy busines logic, so D is the right answer.