Performance Enhancements for DB2 V10

Download Report

Transcript Performance Enhancements for DB2 V10

Anthony Reina - Accelerated Value Specialist [email protected]

Performance Enhancements for DB2 V10.1

Information Management

© 2010 IBM Corporation

2 Information Management

IBM Software Accelerated Value Program

•The IBM Software Accelerated Value Program delivers a proactive, cost-reducing, and productivity enhancing advisory service. The program pairs you with an assigned team who build a foundational understanding of your overall environment. Through that understanding, the trusted partner works to facilitate faster deployment, lifecycle leadership, risk mitigation, and more by identifying ways to improve your environment, staff skill set, and processes.

http://www-01.ibm.com/software/support/acceleratedvalue/ © 2010 IBM Corporation

3 Information Management

Agenda :

RUNSTATS and database statistics improvements

Registry variables and inexact matching for Optimization profile

Statistical view

© 2010 IBM Corporation

4 Information Management

RUNSTATS

 INDEXSAMPLE : Allows statistics collectio be done in sample mode.

– SYSTEM – BERNOULLI  Detailed Index Statistics default (DETAILED) now uses sampling method starting in V10.1.

– SAMPLED DETAILED is still available for compatibility.

– UNSAMPLE option still available  VIEW command parameter can be used for better usability.

 No need to fully qualify tables by schema name  AUTO_SAMPLING now possible for all auto_stats collection on large table and statiscial views © 2010 IBM Corporation

Information Management

RUNSTATS

Implementation :

RUNSTATS Syntax 5 Database Config © 2010 IBM Corporation

6 Information Management

OPTIMIZATION PROFILE

 Selected OPT registry variables can now be set via optimization profile  DB2_ANTIJOIN           DB2_EXTENDED_OPTIMIZATION DB2_INLIST_TO_NLJN DB2_MINIMIZE_LISTPREFETCH DB2_NEW_CORR_SQ_FF DB2_OPT_MAX_TEMP_SIZE DB2_REDUCED_OPTIMIZATION DB2_RESOLVE_CALL_CONFLICT DB2_SELECTIVITY DB2_SELUDI_COM_BUFFER DB2_SORT_AFTER_TQ  Registry variables can be set at the global and/or statement level.

 If set at statement level…applied to statement defined for.

 If set at global level…applied to all statements in the opt profile.

 If set at both level…statement level takes precedence.

 If not set…db2set setting is used.

© 2010 IBM Corporation

7 Information Management

OPTIMIZATION PROFILE

Implementation :

Will affect STMTPROFIL E ID=‘S2’ Will affect STMTPROFIL E ID=‘S1’ © 2010 IBM Corporation

8 Information Management

OPTIMIZATION PROFILE

Implementation :

Explain facility will reflect which registry variables are being used for a particular statement.

It also indicates where the registry variables have been set ie. db2set level, Global Optimization Guideline Statement-level Optimization Guideline © 2010 IBM Corporation

9 Information Management

OPTIMIZATION PROFILE

 Inexact matching used for flexible matching between compiling statements and statement within optimization profile.

 Set at the STMTMATCH element of the OPTPROFILE via EXACT attribute.

 EXACT Attribute can be set TRUE or FALSE  If set TRUE then exact matching is enabled.

 If set FALSE then inexact matching is enabled.

 INEXACT matching ignores constants, literals, parameter markers, and host variables.

 Exceptions/Future Considerations : – Order of column © 2010 IBM Corporation

10 Information Management 

OPTIMIZATION PROFILE

Exceptions/Future Considerations : 1. Order of column lists, table lists and predicate list must be the same SELECT

A,B

FROM

R,T

WHERE

A>B Does not match :

SELECT

B,A

FROM

T,R

WHERE

B

2. Symmetric operands must remain in the same order A = B does not match B = A A + B = 5 does not match B + A = 5 3. Parenthesis and other punctuation can prevent a match 4. No wildcard support © 2010 IBM Corporation

11 Information Management

OPTIMIZATION PROFILE

Implementation :

Will affect STMTPROFIL E ID=‘S2’ Will ONLY affect STMTPROFILE ID=‘S1’ INEXACT Matching is considered (ie. ?) © 2010 IBM Corporation

12 Information Management

OPTIMIZATION PROFILE

Implementation :

INEXACT for predicate clause INEXACT for different clauses INEXACT for IN list predicate clause INEXACT in the select list © 2010 IBM Corporation

13 Information Management 

STATVIEW

Predicates containing complex expressions  Column Group Statistics gathered on statistical views  Automatic statistics collection for statistical views © 2010 IBM Corporation

14 Information Management 

STATVIEW

Reducing the number of statistical views Given the DDL for the following tables Referential Integrity Definition © 2010 IBM Corporation

Information Management 

STATVIEW

Reducing the number of statistical views Statistics needed for the given query Create the following views to create accurate statistics 15 Reduce the number of statistical views since RI exist between join columns © 2010 IBM Corporation

16 Information Management    

Other Performance Enhancements

Automatic enhanced query performance for common SQL statements – Efficient hashing function to partially remove duplicates early in the SQL processing.

– – Hash join is select for a wider range of SQL queries.

Improved cost estimates of network communication traffic Intrapartition parallelism improvements for optimizer to enable more workloads to better use multi-core processors.

ADMIN_SET_INTRA_PARALLEL () procedure – Enables or disables intrapartition parallelism for a database appl.

– – – Takes effect starting with the next transaction.

Values = YES/yes, NO/no, or NULL NULL value depends on INTRA_PARALLEL dbm cfg FP2: More efficient writing to recovery history file might result in general speed performance improvement.

© 2010 IBM Corporation

17 Information Management 

Other Performance Enhancements

Enhance memory sharing on large POWER7 systems by running AIX – Potentially enhance query performance by effectively sharing memory.

– – DB2_RESOURCE_POLICY must be set to AUTOMATIC for DB2 to auto detect hardward topology.

DB2 assigns EDU’s to various hardware modules so that memory can be more efficiently shared.

– – Used only for POWER7 systems with 16 or more cores.

Recommend to run performance planning/analysis to validate performance gain.

© 2010 IBM Corporation

18 Information Management

REFERENCE

 DB2 v10.1 Query Performance Enhancement (developerworks)  Statement key and compilation key matching © 2010 IBM Corporation

19 Information Management

Questions?

© 2010 IBM Corporation