| A | B | C | D | |
|---|---|---|---|---|
1 | Command | |||
2 | 1 | EXEC dbms_stats.SET_GLOBAL_PREFS('AUTOSTATS_TARGET', 'AUTO'); | ||
3 | 2 | EXEC dbms_stats.SET_DATABASE_PREFS('STALE_PERCENT', '15'); | ||
4 | 3 | EXEC dbms_stats.GATHER_DATABASE_STATS(degree => 4, cascade => TRUE); | ||
5 | 4 | EXEC dbms_stats.GATHER_SCHEMA_STATS(ownname => 'SCOTT', degree => 4, cascade => TRUE); | ||
6 | 5 | EXEC dbms_stats.GATHER_TABLE_STATS(ownname => 'SCOTT', tabname => 'EMP', degree => 4, cascade => TRUE); | ||
7 | ||||
8 | ||||
9 | AOSC | MoidIITDocID-875: My notes on "Automatic Optimizer Statistics Collection" (AOSC - DBMS_STATS) https://www.mydbanotes.com/2013/01/my-notes-on-11g-automatic-statistics.html | ||
10 | ||||
11 | ||||
12 | ||||
13 | ||||
14 | Preference | Description | Default (11gR2) | Scope |
15 | CASCADE | Determines if index stats should be gathered for the current table (TRUE, FALSE, AUTO_CASCADE). | DBMS_STATS.AUTO_CASCADE | G, D, S, T |
16 | DEGREE | Degree of parallelism (integer or DEFAULT_DEGREE). | DBMS_STATS.DEFAULT_DEGREE | G, D, S, T |
17 | ESTIMATE_PERCENT | Percentage of rows to sample when gathering stats (0.000001-100 or AUTO_SAMPLE_SIZE). | DBMS_STATS.AUTO_SAMPLE_SIZE | G, D, S, T |
18 | METHOD_OPT | Controls column statistics collection and histogram creation. | FOR ALL COLUMNS SIZE AUTO | G, D, S, T |
19 | NO_INVALIDATE | Determines if dependent cursors should be invalidated as a result of new stats on objects (TRUE, FALSE or AUTO_INVALIDATE). | DBMS_STATS.AUTO_INVALIDATE | G, D, S, T |
20 | AUTOSTATS_TARGET | Determines which objects have stats gathered (ALL, ORACLE, AUTO). | AUTO | G |
21 | GRANULARITY | The granularity of stats to be collected on partitioned objects (ALL, AUTO, DEFAULT, GLOBAL, 'GLOBAL AND PARTITION', PARTITION, SUBPARTITION). | AUTO | G, D, S, T |
22 | PUBLISH | Determines if gathered stats should be published immediately or left in a pending state (TRUE, FALSE). | TRUE | G, D, S, T |
23 | INCREMENTAL | Determines whether incremental stats will be used for global statistics on partitioned objects, rather than generated using table scans (TRUE, FALSE). | FALSE | G, D, S, T |
24 | CONCURRENT | Should objects statistics be gathered on multiple objects at once, or one at a time (MANUAL, AUTOMATIC, ALL, OFF). | OFF | G |
25 | GLOBAL_TEMP_TABLE_STATS | Should stats on global temporary tables be session-specific or shared between sessions (SHARED, SESSION). | SESSION | G, D, S |
26 | INCREMENTAL_LEVEL | Which level of synopses should be collected for incremental partitioned statistics (TABLE, PARTITION). | PARTITION | G, D, S, T |
27 | INCREMENTAL_STALENESS | How is staleness of partition statistics determined (USE_STALE_PERCENT, USE_LOCKED_STATS, NULL). | NULL | G, D, S, T |
28 | TABLE_CACHED_BLOCKS | The number of blocks cached in the buffer cache during calculation of index cluster factor. Jonathan Lewis recommends "16" as a sensible value. | 1 | G, D, S, T |
29 | OPTIONS | Used for the OPTIONS parameter of the GATHER_TABLE_STATS procedure (GATHER, GATHER AUTO). | GATHER | G, D, S, T |
30 | Source: https://oracle-base.com/articles/misc/cost-based-optimizer-and-database-statistics | |||
31 | ||||
32 | MoidIITDocID-875: My notes on "Automatic Optimizer Statistics Collection" (AOSC - DBMS_STATS) https://www.mydbanotes.com/2013/01/my-notes-on-11g-automatic-statistics.html | |||
33 | ||||
34 | ||||
35 | ||||
36 | ||||
37 | ||||
38 | ||||
39 | ||||
40 | ||||
41 | ||||
42 | ||||
43 | ||||
44 | ||||
45 | ||||
46 | ||||
47 | ||||
48 | ||||
49 | ||||
50 | ||||
51 | ||||
52 | ||||
53 | ||||
54 | ||||
55 | ||||
56 | ||||
57 | ||||
58 | ||||
59 | ||||
60 | ||||
61 | ||||
62 | ||||
63 | ||||
64 | ||||
65 | ||||
66 | ||||
67 | ||||
68 | ||||
69 | ||||
70 | ||||
71 | ||||
72 | ||||
73 | ||||
74 | ||||
75 | ||||
76 | ||||
77 | ||||
78 | ||||
79 | ||||
80 | ||||
81 | ||||
82 | ||||
83 | ||||
84 | ||||
85 | ||||
86 | ||||
87 | ||||
88 | ||||
89 | ||||
90 | ||||
91 | ||||
92 | ||||
93 | ||||
94 | ||||
95 | ||||
96 | ||||
97 | ||||
98 | ||||
99 | ||||
100 |