Skip to content

Commit 3690826

Browse files
committed
readme
1 parent b50402d commit 3690826

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

optimizer/spm_in_practice/README.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,26 @@ Example output is shown in example.lst.
88

99
**See also the README in the util directory.**
1010

11-
<h3>example.lst</h3>
12-
* Flush shared pool
13-
* Create a user called SPMTEST
14-
* Call dropu.sql to drop SQL plan baselines for user SPMTEST
15-
* Create a table called TAB1
16-
* Create index on table and gather stats
17-
* Run a test query on TAB1 and capture the plan as a SQL plan baseline (from the cursor cache)
18-
* Display SQL plan baselines for SPMTEST using listu.sql
19-
* Display the SQL execution plan for the SQL plan baseline - it uses an index
20-
* Execute the test query again and notice that the SQL plan baseline is being used and the plan uses the index
21-
* Run nomatchu.sql and it identifies no "non-matching" SQL plan baselines for SPMTEST - all is well
22-
* Drop the index! This makes it impossible to use the SQL plan baseline because the plan relies on the index!
23-
* Run the test query again and notice that the plan is now a FULL table scan and the SQL plan baseline is NOT being honored (the SQL plan baseline is not shown in the plan "Notes" section).
24-
* We can take a look of the OUTLINES in the SQL plan baseline and you will see it attempts: //INDEX(@"SEL$1" "TAB1"@"SEL$1" ("TAB1"."ID"))// - but the index is gone.
25-
* Run nomatchu.sql and notice that it identifies the query that has an enabled and accepted plan but the SQL plan baseline is NOT being honored (SQL_PLAN_BASELINE is NULL)
26-
* Look at the SQL plan baselines (using listu.sql) and see that there is a new non-accepted plan in the SQL plan history
27-
* Run evou.sql to evolve the new plan (it's the FULl table scan plan)
28-
* Run the test query again and this time a SQL plan baseline is used (look at "Notes" section)
29-
* The script nomatchu.sql no longer identifies a SQL plan baseline not being honored.
11+
*example.lst*
12+
13+
* Flush shared pool
14+
* Create a user called SPMTEST
15+
* Call dropu.sql to drop SQL plan baselines for user SPMTEST
16+
* Create a table called TAB1
17+
* Create index on table and gather stats
18+
* Run a test query on TAB1 and capture the plan as a SQL plan baseline (from the cursor cache)
19+
* Display SQL plan baselines for SPMTEST using listu.sql
20+
* Display the SQL execution plan for the SQL plan baseline - it uses an index
21+
* Execute the test query again and notice that the SQL plan baseline is being used and the plan uses the index
22+
* Run nomatchu.sql and it identifies no "non-matching" SQL plan baselines for SPMTEST - all is well
23+
* Drop the index! This makes it impossible to use the SQL plan baseline because the plan relies on the index!
24+
* Run the test query again and notice that the plan is now a FULL table scan and the SQL plan baseline is NOT being honored (the SQL plan baseline is not shown in the plan "Notes" section).
25+
* We can take a look of the OUTLINES in the SQL plan baseline and you will see it attempts: //INDEX(@"SEL$1" "TAB1"@"SEL$1" ("TAB1"."ID"))// - but the index is gone.
26+
* Run nomatchu.sql and notice that it identifies the query that has an enabled and accepted plan but the SQL plan baseline is NOT being honored (SQL_PLAN_BASELINE is NULL)
27+
* Look at the SQL plan baselines (using listu.sql) and see that there is a new non-accepted plan in the SQL plan history
28+
* Run evou.sql to evolve the new plan (it's the FULl table scan plan)
29+
* Run the test query again and this time a SQL plan baseline is used (look at "Notes" section)
30+
* The script nomatchu.sql no longer identifies a SQL plan baseline not being honored.
3031

3132
For background, check out https://blogs.oracle.com/optimizer/entry/how_to_use_sql_plan
3233

0 commit comments

Comments
 (0)