PBR RPN - Removing Partitioning restrictions in Db2 12 for z/os

Similar documents
DB2 Partitioning Choices, choices, choices

PBR RPN & Other Availability Improvements in Db2 12

DB2 for z/os: Conversion from indexcontrolled partitioning to Universal Table Space (UTS)

Copyright 2007 IBM Corporation All rights reserved. Copyright 2007 IBM Corporation All rights reserved

PBR RPN & Other Availability Enhancements In Db2 12 Dec IBM z Analytics

Eenie Meenie Miney Mo, Which Table (Space) Type and Page Size Shall I Choose for DB2 on z/os?

Eenie Meenie Miney Mo, Which Table (Space) Type and Page Size Shall I Choose for DB2 on z/os?

Vendor: IBM. Exam Code: Exam Name: IBM Certified Database Administrator - DB2 10 for z/os. Version: Demo

DB2 12 A new spin on a successful database

Modern DB2 for z/os Physical Database Design

Optimizing Insert Performance - Part 1

Db2 12 A new spin on a successful database

Understanding the Power and Pitfalls of Partitioning In V8, 9 and Beyond

How do I keep up with this stuff??

Vendor: IBM. Exam Code: C Exam Name: DB2 10 DBA for z/os. Version: Demo

Database Design and Implementation

What Developers must know about DB2 for z/os indexes

Pass IBM C Exam

DB2 11 *NEW* Availability Functions and Features

Attack of the DB2 for z/os Clones Clone Tables That Is!

Can you really change DB2 for z/os Schemas online?

Hash Access to DB2 Data Faster, Better, Cheaper

DB2 for z/os Utilities Update

THE BUFFER POOL. Spring Utility Improvements in DB2 9 for z/os By Craig S. Mullins

DB2 for z/os Utilities Best Practices Part 2. Haakon Roberts DB2 for z/os Development IBM Corporation. Transcript of webcast.

DB2 for z/os Best Practices Optimizing Insert Performance - Part 1

DB2 11 for z/os Availability Enhancements. More Goodies Than You May Think

CA Database Management Solutions for DB2 for z/os

C Exam code: C Exam name: IBM DB2 11 DBA for z/os. Version 15.0

CA Database Management Solutions for DB2 for z/os

Deep Dive Into Storage Optimization When And How To Use Adaptive Compression. Thomas Fanghaenel IBM Bill Minor IBM

DB2 10 for z/os Technical Overview

What s new in DB2 Administration Tool 10.1 for z/os

Copy Smarter. Unload/Load, DSN1COPY and beyond. Kai Stroh, UBS Hainer GmbH Copy Smarter - Unload/Load, DSN1COPY and beyond

CA Performance Handbook

DB2 12 for z/os and Beyond

The Impact Of DB2 Version 4 On Recovery

TUC TOTAL UTILITY CONTROL FOR DB2 Z/OS. TUC Unique Features

No More Log RBA Resets! DB2 11 s Extended RBA and LRSN Support

290 Index. Global statement cache. See Caching

DB2 9 for z/os Technical Briefing

DB2 Temporal tables. Introduction. 19 April Rajesh Venkata Rama Mallina DB2 Z/OS DBA IBM

DB2 10 for z/os Technical Update

V9 Migration KBC. Ronny Vandegehuchte

This paper will mainly applicable to DB2 versions 10 and 11.

DB2 11 for z/os Utilities Update

DB2 11 and Beyond Celebrating 30 Years of Superior Technology

IBM DB2 Log Analysis Tool Version 1.3

DB2 12 Overview what s coming

IBM C IBM DB2 11 DBA for z/os. Download Full Version :

Vendor: IBM. Exam Code: C Exam Name: DB2 10 System Administrator for z/os. Version: Demo

DB2 9 for z/os V9 migration status update

Lessons Learned in Utility Management

Application Development Best Practice for Q Replication Performance

C Examcollection.Premium.Exam.108q

10/29/2013. Program Agenda. The Database Trifecta: Simplified Management, Less Capacity, Better Performance

IBM DB2 10 for z/os beta. Reduce costs with improved performance

L9: Storage Manager Physical Data Organization

