File tree 1 file changed +31
-0
lines changed
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ -- Basic command
2
+ BEGIN
3
+ DBMS_STATS .GATHER_TABLE_STATS (
4
+ OWNNAME => :schema,
5
+ TABNAME => :table,
6
+ DEGREE => DBMS_STATS .AUTO_DEGREE , -- degree of parallelism
7
+ CASCADE => TRUE, -- indexes too
8
+ ESTIMATE_PERCENT => 10 , -- sample percentage
9
+ NO_INVALIDATE => FALSE, -- invalidate cursors immediately
10
+ METHOD_OPT => ' FOR ALL COLUMNS SIZE 1' ); -- no histograms
11
+ END;
12
+
13
+ -- How to construct method_opt?
14
+
15
+ -- All including hidden
16
+ ' FOR ALL COLUMNS'
17
+
18
+ -- Specified columns
19
+ ' FOR COLUMNS COL1, COL2, ...'
20
+
21
+ -- No histogram
22
+ ' SIZE 1'
23
+
24
+ -- A histogram with 10 buckets
25
+ ' SIZE 10'
26
+
27
+ -- Can use several combined
28
+ ' FOR COLUMNS COL1 SIZE 1 FOR COLUMNS COL2 SIZE 10'
29
+
30
+ -- Clear stats for table
31
+ exec DBMS_STATS .DELETE_TABLE_STATS (ownname => :schema, tabname => :table);
You can’t perform that action at this time.
0 commit comments