Escolar Documentos
Profissional Documentos
Cultura Documentos
Asseco at a Glance
Founded in 1991
Presentation Objective
Question:
How to maintain everyday database statistics process
in a complex environment?
Complex Environment
Maintenance
DB2 environment
> 60 TB of production
data (6 DB2 members
in Data Sharing)
DML 48K/s,
GETPAGES 392K/s, IO
RW 13K/s
IO R 12K/s
> 475 GB data growth
per month
Weekly cost
of maintenance for
RUNSTATS - 240 MIPS
3 807 colgroups
definitions
2 344 columns to verify
> 500 active plans and
over 12 000 active
packages to BIND
wasny.
Automation
Presentation Plan
Conclusions
Introduction
to Database statistics
RUNSTATS Utility
Functionalities
1/2
RUNSTATS
TABLESPACE
RUNSTATS
INDEX
* RUNSTATS does not collect statistics for clone tables, CGTT or index spaces.
** Leading columns are collected by using RUNSTATS INDEX.
RUNSTATS Utility
2/2
01
Frequency
02
Cardinality
03
Histograms
virtual indexes,
what if;
DSNACCOX
Procedure
1/2
DSNACCOX
Procedure
2/2
Types of RUNSTATS:
COMPLETE RUNSTATS - for the query or workload.
REPAIR RUNSTATS - repairs the immediate
statistics problems.
Maintenance Process
IBM TWS
ADT
BKP
REO
RTS
RUNSTATS
every 3 months.
CREATE TABLE
PG.MAINTENANCE_CONTROL_TABLE (
ST_OBJECT
ST_DATABASE
ST_PARTITION
COPY part
ST_OBJECT_TYPE
ST_PRIORITY
ST_PLANNING_DATE
ST_UPDATEPRIO_DATE
ST_JOBID
ST_SAMPLE
ST_SQLID
ST_RULE_NAME
ST_NACTIVE
ST_ONDEMAND
RUNSTATS part
AD_IF_COPY_FULL
AD_IF_COPY_INC
Example of RUNSTATS
Implementation IBM TWS
Challenges
in maintaining database statistics
Challenge #2
Home-made Procedure for Updating
Statistics
Home-made procedure for updating statistics ad hoc
Requirements for the procedure:
security of transactions procedure saves previous values,
easy to use,
sysibm.SYSCOLUMNS.COLCARDF
sysibm.SYSINDEXES.CLUSTERRATIOF
sysibm.SYSINDEXES.NLEVELS
sysibm.SYSINDEXES.NLEAF
sysibm.SYSINDEXES.FIRSTKEYCARDF
sysibm.SYSINDEXES.FULLKEYCARDF
sysibm.SYSINDEXES.DATAREPEATFACTORF
sysibm.SYSCOLDIST (INSERT, UPDATE, DELETE)
Challenge #5
Running RUNSTATS in the Right Time
Challenge #6
Building Access Paths by Using CGTT
Update CGTT statistics in order to put this table as first
in the access path.
CGTT
SELECT
JOIN
SMALL
TABLE
BIG TABLE
Conclusions
To Sum up
Inline statistics cost less.
Automation and database statistics rules help you keep
statistics process under control.
Coping statistics cost less than running RUNSTATS.
Remember about correlation between statistics.
DB2 v11 can find inconsistencies in statistics.
Remember about TESTS!
Dzikuj!
Jacek Rafalak
jacek.rafalak@asseco.pl
Asseco Poland S.A.