partitioning… and relative page numbering on db2 12 for z ... presentations...webinars and to...

30
Partitioning… and Relative Page Numbering on Db2 12 for z/OS David Simpson [email protected]

Upload: others

Post on 13-Sep-2020

4 views

Category:

Documents


1 download

TRANSCRIPT

Page 2: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

Themis Education• Most complete DB2 Curriculum in the industry

• Offerings include a complete mainframe curriculum in addition to Oracle, Java, .NET, Linux, UNIX, etc.

• Training Venues:– At your facility for groups– Public enrollment at various locations in the USA– Distance learning public enrollment with live instructors.

• Webinars:– Visit www.themisinc.com/webinars for upcoming schedule and replays of past

webinars and to download today’s slides.

• This material comes from our Db2 12 migration course– View Outline and Register

Page 3: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

David Simpson

David Simpson is currently the Vice President of Themis Inc. He teaches courses on SQL, Application Programming, Database Administration as well as optimization, performance and tuning. He also installs and maintains the database systems used for training at Themis and works with our network of instructors to deliver high quality training solutions to our customers worldwide.

Since 1993 David has worked as a developer and DBA in support of very large transactional and business intelligence systems. David is a certified DB2 DBA on both z/OS and LUW. David was voted Best User Speaker and Best Overall Speaker at IDUG North America 2006. He was also voted Best User Speaker at IDUG Europe 2006 and is a member of the IDUG Speakers Hall of Fame. David is also an IBM Gold Consultant.

[email protected] Find my work:www.themisinc.com www.themisinc.com/webinarswww.linkedin.com/in/davidcsimpson/ www.idug.org/content@ThemisDave@ThemisTraining

Page 4: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

Partitioned Table Space Evolution

Index Controlled Range Partitioning

Table Controlled Range Partitioning

Universal Partition by Range (PBR)

Universal Partition by Growth (PBG)*

Universal Partition by Range (PBR)PAGENUM ABSOLUTE

Universal Partition by Range (PBR)PAGENUM RELATIVE

deprecated

*For PBG fun see Julia Carter’s article on the IDUG Beginner’s Blog:

https://www.idug.org/p/bl/et/blogaid=825

Presenter
Presentation Notes
H2 Many of the performance enhancements in Db2 12 involves additional or better usage of memory. Real storage requirements should be reviewed during migration.
Page 5: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

Possible ConversionsSimple Single

Table TS

PBG TSSegmented Single

Table TS

Classic Table Controlled Part TS

Classic IndexControlled Part TS

PBR TS

Presenter
Presentation Notes
H3 Possible Tablespace Conversions ALTER supported table space type conversions: Convert index partitioned table space to table partitioned but not the reverse. If you need to convert it back you must DROP & RE-CREATE Convert classic table partitioned table space to a range-partitioned table space by adding SEGSIZE. UTS cannot be altered back to classic. Convert simple table space with one table to a partition-by-growth table space Convert segmented table space with one table to a partition-by-growth table space Convert a partition-by-growth table space to hash table space and convert it back Convert a range-partitioned tables space to hash table space and convert it back
Page 6: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

Partitioning… Last Limitkey

Last limitkey is enforced IF any of the following are true:

– The tablespace was created with the LARGE keyword

– The tablespace has more than 64 partitions– The DSSIZE is 4G or greater– Table controlled partitioning was used

Any of these things also lead to a 5 byte RID

Presenter
Presentation Notes
H3 Possible Tablespace Conversions ALTER supported table space type conversions: Convert index partitioned table space to table partitioned but not the reverse. If you need to convert it back you must DROP & RE-CREATE Convert classic table partitioned table space to a range-partitioned table space by adding SEGSIZE. UTS cannot be altered back to classic. Convert simple table space with one table to a partition-by-growth table space Convert segmented table space with one table to a partition-by-growth table space Convert a partition-by-growth table space to hash table space and convert it back Convert a range-partitioned tables space to hash table space and convert it back
Page 7: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

Convert Index to Table PartitioningClustering

Index

Last limitkeywas altered

Would be “*N” if alter was not necessary

Beware of converting any other way… especially add/rotate partition!!!

