© 2010 ibm corporation information management performance enhancements for db2 v10.1 anthony reina...

19
© 2010 IBM Corporation Information Management Performance Enhancements for DB2 V10.1 Anthony Reina - Accelerated Value Specialist [email protected]

Upload: lorena-copeland

Post on 26-Dec-2015

220 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: © 2010 IBM Corporation Information Management Performance Enhancements for DB2 V10.1 Anthony Reina - Accelerated Value Specialist aereina@ca.ibm.com

© 2010 IBM Corporation

Information Management

Performance Enhancements for DB2 V10.1

Anthony Reina - Accelerated Value Specialist

[email protected]

Page 2: © 2010 IBM Corporation Information Management Performance Enhancements for DB2 V10.1 Anthony Reina - Accelerated Value Specialist aereina@ca.ibm.com

© 2010 IBM Corporation

Information Management

2

•The IBM Software Accelerated Value Programdelivers a proactive, cost-reducing, andproductivity enhancing advisory service. Theprogram pairs you with an assigned team whobuild a foundational understanding of youroverall environment. Through that understanding,the trusted partner works to facilitate fasterdeployment, lifecycle leadership, riskmitigation, and more by identifying ways toimprove your environment, staff skill set, andprocesses.

http://www-01.ibm.com/software/support/acceleratedvalue/

IBM Software Accelerated Value Program

Page 3: © 2010 IBM Corporation Information Management Performance Enhancements for DB2 V10.1 Anthony Reina - Accelerated Value Specialist aereina@ca.ibm.com

© 2010 IBM Corporation

Information Management

3

Agenda :

• RUNSTATS and database statistics improvements

• Registry variables and inexact matching for Optimization profile

• Statistical view

Page 4: © 2010 IBM Corporation Information Management Performance Enhancements for DB2 V10.1 Anthony Reina - Accelerated Value Specialist aereina@ca.ibm.com

© 2010 IBM Corporation

Information Management

4

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

Page 5: © 2010 IBM Corporation Information Management Performance Enhancements for DB2 V10.1 Anthony Reina - Accelerated Value Specialist aereina@ca.ibm.com

© 2010 IBM Corporation

Information Management

5

RUNSTATS Implementation :

RUNSTATS Syntax

Database Config

Page 6: © 2010 IBM Corporation Information Management Performance Enhancements for DB2 V10.1 Anthony Reina - Accelerated Value Specialist aereina@ca.ibm.com

© 2010 IBM Corporation

Information Management

6

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.

Page 7: © 2010 IBM Corporation Information Management Performance Enhancements for DB2 V10.1 Anthony Reina - Accelerated Value Specialist aereina@ca.ibm.com

© 2010 IBM Corporation

Information Management

7

OPTIMIZATION PROFILEImplementation :

Will affect STMTPROFIL

E ID=‘S2’

Will affect STMTPROFIL

E ID=‘S1’

Page 8: © 2010 IBM Corporation Information Management Performance Enhancements for DB2 V10.1 Anthony Reina - Accelerated Value Specialist aereina@ca.ibm.com

© 2010 IBM Corporation

Information Management

8

OPTIMIZATION PROFILEImplementation : 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

Page 9: © 2010 IBM Corporation Information Management Performance Enhancements for DB2 V10.1 Anthony Reina - Accelerated Value Specialist aereina@ca.ibm.com

© 2010 IBM Corporation

Information Management

9

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

Page 10: © 2010 IBM Corporation Information Management Performance Enhancements for DB2 V10.1 Anthony Reina - Accelerated Value Specialist aereina@ca.ibm.com

© 2010 IBM Corporation

Information Management

10

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<A

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

Page 11: © 2010 IBM Corporation Information Management Performance Enhancements for DB2 V10.1 Anthony Reina - Accelerated Value Specialist aereina@ca.ibm.com

© 2010 IBM Corporation

Information Management

11

OPTIMIZATION PROFILEImplementation :

Will affect STMTPROFIL

E ID=‘S2’

Will ONLY affect

STMTPROFILE ID=‘S1’

INEXACT Matching is considered (ie. ?)

Page 12: © 2010 IBM Corporation Information Management Performance Enhancements for DB2 V10.1 Anthony Reina - Accelerated Value Specialist aereina@ca.ibm.com

© 2010 IBM Corporation

Information Management

12

OPTIMIZATION PROFILEImplementation :

INEXACT for predicate clause

INEXACT for IN list predicate clause

INEXACT in the select list

INEXACT for different clauses

Page 13: © 2010 IBM Corporation Information Management Performance Enhancements for DB2 V10.1 Anthony Reina - Accelerated Value Specialist aereina@ca.ibm.com

© 2010 IBM Corporation

Information Management

13

STATVIEW Predicates containing complex expressions

Column Group Statistics gathered on statistical views

Automatic statistics collection for statistical views

Page 14: © 2010 IBM Corporation Information Management Performance Enhancements for DB2 V10.1 Anthony Reina - Accelerated Value Specialist aereina@ca.ibm.com

© 2010 IBM Corporation

Information Management

14

STATVIEW Reducing the number of statistical views

Given the DDL for the following tables

Referential Integrity Definition

Page 15: © 2010 IBM Corporation Information Management Performance Enhancements for DB2 V10.1 Anthony Reina - Accelerated Value Specialist aereina@ca.ibm.com

© 2010 IBM Corporation

Information Management

15

STATVIEW Reducing the number of statistical views

Statistics needed for the given query

Create the following views to create accurate statistics

Reduce the number of statistical views since RI exist between join columns

Page 16: © 2010 IBM Corporation Information Management Performance Enhancements for DB2 V10.1 Anthony Reina - Accelerated Value Specialist aereina@ca.ibm.com

© 2010 IBM Corporation

Information Management

16

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 (<state>) 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.

Page 17: © 2010 IBM Corporation Information Management Performance Enhancements for DB2 V10.1 Anthony Reina - Accelerated Value Specialist aereina@ca.ibm.com

© 2010 IBM Corporation

Information Management

17

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.

Page 18: © 2010 IBM Corporation Information Management Performance Enhancements for DB2 V10.1 Anthony Reina - Accelerated Value Specialist aereina@ca.ibm.com

© 2010 IBM Corporation

Information Management

18

REFERENCE

DB2 v10.1 Query Performance Enhancement (developerworks)

Statement key and compilation key matching

Page 19: © 2010 IBM Corporation Information Management Performance Enhancements for DB2 V10.1 Anthony Reina - Accelerated Value Specialist aereina@ca.ibm.com

© 2010 IBM Corporation

Information Management

19

Questions?