CA Log Analyzer for DB2 for z/os

Basi di Dati Complementi. Mainframe

DB2 11 for z/os Application Functionality (Check out these New Features) Randy Ebersole IBM

DB2 for z/os Backup and Recovery Update - V9 and V10

Agenda. DB2 Utilities Update and Best Practices. Paul Bartak IBM DB2 Advisor

The attendee will get a deep dive into all the DDL changes needed in order to exploit DB2 V10 Temporal tables as well as the limitations.

Short Summary of DB2 V4 Through V6 Changes

Advanced Design Considerations

ODD FACTS ABOUT NEW DB2 for z/os SQL

DB2 Archive tables. Introduction. DDL Operations. 18 April Rajesh Venkata Rama Mallina DB2 Z/OS DBA IBM

Automating Information Lifecycle Management with

C Examcollection.Premium.Exam.58q

A Field Guide for Test Data Management

Table and Index Design: DB2 9 Strategies

An A-Z of System Performance for DB2 for z/os

Redpaper. DB2 9 for z/os: Backup and Recovery I/O Related Performance Considerations. Introduction. Jeff Berger Paolo Bruni

Db2 for z/os: Lies, Damn lies and Statistics

Reorganization Strategies in Depth

Simplify and Improve DB2 Administration by Leveraging Your Storage System

DB2 UDB: Application Programming

XML Storage in DB2 Basics and Improvements Aarti Dua DB2 XML development July 2009

BMC Day Israel. 21 st Century Data Management Technology Jim Dee, Corporate Architect, BMC June 7, Where IT goes Digital

DB2 9 for z/os Hints and Tips for Database Administrators

DB2 for z/os DB2 10 for z/os DBA Productivity

DB2 for z/os. Best Practices. FlashCopy and DB2 for z/os. Florence Dubois DB2 for z/os Development 2014 IBM Corporation

B.H.GARDI COLLEGE OF MASTER OF COMPUTER APPLICATION. Ch. 1 :- Introduction Database Management System - 1

DB2 for z/os and OS/390 Performance Update - Part 1

DB2 9 for z/os Selected Query Performance Enhancements

Chapter 8: Working With Databases & Tables

DB2 11 Charts My Top 20 Features. Andy Ward Senior Principal Consultant December 2014

Oracle Hyperion Profitability and Cost Management

An Introduction to DB2 Indexing

7. Query Processing and Optimization

Data types String data types Numeric data types Date, time, and timestamp data types XML data type Large object data types ROWID data type

Information Lifecycle Management for Business Data. An Oracle White Paper September 2005

SAP White Paper SAP Sybase Adaptive Server Enterprise. New Features in SAP Sybase Adaptive Server Enterprise 15.7 ESD2

DB2 10 and Beyond Celebrating 30 Years of Superior Technology

Db2 9.7 Create Table If Not Exists >>>CLICK HERE<<<

File Structures and Indexing

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Course Outline and Objectives: Database Programming with SQL

DB2 12 Technical Preview June 2016

Transcription:

PBR RPN - Removing Partitioning restrictions in Db2 12 for z/os Steve Thomas CA Technologies 07/11/2017 Session ID

Agenda Current Limitations in Db2 for z/os Partitioning Evolution of partitioned tablespaces Relative Page Numbering in Db2 12 for z/os Creating and Altering PBR RPN objects Migration, Utilities and Operational Considerations Summary and references 2

Why were changes needed? Planning for future at design time is hard Max No. of partitions depends on DSSIZE and page size DSSIZE is at a tablespace level Changing it is disruptive Cannot add a partition in the middle REBALANCE must run against multiple partitions Index and XML DSSIZE dependence Need for more or larger partitions? Maximum table size not comparable to other RDBMS 3

Comparison with other RDBMS Maximum Table Sizes in other databases: MS SQL - 524,272Tb Oracle 4Gb * block size (with BIGFILE tablespace) Db2 11 for z/os 16Tb (4k pages), 128Tb (32k pages) Db2 (was Db2 for LUW) 2 Zb As of Wikipedia October 2016 link in notes Db2 12 for z/os - 4Pb (1Tb/partition * 4096 partitions) 256 trillion rows in a single table (4k pages) Theoretical limit of Architecture is much higher 4

