This blog covers different aspects around software development and test. There are also general information useful for who needs to test performances and needs to analyze bottlenecks on application servers and databases. Disclaimer: test before you implement any advice, no warranty is provided. Before use the software mentioned in this blog read and understand all licenses agreements. Use of the information contained in this blog is under your own responsibility.
lunedì 24 febbraio 2014
Compare performances of a query on differents db2 environments
If you have a product running on two different environments (i.e. sandbox and pre-production) using db2 as database, and you have different performance in terms of response times and you have the suspect that is related to some query, then my suggestion is first to identify what are the slowest queries analyzing the db2 snapshots (or using the monitor table functions) checking the worst cpu consumption and execution time, then run the db2 explain command on both enviroments and analyze the access plan of the queries.
For example write one of the slowest queries in a file and at the end of the file insert a terminator: @
Access to the db2 instance and run:
db2expln -g -database DBNAME -stmtfile /tmp/query.sql -terminator @ -terminal -o /tmp/output_explain.txt
The output file contains Estimated Cost and Estimated Cardinality and the Optimizer Plan.
You can compare these values and the differences of the access plan. In case of access plan differences you can identify what are the most expensive operations. Then for example you can check if there are some indexes or views that are missing in one of the environments but already defined in the other one or simply check if you have forgotten to run the maintenance commands: reorg, runstats, rebind.
Etichette:
db2,
db2expl,
performances
Iscriviti a:
Commenti sul post (Atom)
Nessun commento:
Posta un commento