Presenter
Presentation Notes
H3 Possible Tablespace Conversions ALTER supported table space type conversions: Convert index partitioned table space to table partitioned but not the reverse. If you need to convert it back you must DROP & RE-CREATE Convert classic table partitioned table space to a range-partitioned table space by adding SEGSIZE. UTS cannot be altered back to classic. Convert simple table space with one table to a partition-by-growth table space Convert segmented table space with one table to a partition-by-growth table space Convert a partition-by-growth table space to hash table space and convert it back Convert a range-partitioned tables space to hash table space and convert it back
Page 8: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

Convert Index to Table Partitioning

Put things back the way

they were

Presenter
Presentation Notes
H3 Possible Tablespace Conversions ALTER supported table space type conversions: Convert index partitioned table space to table partitioned but not the reverse. If you need to convert it back you must DROP & RE-CREATE Convert classic table partitioned table space to a range-partitioned table space by adding SEGSIZE. UTS cannot be altered back to classic. Convert simple table space with one table to a partition-by-growth table space Convert segmented table space with one table to a partition-by-growth table space Convert a partition-by-growth table space to hash table space and convert it back Convert a range-partitioned tables space to hash table space and convert it back
Page 9: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

Convert to PBR

Tablespace level reorg needed to convert

Presenter
Presentation Notes
H3 Possible Tablespace Conversions ALTER supported table space type conversions: Convert index partitioned table space to table partitioned but not the reverse. If you need to convert it back you must DROP & RE-CREATE Convert classic table partitioned table space to a range-partitioned table space by adding SEGSIZE. UTS cannot be altered back to classic. Convert simple table space with one table to a partition-by-growth table space Convert segmented table space with one table to a partition-by-growth table space Convert a partition-by-growth table space to hash table space and convert it back Convert a range-partitioned tables space to hash table space and convert it back
Page 10: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

Table Controlled Partitioning(applies to PBR too!)

Presenter
Presentation Notes
H3 Prior to Db2 12 data pages were sequentially formatted based on table space (absolute page number), not based n each data partition. Db2 12 now offers data page formatting with partition of a partition by range table space. This new format extends the RID (record ID) from five bytes to seven.
Page 11: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

Table Controlled Partitioning(applies to PBR too!)

Limitkeys at the table level

Presenter
Presentation Notes
H3 Prior to Db2 12 data pages were sequentially formatted based on table space (absolute page number), not based n each data partition. Db2 12 now offers data page formatting with partition of a partition by range table space. This new format extends the RID (record ID) from five bytes to seven.
Page 12: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

Partitioning Index

Partitioned index leads

with the partitioning

key

Presenter
Presentation Notes
H3 Prior to Db2 12 data pages were sequentially formatted based on table space (absolute page number), not based n each data partition. Db2 12 now offers data page formatting with partition of a partition by range table space. This new format extends the RID (record ID) from five bytes to seven.
Page 13: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

Another Partitioning Index

Partitioned index leads

with the partitioning

key

Presenter
Presentation Notes
H3 Prior to Db2 12 data pages were sequentially formatted based on table space (absolute page number), not based n each data partition. Db2 12 now offers data page formatting with partition of a partition by range table space. This new format extends the RID (record ID) from five bytes to seven.
Page 14: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

Non Partitioned Secondary Index (NPSI)

No keyword PARTITIONED

So… NPSI

Presenter
Presentation Notes
H3 Prior to Db2 12 data pages were sequentially formatted based on table space (absolute page number), not based n each data partition. Db2 12 now offers data page formatting with partition of a partition by range table space. This new format extends the RID (record ID) from five bytes to seven.
Page 15: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

Data Partitioned Secondary Index (DPSI)

PARTITIONEDBut does not lead with the

partitioning key

Presenter
Presentation Notes
H3 Prior to Db2 12 data pages were sequentially formatted based on table space (absolute page number), not based n each data partition. Db2 12 now offers data page formatting with partition of a partition by range table space. This new format extends the RID (record ID) from five bytes to seven.
Page 16: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

Db2 12 PBR RPN Tablespaces• Partition-by-range relative-page-number• RPN represents the relative page number without