Comparing Partition limits Db2 11 for z/os Max no of partitions = 4096 Max partition size = 256Gb Only powers of 2 Only 64 partitions for 4kB pages Max table size = 128Tb 32k pages & 32Gb DSSIZE Number of partitions, partition size, and page size are bound Db2 12 for z/os Max no of partitions = 4096 Max partition size = 1Tb Any number of Gigabytes Partitions can have different sizes Max table size = 4Pb Independent of Page size Less disruptive partition management 5

Some History - Db2 for z/os V1 (1983) Index Controlled Partitioning (ICP) Now called Classic Partitioning 4 bytes RID (Record ID) 3 bytes page number + 1 byte ID entry Largest table or tablespace = 64Gb Maximum number of partitions = 64 Relationship between No. of partitions and Max size Number of partitions Max partition size (GB) 1 16 4 17-32 2 33-64 1 6

First changes - Version 5 (1997) RID expanded to 5 bytes 4 bytes page number + 1 byte ID entry Largest table or tablespace = 1,016Gb Introduces LARGE tablespaces Must be used with NUMPARTS New limits for LARGE tablespaces Maximum number of partitions = 254 Maximum partition size 4Gb LARGE implied if NUMPARTS > 64 Non-LARGE tablespaces retained old limits Number of partitions Max partition size (GB) 1 16 4 17-32 2 33-64 1 65-254 4 7

LARGE only lasted one Release Version 6 (1998) DSSIZE replaced LARGE LARGE deprecated supported but DSSIZE preferred Partition size up to 64Gb Size >4Gb requires extended format and extended addressing Up to 254 partitions of 64 GB Largest tablespace = 16 TB 8

Pace of change then accelerated Version 8 (2004) Table Controlled partitioning (TCP) partitioning secondary indexes Up to 4,096 partitions, Largest tablespace = 128Tb If NUMPARTS > 254, max DSSIZE depends on the page size Version 9 (2007) UTS Partitioned By Range (PBR) or by Growth (PBG) No changes in limits (except for NPI) 9

Now we have Db2 12 for z/os (2016) New type of UTS PBR Relative Page Numbering (RPN) Record ID (RID) increased from 5 bytes to 7 bytes Partition size in PBR RPN can be up to 1Tb Total size of PBR RPN up to 4Pb and 256 trillion rows Should keep us happy for a while! Removes many other limitations DSSIZE no longer at the table space level Max No. of partitions does not depend on DSSIZE and page size Ability to insert a partition in the middle of a tablespace Index and XML DSSIZE independence 10

Partitioned Spaces in Db2 12 for z/os Partitioned Tablespaces Non-universal Partitioned (deprecated) Universal Index Controlled Table Controlled UTS PBR UTS PBG Absolute Numbering Relative Numbering 11

Partitioned Tablespaces in Version 12 Classic partitioned (Non-UTS) tablespaces deprecated Both Index Controlled (ICP) and Table Controlled (TCP) Managed by two new DSNZPARMS: DPSEGSZ controls whether they can be created PREVENT_NEW_IXCTRL_PART controls ICP creation Default Partitioned object is now a PBR with SEGSIZE 32 Partition by growth (PBG) universal table spaces Defined using both MAXPARTITIONS and SEGSIZE Can grow up to 128TB Partitioned indexes are not supported A non-partitioning index (NPI) always uses a 5 byte RID Use absolute numbering 12

TCP vs PBG visually Classic (TCP) PBG Head Head Head Head Head Head Space Space NPI DPSI DPSI DPSI NPI 13

PBR changes in Db2 12 for z/os Created using both NUMPARTS and SEGSIZE New PAGENUM ABSOLUTE RELATIVE clause distinguishes between absolute and relative numbering Any type of index is supported on a table in a range-partitioned table space Partitioned or non-partitioned Partitioning index is no longer required The rest of this presentation will focus on PBR 14

PBR Absolute vs Relative Absolute Numbering Relative Numbering Head NPI Segmen t Head Head Head Head Head NPI NPI DPSI NPI NPI DPSI 15 Head NPI Head Head NPI NPI DPSI Head Segmen t Head Head NPI NPI DPSI

