https://xcoolwinds.wordpress.com/2013/08/23/adjusting-the-optimizer-index-cost-adj-parameter/
Issue the following query to view the average wait times for both of the wait events:
SQL> select event, average_wait from v$system_event
where event like 'db file s%read';
EVENT AVERAGE_WAIT
--------------------------------- -------------------------------
db file sequential read .91
db file scattered read 1.41
SQL>
Based on the output of this query, single block sequential reads take roughly 75% of the time it takes to perform a multiblock (scattered) read. This indicates that the optimizer_index_cost_adj
parameter should be set to somewhere around 75. However, as mentioned earlier, setting the parameter at the database level isn’t recommended—instead, use this parameter sparingly for specific statements where you want to force the use of an index. Note that setting the parameter at the session level requires the DBA to grant the user privileges to issue the alter session
command (or you must do it through some other procedural mechanism). A good alternative to having to issue the alter session
statement is to specify the OPT_PARAM
hint to change the parameter for a specific query, such as /*+ opt_param('optimizer_index_cost_adj',50) */
.
Laisser un commentaire