Вы находитесь на странице: 1из 3

PT:

1. SQL Tuning Advisor vs SQL Access Advisor


Access recommend for workload for below:
- Materialized view (Advise to make fast refresh also)
- Materialized view logs
- Indexes
Tuning recommends :
- Index creation will be better approach
- SQL profile
- Restructure of SQL
- Statistics collection
https://alexzeng.wordpress.com/2011/07/22/outline-sql-profile-and-sqlplan-managementspm/
2. SQL Profile vs SQL Baseline

Differences Between SQL Plan Baselines and SQL Profiles


Both SQL profiles and SQL plan baselines help improve the performance of SQL statements by
ensuring that the optimizer uses only optimal plans. Both profiles and baselines are internally
implemented using hints (see "About Optimizer Hints"). However, these mechanisms have the
following significant differences:

In general, SQL plan baselines are proactive, whereas SQL profiles are reactive.
Typically, you create SQL plan baselines before significant performance problems
occur. SQL plan baselines prevent the optimizer from using suboptimal plans in
the future.
The database creates SQL profiles when you invoke SQL Tuning Advisor, which
you do typically only after a SQL statement has shown high-load symptoms. SQL
profiles are primarily useful by providing the ongoing resolution of optimizer
mistakes that have led to suboptimal plans. Because the SQL profile mechanism
is reactive, it cannot guarantee stable performance as drastic database changes
occur.
The following graphic illustrates the difference:

Description of the illustration tgsql_vm_028.png

SQL plan baselines reproduce a specific plan, whereas SQL profiles correct
optimizer cost estimates.
A SQL plan baseline is a set of accepted plans. Each plan is implemented using a
set of outline hints that fully specify a particular plan. SQL profiles are also
implemented using hints, but these hints do not specify any specific plan. Rather,
the hints correct miscalculations in the optimizer estimates that lead to
suboptimal plans. For example, a hint may correct the cardinality estimate of a
table.
Because a profile does not constrain the optimizer to any one plan, a SQL profile
is more flexible than a SQL plan baseline. For example, changes in initialization
parameters and optimizer statistics allow the optimizer to choose a better plan.

Oracle recommends that you use SQL Tuning Advisor. In this way, you follow the recommendations
made by the advisor for SQL profiles and plan baselines rather than trying to determine which
mechanism is best for each SQL statement.
select sql_handle, plan_name, enabled, accepted, fixed from
dba_sql_plan_baselines;

SQL_HANDLE

PLAN_NAME

ENA

ACC

FIX

-----------------------------------------------------------------------SYS_SQL_209d10fabbedc741

SYS_SQL_PLAN_bbedc741a57b5fc2

YES

NO

NO

SYS_SQL_209d10fabbedc741

SYS_SQL_PLAN_bbedc741f554c408

YES

YES

NO

DBA_ADVISOR_TASKS

DBA_ADVISOR_FINDINGS

DBA_ADVISOR_RECOMMENDATIONS

DBA_SQL_PROFILES

Outline

A stored outline is a collection of hints associated with a specific SQL statement that
allows a standard execution plan to be maintained, regardless of changes in the system
environment or associated statistics. Plan stability is based on the preservation of
execution plans at a point in time where the performance of a statement is considered
acceptable. The outlines are stored in the OL$, OL$HINTS, and OL$NODES tables, but
the [USER|ALL|DBA]_OUTLINES and [USER|ALL|DBA]_OUTLINE_HINTSviews should be
used to display information about existing outlines.
-- Enable stored outlines.
ALTER SESSION SET query_rewrite_enabled=TRUE;
ALTER SESSION SET use_stored_outlines=SCOTT_OUTLINES;
Drop--BEGIN
DBMS_OUTLN.drop_by_cat (cat => 'SCOTT_OUTLINES');
END;
/

GRANT CREATE ANY OUTLINE TO SCOTT;


GRANT EXECUTE_CATALOG_ROLE TO SCOTT;
-- Switch on automatic creation of stored outlines.
ALTER SYSTEM SET create_stored_outlines=TRUE;
ALTER SESSION SET create_stored_outlines=TRUE;

-- Switch on automatic creation of stored outlines.


ALTER SYSTEM SET create_stored_outlines=FALSE;
ALTER SESSION SET create_stored_outlines=FALSE;

Вам также может понравиться