DB2 Partitioning Choices, choices, choices

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

Advanced Design Considerations

Optimizing Insert Performance - Part 1

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

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

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

PBR RPN & Other Availability Improvements in Db2 12

Modern DB2 for z/os Physical Database Design

DB2 for z/os Utilities Update

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

DB2 12 A new spin on a successful database

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

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

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

Reorganization Strategies in Depth

Pass IBM C Exam

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

DB2 11 for z/os Utilities Update

An Introduction to DB2 Indexing

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

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

Hash Access to DB2 Data Faster, Better, Cheaper

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.

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?

Db2 12 A new spin on a successful database

Kathleen Durant PhD Northeastern University CS Indexes

DB2 11 *NEW* Availability Functions and Features

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

Arrays are a very commonly used programming language construct, but have limited support within relational databases. Although an XML document or

Optimising Insert Performance. John Campbell Distinguished Engineer IBM DB2 for z/os Development

The Impact Of DB2 Version 4 On Recovery

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

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

IMS Backup & Recovery Insurance Are you covered?

DB2 10 for z/os Technical Update

Table and Index Design: DB2 9 Strategies

V9 Migration KBC. Ronny Vandegehuchte

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

How do I keep up with this stuff??

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

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

DB2 9 for z/os V9 migration status update

Crossing Over/ Breaking the DB2 Platform Barrier Comparing the Architectural Differences of DB2 on the Mainframe Vs. Distributed Platforms

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

DB2 9 for z/os Technical Briefing

Vendor: IBM. Exam Code: C Exam Name: DB DBA for Linux UNIX and Windows. Version: Demo

DB2 10 for z/os Technical Overview

DB2 12 Overview what s coming

IBM DB2 9 Database Administrator for Linux UNIX and Windows Upgrade.

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

Vendor: IBM. Exam Code: Exam Name: DB DBA for Linux, UNIX, and Windows. Version: Demo

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

Basi di Dati Complementi. Mainframe

Unit 3 Disk Scheduling, Records, Files, Metadata

Software Announcement March 6, 2001

PASS4TEST. IT Certification Guaranteed, The Easy Way! We offer free update service for one year

The Right Read Optimization is Actually Write Optimization. Leif Walsh

Optimizing Database I/O

CA Performance Handbook

1

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

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

CDB/Auto-Online Unload CDB/Auto-Unload

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

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

04 Storage management 15/07/17 12:34 AM. Storage management

To REORG or not to REORG That is the Question. Kevin Baker BMC Software

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

SQL stands for Structured Query Language. SQL is the lingua franca

RAID in Practice, Overview of Indexing

CA Database Management Solutions for DB2 for z/os

Multidimensional Clustering (MDC) Tables in DB2 LUW. DB2Night Show. January 14, 2011

File Structures and Indexing

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

Resource Optimization

TestBase's Patented Slice Feature is an Answer to Db2 Testing Challenges

ODD FACTS ABOUT NEW DB2 for z/os SQL

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

Chapter 1 GETTING STARTED. SYS-ED/ Computer Education Techniques, Inc.

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

A DB2 Performance Tuning Roadmap: A High-Level View on Managing the Performance of DB2 for z/os. Craig S. Mullins

What Developers must know about DB2 for z/os indexes

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

Session: G03 No Magic to Improve DB2 for z/os Application Performance. Marcel Lévy Natixis. May 19, :30 p.m. 02:30 p.m. Platform: DB2 for z/os

A Field Guide for Test Data Management

Database Design and Implementation

IBM EXAM QUESTIONS & ANSWERS

Revival of the SQL Tuner

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

Chapter 3: Database Components

SQL*Loader Concepts. SQL*Loader Features

CA Rapid Reorg for DB2 for z/os

IBM DB2 LUW Performance Tuning and Monitoring for Single and Multiple Partition DBs

E-Guide DATABASE DESIGN HAS EVERYTHING TO DO WITH PERFORMANCE

Application Development Best Practice for Q Replication Performance

DB2 Analytics Accelerator Loader for z/os

GSE Belux DB2. Thursday 6 December DB2 V10 upgrade BNP Paribas Fortis

CA Database Management Solutions for DB2 for z/os

DB2 UDB Monitoring with Scripts

Transcription:

DB2 Partitioning Choices, choices, choices Phil Grainger BMC Software Date of presentation (01/11/2016) Session IB

DB2 Version 8

Table Based Partitioning Version 8 introduced TABLE BASED PARTITIONING What we had before was INDEX BASED PARTITIONING Both are currently supported DB2 can almost invisibly switch from indexbased to table-based.. 4