PBR RPN Index considerations Index partitions now independent from base table partition size Maximum index partition size is 1 TB DSSIZE no longer needs to be in powers of 2 Indexes on PBR RPN will still inherit default values NPIs have same characteristics as pre-db2 12, except: RID is 7 bytes For 4K, 8K, 16K, or 32K index page size, maximum index space size will continue to be limited to 16Tb, 32Tb, 64T or 128 Tb Maximum PIECESIZE size limited to DSSIZE of table space, with maximum value of 256 GB;; the default is 4 GB 16

Max Partitions Absolute numbering Maximum number of partitions for a tablespace using absolute numbering is still driven by the old table: RID Page size (KB) DSSIZE (GB) Max # of partitions Total TS size (TB) 5 byte EA 4 1 4,096 4 5 byte EA 4 256 64 16 5 byte EA 32 1 4,096 4 5 byte EA 32 256 512 128 5 byte non EA (LARGE) 4 4 4,096 16 17

Record Identifiers (RIDs) A unique identifier Db2 uses internally to identify a row Used in multiple places: and Index Pages Db2 Transaction Log Utilities e.g. RID Mapping Table in Online REORG RIDPool during SQL Evaluation List Prefetch and more A RID consists of the following elements: A = Partition number (e.g. Partition 5) B = Page number within the partition (e.g. Page 100) C = Page ID map entry (e.g. 7th row in the Page) 18

How it all hooks together A B C A = Partition number B = Page number within the partition C = Page ID map entry B A data C 19

RID Length changes 4 bytes in Db2 v1: A and B share 3 bytes (24 bits) C = 1 byte 5 bytes in Db2 v5: A and B share 4 bytes (32 bits) C = 1 byte And now 7 bytes in Db2 12: A = 2 bytes, B = 4 bytes, C = 1 byte A = Partition number B = Page number within the partition C = Page ID map entry (always 1 byte) 20

Explains link between partition numbers and sizes Db2 11 or Absolute page numbering in Db2 12 A and B share a fixed number of bits = 32 (5 byte RID) A and B lengths are variable, resulting in many combinations A B C... A B C 12 bits for # partitions (4,096) Leaves 20 bits for Pages 6 bits for # partitions (64) Leaves 26 bits for Pages More Partitions means fewer pages being available in each A = Partition number B = Page number within the partition C = Page ID map entry (always 1 byte) 21

Solution is Relative Page Numbering A and B parts are both fixed, A = 16 bits, B = 32 bits Theoretical limit 65,536 partitions, 2^32 pages (8 ZB) Note these limits have not been implemented yet! A B C 16 bits for partitions 32 bits for pages A = Partition number B = Page number within the partition C = Page ID map entry (always 1 byte) 22

What is a Page Number? In Absolute numbering: A combination of partition & page numbers DB2 can determine the partition from the page number In Relative numbering: just page number within the partition No way to determine which partition just from the page number Can be found in Physical pages see DSN1PRNT Db2 log records see DSN1LOGP Control blocks IFCIDs, internal control blocks, Can be specified for some utilities 23

How to create a PBR RPN New PAGENUM clause in DDL PAGENUM ABSOLUTE or RELATIVE Both CREATE TABLESPACE & CREATE TABLE Explicit (CREATE TABLESPACE) vs implicit tablespace (CREATE TABLE) Must also use Partition By Range specification Supported from Function level V12R1M500 +- +- - - - - - - - - - - - - - - - - - - - - - - - - - +- - - - - - - - - - - - - - + +- PAGENUM ABSOLUTE- - - - - - - - - + '- PAGENUM RELATIVE- - - - - - - - - ' 24

Some Notes Default from PAGESET_PAGENUM DSNZPARM Ships with a default of A works as before partition sizes can be up to 1Tb default is 4Gb No dependency on number of partitions Supports any value from 1Gb to 1,024Gb No need for DSSIZE to be powers of 2 as before sets must be Extended Format and Addressability Increased RID size has an impact on Db2 log records Tablespace records 20 bytes larger Index records 28 bytes larger For Db2 12 regardless of whether you use RPN or not 25

