IBM Presentations: Blue Pearl Basic template

Click here to load reader

  • date post

    20-Jan-2015
  • Category

    Documents

  • view

    725
  • download

    4

Embed Size (px)

description

 

Transcript of IBM Presentations: Blue Pearl Basic template

  • 1. DB2 for z/OS Whats new in DB2 9 for z/OS for ApplicationsPatrick [email protected] Senior software engineerIBM Silicon Valley Lab 9/8/2009 2009 IBM Corporation

2. DB2 for z/OSDisclaimer Copyright IBM Corporation [current year]. All rights reserved. U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.THE INFORMATION CONTAINED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY. WHILE EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION CONTAINED IN THIS PRESENTATION, IT IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. IN ADDITION, THIS INFORMATION IS BASED ON IBMS CURRENT PRODUCT PLANS AND STRATEGY, WHICH ARE SUBJECT TO CHANGE BY IBM WITHOUT NOTICE. IBM SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT OF THE USE OF, OR OTHERWISE RELATED TO, THIS PRESENTATION OR ANY OTHER DOCUMENTATION. NOTHING CONTAINED IN THIS PRESENTATION IS INTENDED TO, NOR SHALL HAVE THE EFFECT OF, CREATING ANY WARRANTIES OR REPRESENTATIONS FROM IBM (OR ITS SUPPLIERS OR LICENSORS), OR ALTERING THE TERMS AND CONDITIONS OF ANY AGREEMENT OR LICENSE GOVERNING THE USE OF IBM PRODUCTS AND/OR SOFTWARE.IBM, the IBM logo, ibm.com, DB2, and z/OS are trademarks or registered trademarks of International Business Machines Corporation in the United States, other countries, or both. If these and other IBM trademarked terms are marked on their first occurrence in this information with a trademark symbol ( or ), these symbols indicate U.S. registered or common law trademarks owned by IBM at the time this information was published. Such trademarks may also be registered or common law trademarks in other countries. A current list of IBM trademarks is available on the Web at Copyright and trademark information at www.ibm.com/legal/copytrade.shtml 29/8/2009 2009 IBM Corporation 3. DB2 for z/OS AgendaPlan Stability REOPT AUTO Histogram Statistics Global Query Optimization Generalized sparse index and in-memory data cache Dynamic Index ANDing Indexing Enhancements Optimization Service Center Misc Optimization Enhancements 39/8/2009 2009 IBM Corporation 4. DB2 for z/OS Access Path Stability 4 9/8/2009 2009 IBM Corporation 5. DB2 for z/OS Plan Stability Overview Ability to backup your static SQL packages At REBINDSave old copies of packages in Catalog/DirectorySwitch back to previous or original version Two flavorsBASIC 2 copies: Current and PreviousEXTENDED 3 copies: Current, Previous, OriginalDefault controlled by a ZPARMAlso supported as REBIND options5 9/8/2009 2009 IBM Corporation 6. DB2 for z/OS Plan Stability - BASIC support REBIND PLANMGMT(BASIC) REBIND SWITCH(PREVIOUS)Incoming copycurrent copy Current copymove move move previous copy previous copy deleteChart is to be read from bottom to top 6 9/8/2009 2009 IBM Corporation 7. DB2 for z/OS Plan Stability - EXTENDED support REBIND PLANMGMT(EXTENDED)REBIND SWITCH(ORIGINAL) Incoming copyoriginal copyclone current copycurrent copy moveclonemove previous copyoriginal copyprevious copydeletedelete 79/8/2009 2009 IBM Corporation 8. DB2 for z/OS Access Plan Stability Notes REBIND PACKAGE FREE PACKAGE PLANMGMT (BASIC)PLANMGMTSCOPE(ALL) Free2 copies: Current and Previouspackage completely PLANMGMT (EXTENDED) PLANMGMTSCOPE(INACTIVE) Freeold copies3 copies: Current, Previous, Original Catalog support REBIND PACKAGE SYSPACKAGE reflects active copySWITCH(PREVIOUS) SYSPACKDEP reflects dependencies ofSwitch between current & previous all copiesSWITCH(ORIGINAL)Other catalogs (SYSPKSYSTEM, )Switch between current & original reflect metadata for all copies Most bind options can be changed atInvalidation and Auto Bind REBINDEach copy invalidated separatelyBut a few must be the same 8 9/8/2009 2009 IBM Corporation 9. DB2 for z/OS REOPT Auto Based On Parameter Marker Change 99/8/2009 2009 IBM Corporation 10. DB2 for z/OS REOPT enhancement for dynamic SQL V8 REOPT options Dynamic SQL REOPT(NONE, ONCE, ALWAYS) Static SQL REOPT(NONE, ALWAYS)V9 Addition for Dynamic SQL Bind option REOPT(AUTO)10 9/8/2009 2009 IBM Corporation 11. DB2 for z/OS Dynamic SQL REOPT - AUTO For dynamic SQL with parameter markers DB2 will automatically reoptimize the SQL when Filtering of one or more of the predicates changes dramatically Such that table join sequence or index selection may change Some statistics cached to improve performance of runtime check Newly generated access path will replace the global statementcache copy.First optimization is the same as REOPT(ONCE) Followed by analysis of the values supplied at each execution ofthe statement 119/8/2009 2009 IBM Corporation 12. DB2 for z/OSHistogram statistics 129/8/2009 2009 IBM Corporation 13. DB2 for z/OS RUNSTATS Histogram StatisticsRUNSTATS will produce equal-depth histogram Each quantile (range) will have approx same number of rows Not same number of values Another term is range frequencyExample1, 3, 3, 4, 4, 6, 7, 8, 9, 10, 12, 15 (sequenced) Lets cut that into 3 quantiles.1, 3, 3, 4 ,4 6,7,8,9 10,12,15 Seq No Low Value High Value CardinalityFrequency 1143 5/12 2694 4/12 3 10 153 3/12139/8/2009 2009 IBM Corporation 14. DB2 for z/OS RUNSTATS Histogram Statistics NotesRUNSTATS Maximum 100 quantiles for a column Same value columns WILL be in the same quantile Quantiles will be similar size but:Will try to avoid big gaps inside quantilesHighvalue and lowvalue may have separate quantilesNull WILL have a separate quantileSupports column groups as well as single columnsThink frequencies for high cardinality columns14 9/8/2009 2009 IBM Corporation 15. DB2 for z/OS Histogram Statistics ExampleSAP uses INTEGER (or VARCHAR) for YEAR-MONTHWHERE YEARMONTH BETWEEN 200601 AND 200612 Assuming data for 2006 & 2007FF = (high-value low-value) / (high2key low2key)FF = (200612 200601) / (200711 200602) 10% of rows estimated to return Data Distribution - Even Distribution450000 400000350000 300000 Data assumed as evenly 250000Year/Month 200000distributed between low150000 and high range 10000050000 0200601 200712159/8/2009 2009 IBM Corporation 16. DB2 for z/OS Histogram Statistics ExampleExample (cont.) Data only exists in ranges 200601-12 & 200701-12 Collect via histograms 45% of rows estimated to return Data Distribution - Histograms140000012000001000000 800000 Year/Month600000 400000 2000000 2006 01-12 200613 ----->----->200700 2007 01-12No data betweenWHERE YEARMONTH BETWEEN 200601 AND 200612 200613 & 200700169/8/2009 2009 IBM Corporation 17. DB2 for z/OSGlobal Query Optimization 179/8/2009 2009 IBM Corporation 18. DB2 for z/OS Problem Scenario 1V8, Large Non-correlated subquery is materialized* SELECT * FROM SMALL_TABLE A WHERE A.C1 IN(SELECT B.C1 FROM BIG_TABLE B)* Assumes subquery is BIG_TABLE is scanned and put into workfilenot transformed to join SMALL_TABLE is joined with the workfile V9 may rewrite non-correlated subquery to correlated Much more efficient if scan / materialisation of BIG_TABLE was avoided Allows matching index access on BIG_TABLE SELECT * FROM SMALL_TABLE A WHERE EXISTS(SELECT 1 FROM BIG_TABLE B WHERE B.C1 = A.C1)18 9/8/2009 2009 IBM Corporation 19. DB2 for z/OS Problem Scenario 2V8, Large outer table scanned rather than using matching indexaccess* SELECT * FROM BIG_TABLE A WHERE EXISTS (SELECT 1 FROM SMALL_TABLE B WHERE A.C1 = B.C1)* Assumes subquery is BIG_TABLE is scanned to obtain A.C1 valuenot transformed to join SMALL_TABLE gets matching index accessV9 may rewrite correlated subquery to non-correlated SELECT * FROM BIG_TABLE A WHERE A.C1 IN (SELECT B.C1 FROM SMALL_TABLE B) SMALL_TABLE scanned and put in workfile Allows more efficient matching index access on BIG_TABLE19 9/8/2009 2009 IBM Corporation 20. DB2 for z/OS Virtual TablesA new way to internally represent subqueries Represented as a Virtual table Allows subquery to be considered in different join sequences May or may not represent a workfile Apply only to subqueries that cannot be transformed to joinsCorrelated or non-correlated?......I shouldnt have to care! 209/8/2009 2009 IBM Corporation 21. DB2 for z/OS EXPLAIN OutputAdditional row for materialized Virtual Table Table type is "W" for "Workfile". Name includes an indicator of the subquery QB number ExampleDSNWF(02) Non-materialized Virtual tables will not be shown in EXPLAINoutput.Additional column PARENT_PLANNO Used with PARENT_QBLOCKNO to connect child QB toparent V8 only contains PARENT_QBNO Not possible to distinguish which plan step the child tasks belong to. 219/8/2009 2009 IBM Corporation 22. DB2 for z/OSGeneralizing Sparse Indexand In-Memory Data Cache 229/8/2009 2009 IBM Corporation 23. DB2 for z/OSPre-V9 Sparse Index & in-memory data cache V4 introduced sparse index for non-correlated subquery workfilesV7 extended sparse index for the materialized work files within star joinV8 replaced sparse index with in-memory data caching for star join Runtime fallback to sparse index when memory is insufficient 239/8/2009 2009 IBM Corporation 24. DB2 for z/OS How does Sparse Index work?Sparse index may be a subset of workfile (WF) Example, WF may have 10,000 entries Sparse index may have enough space (240K) for 1,000 entries Sparse index is binary searched to find target location of search key At most 10 WF entries are scannedNLJT1T2 (WF)Workfile sorted t1.c = t2.c in t2.c orderBinary Search of sparse index Key RIDto look up approximate location of qualified keyT2... ... (WF) Sparse Index sorted in t2.c order 249/8/2009 2009 IBM Corporation 25. DB2 for z/OSData Caching vs Sparse IndexData Caching Also known as In-Memory WF Is a runtime enhancement to sparse indexSparse Index/In-Memory WF Extended to non-star join in DB2 9New ZPARM MXDTCACH Maximum extent in MB, for data caching per thread If memory is insufficient Fall-back to sparse index at runtime25 9/8/2009 2