embedded partition numbers• 7-byte RID (2-byte part #, 4-byte page #1-byte row)• DSSIZE per partition now 1TB with a max table

size of 4PB for up to 256 trillion rows • Index structure changed to support PBR RPN• Utilities and Log modified to support PBR RPN• V12R1M500 & above

Presenter
Presentation Notes
H3 Prior to Db2 12 data pages were sequentially formatted based on table space (absolute page number), not based n each data partition. Db2 12 now offers data page formatting with partition of a partition by range table space. This new format extends the RID (record ID) from five bytes to seven.
Page 17: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

CREATE TABLESPACE ChangesCREATE TABLESPACE

PAGENUM ABSOLUTE | RELATIVE –PBR onlyDSSIZE 1g – 1024gPARTITION integer DSSIZE 1g – 1024g

Yes, DSSIZE can be at the partition level IF you use RPN!

Presenter
Presentation Notes
H3 With Db2 12 you can now select the either absolute or relative page numbering for your partitioned by range table space. As mentioned earlier, data set size has been increased to 1TB. For MEMBER CLUSTER YES table spaces you can use the new fast insert algorithm value 2. For all other tablespace use the value 0 to use the ZPARM (DEFAULT_INSERT_ALGORITHM) setting or the value 1 for basic insert algorithm. For UTS, MEMBER CLUSTER(with or without APPEND) table spaces Db2 12 can use an advanced new insert algorithm to streamline space search and avoid contention on space map pages for data sharing environments.
Page 18: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

NUMPARTS Limitations for Absolute

Assumes 5 byte RID using VSAM EA

Source: Db2 12 SQL Reference Guide

Presenter
Presentation Notes
H3 With Db2 12 you can now select the either absolute or relative page numbering for your partitioned by range table space. As mentioned earlier, data set size has been increased to 1TB. For MEMBER CLUSTER YES table spaces you can use the new fast insert algorithm value 2. For all other tablespace use the value 0 to use the ZPARM (DEFAULT_INSERT_ALGORITHM) setting or the value 1 for basic insert algorithm. For UTS, MEMBER CLUSTER(with or without APPEND) table spaces Db2 12 can use an advanced new insert algorithm to streamline space search and avoid contention on space map pages for data sharing environments.
Page 19: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

Example: Absolute Page Numbering

Default controlled by zParm PAGESET_PAGENUM

Presenter
Presentation Notes
H3 With Db2 12 you can now select the either absolute or relative page numbering for your partitioned by range table space. As mentioned earlier, data set size has been increased to 1TB. For MEMBER CLUSTER YES table spaces you can use the new fast insert algorithm value 2. For all other tablespace use the value 0 to use the ZPARM (DEFAULT_INSERT_ALGORITHM) setting or the value 1 for basic insert algorithm. For UTS, MEMBER CLUSTER(with or without APPEND) table spaces Db2 12 can use an advanced new insert algorithm to streamline space search and avoid contention on space map pages for data sharing environments.
Page 20: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

Example: Absolute Page Numbering

Presenter
Presentation Notes
H3 With Db2 12 you can now select the either absolute or relative page numbering for your partitioned by range table space. As mentioned earlier, data set size has been increased to 1TB. For MEMBER CLUSTER YES table spaces you can use the new fast insert algorithm value 2. For all other tablespace use the value 0 to use the ZPARM (DEFAULT_INSERT_ALGORITHM) setting or the value 1 for basic insert algorithm. For UTS, MEMBER CLUSTER(with or without APPEND) table spaces Db2 12 can use an advanced new insert algorithm to streamline space search and avoid contention on space map pages for data sharing environments.
Page 21: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

Example: Absolute Page Numbering

262,144 * 4 = 1,048,576k

In other words….

1G

Presenter
Presentation Notes
H3 With Db2 12 you can now select the either absolute or relative page numbering for your partitioned by range table space. As mentioned earlier, data set size has been increased to 1TB. For MEMBER CLUSTER YES table spaces you can use the new fast insert algorithm value 2. For all other tablespace use the value 0 to use the ZPARM (DEFAULT_INSERT_ALGORITHM) setting or the value 1 for basic insert algorithm. For UTS, MEMBER CLUSTER(with or without APPEND) table spaces Db2 12 can use an advanced new insert algorithm to streamline space search and avoid contention on space map pages for data sharing environments.
Page 22: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

Absolute Page Numbering Facts• The DSSIZE will cause Db2 to reserve the appropriate

number of page numbers in each partition

• Given the DSSIZE, Db2 can figure out which partition each page lives in by doing math

• Changing the DSSIZE results in renumbering every page after the first partition

Presenter
Presentation Notes
H3 The index characteristics for tables defined with relative page numbering has also been modified. The maximum DSSIZE or PIECE size has increased and the key entry in the index will contain a 7-byte RID.
Page 23: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

Converting to RPN

Presenter
Presentation Notes
H3 With Db2 12 you can now select the either absolute or relative page numbering for your partitioned by range table space. As mentioned earlier, data set size has been increased to 1TB. For MEMBER CLUSTER YES table spaces you can use the new fast insert algorithm value 2. For all other tablespace use the value 0 to use the ZPARM (DEFAULT_INSERT_ALGORITHM) setting or the value 1 for basic insert algorithm. For UTS, MEMBER CLUSTER(with or without APPEND) table spaces Db2 12 can use an advanced new insert algorithm to streamline space search and avoid contention on space map pages for data sharing environments.
Page 24: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

PBR RPN Facts• Altering DSSIZE becomes an immediate change (but

packages are still invalidated!)

• DSSIZE may be altered at the partition level

• Maximums – Max DSSIZE is 1Tb– Max Tablespace is 4Pb / 256 trillion rows

• Eliminates the limitations shown on slide 9

Presenter
Presentation Notes
H3 The index characteristics for tables defined with relative page numbering has also been modified. The maximum DSSIZE or PIECE size has increased and the key entry in the index will contain a 7-byte RID.
Page 25: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

PBR RPN Indexes• Partitioned Index (PI)

– Max partition size 1TB, DSSIZE keyword supported– Index partition size is independent from the tablespace– RID for index entry 7 bytes (2-byte part#, 4-byte page#, 1-

byte record-id– Index header records index part#, index page # does not

contain part#– SYSINDEXES & SYSINDEXPART PAGENUM setting

reflects “R” for relative page numbering• Non-Partitioned Index (NPI)

– RID for index entry 7 bytes (2-byte part#, 4-byte page#, 1-byte record-id

– SYSINDEXES & SYSINDEXPART PAGENUM setting reflects “A” for absolute page numbering

Presenter
Presentation Notes
H3 The index characteristics for tables defined with relative page numbering has also been modified. The maximum DSSIZE or PIECE size has increased and the key entry in the index will contain a 7-byte RID.
Page 26: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

PBR RPN Indexes

1 byte for pseudo-delete flag2 byte partition number4 byte page number1 byte row number

Presenter
Presentation Notes
H3 The index characteristics for tables defined with relative page numbering has also been modified. The maximum DSSIZE or PIECE size has increased and the key entry in the index will contain a 7-byte RID.
Page 27: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

zParms to Consider

• IX_TB_PART_CONV_EXCLUDE

• PREVENT_ALTERTB_LIMITKEY

• PREVENT_NEW_IXCTRL_PART

• DDL_MATERIALIZATION

Presenter
Presentation Notes
H3 The index characteristics for tables defined with relative page numbering has also been modified. The maximum DSSIZE or PIECE size has increased and the key entry in the index will contain a 7-byte RID.
Page 28: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

SQL to determine partition typeSELECT TS.DBNAME,

TS.NAME, CASE WHEN TS.TYPE = 'R' THEN 'PBR ENFORCED'

WHEN TS.TYPE = 'G' THEN 'PBG' WHEN TP.IXNAME = '' THEN 'TABLE CONTROLLED ENFORCED' WHEN TS.TYPE = 'L' THEN 'IX CONTROLLED ENFORCED' ELSE 'IX CONTROLLED NOT ENFORCED'

END AS TYPE, TS.PARTITIONS

FROM SYSIBM.SYSTABLESPACE TS JOIN (SELECT DISTINCT DBNAME, TSNAME, IXNAME

FROM SYSIBM.SYSTABLEPART) TP ON TS.DBNAME = TP.DBNAME

AND TS.NAME = TP.TSNAME WHERE TS.DBNAME NOT LIKE 'DSN%' -- NO CATALOG / DIRECTORY

-- MAY ADD OTHER EXCLUSIONS HERE-- (E.G. TOOLS, 3RD PARTY DBS)

AND TS.PARTITIONS > 0 -- ONLY PARTITIONED THINGS AND TS.TYPE IN ('','R','G','L') -- NO WEIRD TYPES

ORDER BY TS.DBNAME, TS.NAME

Use at your own risk

Page 29: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

APAR discussed with REORG conversion issues…

PH02571

Page 30: Partitioning… and Relative Page Numbering on Db2 12 for z ... Presentations...webinars and to download today’s slides. • This material comes from our Db2 12 migration course

David SimpsonThemis Training

[email protected]

@ThemisDave@ThemisTraining