Table Based Partitioning A partitioned table NO LONGER needs a partitioning index The table itself is defined as partitioned with the relevant key ranges Note that the tablespace in which the table will reside must also have the same number of partitions CREATE TABLE table_name (col1, col2, col3), PARTITION BY (col1, col2), ( PART 1 VALUES (aaa,xxx), PART n VALUES (bbb,yyy); 5

Table Based Partitioning Conversion happens when an ALTER is issued that is valid for table based partitioning only ALTER INDEX NOT CLUSTER for the partitioning index ALTER TABLE ADD PART CREATE INDEX PARTITIONED Etc. IBM suggest CREATE a PARTITIONED SECONDARY INDEX (DPSI) with the DEFINE NO, DEFER YES keywords This does nothing and does not affect availability And then DROP this new index 6

Table Based Partitioning Because partitioning does not use an index, CLUSTERing does not necessarily relate to PARTITIONing any more With INDEX BASED partitioning secondary indexes contain keys for all partitions This severely affects availability and operation of utilities With TABLE BASED partitioning secondary indexes can also be partitioned on the same keys However they could NOT be UNIQUE.. 7

Data Partitioned secondary indexes A Data Partitioned Secondary Index (DPSI) then Is an index on a partitioned table which is also physically partitioned It MUST be non-unique (for DB2 V8) as potential duplicates could be in any one of 4,095 other DPSI partitions If you need a Unique secondary index then it couldn t be partitioned DPSIs may not be ideal for access paths requiring a sequential index scan For example, a SELECT of all customers in AK for example Partitioned by account number DB2 would have to scan ALL partitions of the DPSI, despite STATE being the high order key column A traditional NPI would be better 8

Data Partitioned secondary indexes On the other hand, DPSIs are great for utility concurrency All utilities can run at partition level 9

Adding Partitions A partition can be added at the end of an existing partitioned table But only up to the maximum number of partitions From 4,096 DOWN to 254, depending on tablespace attributes The partition number itself is not specified It is chosen by DB2 But the new limit keys must, of course, be specified Not so simple if current last partition contains ALL remaining key values 10

Adding Partitions All plans, packages and cached dynamic SQL statements are invalidated We now need to be aware of a VERY subtle difference between LOGICAL partition number and PHYSICAL partition number LOGICAL refers to the partition number of the TABLE (counting keyranges) PHYSICAL refers to the Annn node of the pageset name 11

Rotating Partitions DB2 Version 8 also allows partition ROTATING This is where the partition that is currently the first (the one with the lowest keys) is rotated to become the last (which will now contain the highest keys) All rows will be deleted from the rotated partition And all SYSCOPY & SYSLGRNX rows for it will be purged Also, the new limit keys for the new partition will be specified on the ALTER ROTATE statement 12

Rotating Partitions When we rotate FIRST to LAST, we effectively remove the old first partition and what was the SECOND one now becomes the first Remember, partition keys are only specified ONCE for each partition We list the HIGHEST key that can reside in any partition So, after ROTATING, a row that would have been placed into PART 1 will now be placed into PART 2 instead! 13

Rotating Partitions Remember logical vs physical a few pages back? We could start with the same 10 partition table That has physical datasets A001 A010 If we ROTATE FIRST TO LAST Logically we still have partitions 1-10 (it s just that the old part 2 is now part 1 etc) BUT DB2 doesn t rename the pagesets So logical partition 1 is now physical pageset A002 Logical partition 9 is now physical pageset A010 And logical partition 10 is physical pageset A001(!) 14

Rotating AND Adding This is where it will get messy Start with Parts 1-10 (A001-A010) Rotate first to last Now we have A002-A010 followed by A001 Add a partition Now there s A002-A010, then A001, finally A011 Got all that??? LOGICAL and PHYSICAL partition numbers are no longer guaranteed to be the same. 15

DB2 9

Unique DPSIs A DPSI can now be unique IF its high order columns include the partitioning key Keeps potential duplicates in the same partition Otherwise, DPSI must still be non-unique 17

Universal table spaces A Universal table space is one that is both SEGMENTED and PARTITIONED Note, simple table spaces are on their way out Do NOT drop one by mistake.. Or even on purpose Impossible to recreate All the benefits of a segmented table space with partitioning 18

Universal table spaces There are also now TWO types of partitioning Partition by RANGE Key range partitioning that we ve always had Partition by GROWTH New partitions are added as data grows This is NOT partitioning that we understand 19

UTS Partition by range This is no different to Version 8 (and prior) partitioning A UTS range partitioned table space is created just like a normal partitioned table space But with a SEGSIZE clause 20

UTS Partition by growth Starts off as a one partition table space As data is inserted/loaded the partition will fill up When it is full, another partition is automatically created No -904 No partitioning key You specify the limit to the number of partitions on the CREATE table space statement MAXPARTITIONS 21

UTS Partition by growth In fact MAXPARTITIONS is the ONLY keyword that denotes a PBG table space The maximum number of partitions is the same as the maximum number of parts for a PBR table space Depends on pagesize and DSSIZE From 256 to 4,096 PLEASE don t default to the maximum 22

UTS Partition by growth NOTE Because rows are in partitions arbitrarily Not based on a key Some partition operations make no sense Rebalance LOAD INTO PART ALTER LIMITKEY Add/Rotate partitions Etc 23

UTS Partition by growth Of course, secondary indexes can be built on PBG table spaces These will ALWAYS be Non Partitioned Indexes Because there is NO concept of a partitioning key 24

UTS Partition by growth Allocation of new partitions is NOT rolled back Even if the inserting UOW is Reorganisation may reclaim space IN a PBG table space But in DB2 9, empty datasets are not deleted If LOB or XML columns are involved, rows cannot move between partitions Space IN a partition may be reclaimed 25

UTS Partition by growth COPY SHRLEVEL CHANGE will NOT copy a partition that has appeared during the copy process 26

Table space specifications NUMPARTS SEGSIZE MAXPARTITIONS Result No No No Segmented table space (segsize 4) No No Yes Universal Partition by Growth table space No Yes No Segmented table space Yes No No Yes No Yes Not valid Yes Yes No No Yes Yes Yes Yes Yes Not valid Simple partitioned by range table space Universal table space (partitioned by range) Universal Partition by Growth table space 27

DB2 10

Default tablespace type Partitioned by Growth (PBG) is now the default table space type NOT Simple Not even Segmented Single table tablespaces can be ALTERed to PBG Classic partitioned tablespace is now deprecated DSNZPARM can override default segsize to 0 To support implicit classic partitioned NOT recommended by IBM 29

Reorganization of PBGs REORG TABLESPACE might leave a table space in COPY-pending status when: The table space is a partition-by-growth table space The table space contains LOB columns Rows are moved to a different partition or a new partition is added to the table space Reorg of a partition may fail if the data does not fit back! 30

Workfile database Workfile tablespaces can now be PBGs Or a mixture of PBGs and segmented Must drop/recreate Alter is not possible 31

Catalog and Directory Most catalog and directory tablespaces are now PBG And thus SINGLE table tablespaces You DID update your disaster recovery plans didn t you? 32

ALTER. ROTATE changes ANY partition Apart from the current last partition Can be rotated to last ALTER ROTATE PARTITION nnn TO LAST This makes a dangerous hole even more dangerous Physical vs. logical partition numbers But sort of provides a drop partition capability 33

DB2 11

No major changes to partitioning Have you got the message? UTS PBG is the future for non-pbr tablespaces UTS PBR otherwise No segmented No simple No classic partitioning But support for multi-table UTS is still missing 35

Workfile tablespaces: IBM Recommendation If you have not already done so, drop work file table spaces and re-create them as partition-by-growth table spaces 36

PBG reorganization changes (1) REORG_DROP_PBG_PARTS specifies whether trailing empty partitions are removed When operating on an entire partition-by-growth table space ENABLE or DISABLE An empty trailing partition occurs when REORG moves all data records from a partition Default is DISABLE 37

PBG reorganization changes (2) REORG_IGNORE_FREESPACE controls whether DB2 ignores the PCTFREE and FREEPAGE Can avoid out of space conditions during reorgs Especially partition level ones NO or YES Default is NO The parameter is an IGNORE Yes means IGNORE freespace No - means HONOUR freespace! 38

No major changes in DB2 11, but Altering limitkeys is now a DEFERRED alter ALTER TABLE ALTER PARTITION n ENDING AT <new key> Puts partition(s) in AREOR For PBR and classic partitioned with table partitioning ONLY Next online reorg materializes new limit keys PIT recovery to before the reorg is supported REORP 39

No major changes in DB2 11 and REORG REBALANCE.. SHRLEVEL CHANGE On-line rebalance Partition level in-line copies 40

And.?

Coming to a DB2 near you - maybe How many rows do you really want in a single table? How big would you like each partition to be? Just how many partitions is enough? Independently managed partitions? And what about those pesky NPIs? 42

Software Sessions Day Start End Room Session # / Title Speaker Tue 12:00 13:00 Woodcote LB: Improving XCF performance to keep up with CPC Don Zeunert improvements Tue 12:00 13:00 Monza IB- DB2 Partitioning- choices, choices, choices Phil Grainger Tue 15:15 16:00 Indianapolis BD: "System z Scalabilty Don Zeunert Wed 12:00 13:00 Wed 14:00 14:45 Priory Monza HH: How to Improve IMS Scheduling IJ: Solving DB2 Performance Problems Loc Tran Phil Grainger Stop by the BMC booth for more information about sessions or other Q/A with speakers

This is the last slide in the deck Session feedback Please submit your feedback at http://conferences.gse.org.uk/2016/feedback/ib Session is IB