Restrictions PAGENUM RELATIVE cannot be used for: Tablespace organized by hash Workfile tablespaces LOB tablespaces Clones 3 bytes minimum row data size SQLCODE = -270, ERROR: FUNCTION NOT SUPPORTED 26

Tables with XML data Underlying XML table space implicitly created with the same PAGENUM attribute as the base table space. You can ALTER the DSSIZE for a partition of an XML tablespace Default DSSIZEs for XML tablespaces: Base table DSSIZE (GB) 4KB PGSIZE 8KB PGSIZE 16KB PGSIZE 32KB PGSIZE 1-4 4 4 4 4 33-64 64 64 64 32 513-1024 1024 1024 1024 512 27

Indexes on RPN Objects DSSIZE supported for a partitioned index Specifies maximum size for each partition Any Integer supported from 1 to 1024Gb DSSIZE > 4Gb requires extended format & addressability The value is provided by: DSSIZE value from the PARTITION clause for that partition Global DSSIZE keyword outside of a PARTITION clause Default value inherited from the base table space 28

Now for the real benefits Altering DSSIZE supported at the partition level Upwards is an immediate change No REORG Downwards still a Pending change at the Tablespace level Uses AREOR restricted state Also supported by partitioned indexes and XML objects Insert a partition split existing partition Pending ALTER Can REORG only the affected partition See next slide for an example Supported by all types of UTS PBR not just RPN Not supported when LOB or XML objects are involved 29

Inserting and Rotating Partitions Source: IDUG Whitepaper, http://www.idug.org/db2v12whitepaper 30

Converting to PBR RPN How depends on your starting point From PBR: ALTER TABLESPACE PAGENUM RELATIVE Pending alter tablespace level REORG required Be aware of BRF deprecation in V12R1M500 From Classic partitioned tablespace: Must convert to PBR first Could mean ICP->TCP->UTS PBR Absolute->UTS PBR Relative Changes to PBR and to RPN can be implemented in 1 REORG You will have 2 pending changes in SYSPENDINGDDL 31

Catalog changes for PBR RPN Many Catalog changes reflect the new Tablespace type and options at the partition level PAGENUM for tablespaces and indexes DSSIZE for partitions and indexes SYSPENDINGDDL New columns to support Inserting a partition REORG_SCOPE_LOWPART, REORG_SCOPE_HIGHPART How to find PBR RPN objects in catalog: SELECT * FROM SYSIBM.SYSTABLESPACE WHERE PAGENUM = 'R';; 32

Some PBR RPN catalog changes SYSIBM.SYSCOPY TTYPE for ICTYPE = A and STYPE=P SYSIBM.SYSINDEXES PAGENUM A, R, or NULL (A for NPI) DSSIZE for partitioned indexes SYSIBM.SYSINDEXPART PAGENUM A, R, or NULL (A for NPI) DSSIZE for partitioned indexes SYSIBM.SYSTABLEPART TYPE R for PBR PAGENUM A, R, or NULL DSSIZE maximum size of partition SYSIBM.SYSTABLESPACE PAGENUM A, R, or NULL 33

Support in utilities REPAIR CATALOG TABLESPACE xxx TEST Check consistency of the object and data in the catalog Syntax changes due to 7 bytes RID and relative numbering ROWID accepts two extra bytes for a partition PAGE specifies absolute numbering, integer or hex value PART is used for PBR RPN together with PAGE CHECK DATA Exception tables must contain 7 bytes RID (not required column) RECOVER No Recovery before REORG materializing PAGENUM RELATIVE RECOVER PAGE must be used with DSNUM for PBR RPN 34

Support in REORG Inline copies must be on partition level See next slide for more details on this New RID size in mapping table for PBR RPN: CREATE TABLE MYMAPPING_TABLE (TYPE CHAR( 01 ) NOT NULL, SOURCE_RID CHAR( 07 ) NOT NULL, TARGET_XRID CHAR( 11 ) NOT NULL, LRSN CHAR( 10 ) NOT NULL) Originally DSNU366I if using wrong size but DB2 now auto-creates new mapping table with the correct characteristics Objects with 5 byte RIDs can use older mapping tables Automatically created mapping tables use 7 bytes RID 35

