Download Creating User-Defined Routines and User-Defined Data

Transcript
Chapter
Improving UDR Performance
In This Chapter .
.
.
.
.
.
.
.
.
.
.
13-3
Optimizing a User-Defined Routine . . . . . . . . . . . . .
Optimizing an SPL Routine . . . . . . . . . . . . . .
Optimization Levels . . . . . . . . . . . . . . . .
Automatic Optimization . . . . . . . . . . . . . .
Updating Statistics for an SPL Routine . . . . . . . . . . .
13-3
13-4
13-4
13-5
13-6
Optimizing Functions in SQL Statements .
Calculating the Query Plan. . . . .
Specifying Cost and Selectivity . . .
Constant Cost and Selectivity Values
Dynamic Cost and Selectivity Values
Calculating Cost . . . . . . . .
Selectivity and Cost Examples . . .
.
.
.
.
.
.
.
.
.
13
. . . . . . . . . . 13-7
. . . . . . . . . . 13-8
. . . . . . . . . . 13-8
. . . . . . . . . . 13-9
. . . . . . . . . . 13-9
. . . . . . . . . . 13-10
. . . . . . . . . . 13-11
Extending UPDATE STATISTICS . . . . . . .
Using UPDATE STATISTICS . . . . . . .
Support Functions for UPDATE STATISTICS .
The stat Data Type . . . . . . . . .
The statcollect() Function . . . . . . .
The statprint() Function . . . . . . .
Example of User-Defined Statistics Functions
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Using Negator Functions .
.
.
.
.
.
.
. 13-15
.
.
.
.
.
.
.
.
.
13-12
13-12
13-13
13-13
13-13
13-14
13-15