dimanche 3 mai 2015

SQL Tuning : Histograms

Skew only is time consuming
only useful for column used in where clause
Histograms are used only in 2 cases :
- Tables join order
- Table access : TFS vs Index Scan

3 options
method_opt=> 'for all columns size skewonly'
method_opt=> 'for all columns  size repeat'
method_opt=> 'for all columns size auto'


1) for all columns size skew only
2) Monitor ( alter table toto monitor) : no default?
3) for all columns size auto
4)for all columns  size repeat
5) periodically skew only & auto, when there is a new column added


A low cardinality < 254 disincts values will create a frequency histo
A high caridinality >254 distints values will create a heigh-balanced hits

Use histogram for foreign key columns; lack of histogram can lead to bad order in join, set histogram instead of using ORDER hint




Aucun commentaire:

Enregistrer un commentaire