Inline copies Inline copies for Online REORG and LOAD may contain duplicate data pages which can be out of sequence Problem: how to determine the correct partition for each page? Db2 cannot decide so partition level copies are required New error message DSNU2922I Note potential problems if you take Tape based copies You now need a unit for each partition Do you have enough? Ideally move copies to disk and archive to tape after the job IBM talking about providing some relief for this shortly Possible new TAPEUNITS option 36

Service Aids DSN1PRNT New PART keyword used for PBR RPN Ignored for absolute numbering Only one partition can be specified Always prints partition number (even for absolute numbering) Example: PARTITION: # 0002 PAGE: # 00008000 DSN1LOGP New PART keyword Hex constant using 1-4 chars Supports up to 10 Partitions in one execution RID hex constant, up to 10 characters First 8 are page number, last two are page ID map entry PAGE hex constant up to 8 characters Prints the partition number if included in the log record 37

Installation and migration BSDS conversion required Db2 12 always writes 10 byte RBA/LRNS expanded log records V12R1M500 and above uses Db2 12 log records for all objects V12R1M100 internally uses longer log records, but writes Db2 11 compatible records New/updated DSNZPARMs related to PBR RPN PREVENT_NEW_IXCTRL_PART - default is YES PAGESET_PAGENUM default is A Multiple IFCID changes check documentation 38

Index considerations Indexes will consume more space due to extended RID 2 bytes more per RID REORG of tablespace altered to RPN will also reformat the indexes to RPN SYSCOPY will have entries for tablespaces and indexes Affects only Indexes for PBR RPN tablespaces RID stays 5 bytes in other types of tablespaces 39

Possibly affected SQL Do you use Direct row access? PRIMARY_ACCESSTYPE='D' Unless you do anything tricky, no changes needed RID(table-designator) Returns a RID of a row often used with Optimistic Locking The result is a BIGINT value (8 bytes) even in prior versions Do not change the returned value ROWID function and column type Value is transparent to user 40

RID pool considerations Db2 uses RID pool for: Enforcing unique keys for multi-row updates List prefetch, including single index list prefetch access paths Multiple index access paths and Hybrid Joins DSNZPARM MAXRBLK sets maximum RID Pool size There s a conflict in the manuals here: Managing performance Guide: # concurrent RID activities * average # RIDs * 2 * 5 (bytes per RID) Installation guide formula: # concurrent RID activities * average # RIDs * 2 * 8 (bytes per RID) Safe to say it will go up in size! Increase by 40% to retain RID numbers 41

Summary Universal Tablespaces strategic Convert as soon as possible PBR RPN allows more partitions and has new size limits PBR RPN allow data set size on partition level Can now insert partitions into a Tablespace Via Splitting existing partition - also for absolute numbering Less disruptive partition management Conversion to RPN requires tablespace level REORG Be aware of inline copies, new page and log formats 42

References and Thanks Thanks to Emil Kotrc producing much of the original material Db2 12 for z/os, An IDUG User Technical Perspective Whitepaper http://www.idug.org/db2v12whitepaper IBM Db2 12 for z/os Technical Overview Redbook http://www.redbooks.ibm.com/abstracts/sg248383.html?open Db2 12 Documentation http://www.ibm.com/support/knowledgecenter/ssepek_12.0.0/home/src/tpc/db2z _12_prodhome.html Db2 for z/os: UTS Conversion Whitepaper and Blog http://www-01.ibm.com/support/docview.wss?uid=swg27047046 https://www.ibm.com/developerworks/community/blogs/0399c6ff-7881-490a-a3e6- a65909a40085/entry/what_is_the_recommended_method_to_migrate_classic_p artitioned_table_spaces_to_partitioned_by_range_table_spaces?lang=en VSAM demystified Redbook http://www.redbooks.ibm.com/abstracts/sg246105.html?open 43

Session feedback Please submit your feedback online at: http://conferences.gse.org.uk/2017/feedback/id Paper feedback forms also available from the Chairperson This session is ID 44