Top Banner
1 IBM Software Group ® Copyright © 2004 IBM Corporation All rights reserved DB2 for z/OS V8 Overview: SQL and Network Computing William Favero Certified IT Software Specialist [email protected] IBM Software Group IBM Software Services for Data Management DB2 for z/OS Data Management Services Hearth of America DB2 User Group March 8, 2004 IBM Software Group | DB2 Information Management Software Copyright © 2004 IBM Corporation All rights reserved Slide 2 of 75 Legal Information The information contained in this presentation has not been submitted to any formal IBM review and is distributed on an "As Is" basis without any warranty either expressed or implied. The use of this information is a customer responsibility. The materials in this presentation are also subject to enhancements at some future date, a new release of DB2, or a Programming Temporary Fix (PTF) IBM MAY HAVE PATENTS OR PENDING PATENT APPLICATIONS COVERING SUBJECT MATTER IN THIS DOCUMENT. THE FURNISHING OF THIS DOCUMENT DOES NOT IMPLY GIVING LICENSE TO THESE PATENTS. TRADEMARKS: THE FOLLOWING TERMS ARE TRADEMARKS OR ® REGISTERED TRADEMARKS OF THE IBM CORPORATION IN THE UNITED STATES AND/OR OTHER COUNTRIES: AIX, AS/400, DATABASE 2, DB2, e-business logo, Enterprise Storage Server, ESCON, FICON, OS/390, OS/400, ES/9000, MVS/ESA, Netfinity, RISC, RISC SYSTEM/6000, iSeries, pSeries, xSeries, SYSTEM/390, IBM, Lotus, NOTES, WebSphere, z/Architecture, z/OS and zSeries. THE FOLLOWING TERMS ARE TRADEMARKS OR REGISTERED TRADEMARKS OF THE MICROSOFT CORPORATION IN THE UNITED STATES AND/OR OTHER COUNTRIES: MICROSOFT, WINDOWS, WINDOWS NT, ODBC and WINDOWS 95. For additional information see ibm.com/legal/copytrade.phtml Disclaimer and Trademarks
38
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: DB2

1

IBM Software Group

®

Copyright © 2004 IBM CorporationAll rights reserved

DB2 for z/OS V8 Overview:SQL and Network Computing

William FaveroCertified IT Software Specialist

[email protected]

IBM Software GroupIBM Software Services for Data ManagementDB2 for z/OS Data Management Services

Hearth of America DB2 User GroupMarch 8, 2004

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 2 of 75

Legal InformationThe information contained in this presentation has not been submitted to any formal IBM review and is distributed on an "As Is" basis without any warranty either expressed or implied. The use of this information is a customer responsibility.

The materials in this presentation are also subject to• enhancements at some future date, • a new release of DB2, or• a Programming Temporary Fix (PTF)

IBM MAY HAVE PATENTS OR PENDING PATENT APPLICATIONS COVERING SUBJECT MATTER IN THIS DOCUMENT. THE FURNISHING OF THIS DOCUMENT DOES NOT IMPLY GIVING LICENSE TO THESE PATENTS.

TRADEMARKS: THE FOLLOWING TERMS ARE TRADEMARKS OR ® REGISTERED TRADEMARKS OF THE IBM CORPORATION IN THE UNITED STATES AND/OR OTHER COUNTRIES: AIX, AS/400, DATABASE 2, DB2, e-business logo, Enterprise Storage Server, ESCON, FICON, OS/390, OS/400, ES/9000, MVS/ESA, Netfinity, RISC, RISC SYSTEM/6000, iSeries, pSeries,xSeries, SYSTEM/390, IBM, Lotus, NOTES, WebSphere, z/Architecture, z/OS and zSeries.

THE FOLLOWING TERMS ARE TRADEMARKS OR REGISTERED TRADEMARKS OF THE MICROSOFT CORPORATION IN THE UNITED STATES AND/OR OTHER COUNTRIES: MICROSOFT, WINDOWS, WINDOWS NT, ODBC and WINDOWS 95.

For additional information see ibm.com/legal/copytrade.phtml Disclaimer and Trademarks

Page 2: DB2

2

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 3 of 75

IBM Software GroupIBM Software Services for Data Management

DB2 for z/OS Data Management Services

For additional information, contact:Domenico (Minky) Valle

[email protected]

The DB2 for z/OS and OS/390 Software Services Team delivers specialized services to accelerate your implementation and to fully leverage and exploit your investment in DB2 technology on these

operating systems. Our consultants specialize in product installation and configuration and Version to Version migrations for DB2 for z/OS and

OS/390 Server. They are highly skilled in system administration,including high availability, security, and health checks, and also provide

expertise for utilities migration assessments and migration.We also have peer groups who specialize in DB2 on other platforms.

Copyright © 2004 IBM CorporationAll rights reserved

Who Are We?Who Are We?

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 4 of 75

You’re right…Way to many foils…

Again!!!!There is so much good stuff and I can never

decide what to leave out.

You’re right…Way to many foils…

again!!!!There is so much good V8

stuff, I just couldn’t decide what to leave out.

5 4 3 2 1

Page 3: DB2

3

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 5 of 75

DB2

DB2DB2DB2DB2

Reengineered for eReengineered for e--businessbusiness

Reengineering & Renaissance

Breaking through Limitations

SQL Function & DB2 family

Performance Enhancements

Continuous Availability

Indexing Improvements (Huge)

Very Large Database

WebSphere & Java

SAP, PeopleSoft & Siebel (50)

DB2 for z/OS Version 8 is…

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 6 of 75

Breaking through limitations – Virtual Storage 2GB – Table name sizes – VIEW & ALIAS names – Column name sizes – Partitions – SQL statement length – Index key size – Character Literals – Hex literal digits – Predicates

Image of Earth from Moon, Source: NASA (Public Domain)

Limits: DB2 for z/OS

231 to 264

18 to 12818 to 128

18 to 30 (128)

254 to 4096

32K to 2MB

255 to 32704

255 to 32704255 to 32704

255 to 2000

11 years

Page 4: DB2

4

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 7 of 75

Breaking through limitations ...

– Tables in a join 15 to 225

– Active logs 31 to 93

– Archive logs 1000 to 10,000

– Maximum table size 16 TB to 128 TB (partitioned, 32K page)

– Current optimization 8 to 128

– CURRENT PACKAGESET 18 to 128

– CURRENT PATH 254 to 2048

– SCHEMA 8 to 128

Image of Earth from Moon, Source: NASA (Public Domain)

Limits: DB2 for z/OS

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 8 of 75

– Common Table Expression– Recursion– Multi-row INSERT & FETCH– GET DIAGNOSTICS– INSERT within SELECT– IDENTITY Column enhancements

– SEQUENCES

– DYNAMIC SCROLLABLE CURSORS

– CURRENT PACKAGE PATH– SCALAR FULLSELECT– MATERIALIZED QUERY TABLES

– UNICODE SQL, MULTIPLE CCSIDs

– XML Publishing– ...

SQL and DB2 Family

What are the Top 10 things that impede cross platform porting

Page 5: DB2

5

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 9 of 75

Refer to table-name later in SQL

Allow in SELECT, CREATE VIEW, INSERT

WITH table-name [ column-list ] AS fullselect

For recursionƒfullselect of CTE refers to itself

ƒfullselect that does not refer to CTE

UNION ALL

fullselect that refers to CTE

Common Table Expression (CTE) and Recursion

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 10 of 75

WITH RPL (PART, SUBPART, QUANTITY) AS ( SELECT R.PART, R.SUBPART, R.QUANTITY FROM PARTLIST AS R WHERE R.PART = '01' UNION ALLSELECT C.PART, C.SUBPART, C.QUANTITY FROM RPL AS PARENT, PARTLIST AS C WHERE PARENT.SUBPART = C.PART )

SELECT DISTINCT PART, SUBPART, QUANTITY FROM RPL ORDER BY PART, SUBPART, QUANTITY;

Common Table Expression and Recursion

Example:

Page 6: DB2

6

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 11 of 75

Inserts multiple rows on one API callCan be ATOMIC or NOT ATOMICCan be static or dynamic SQLSignificant performance boost

INSERT INTO T1 FOR :hv ROWSVALUES( :ARRAY1, :ARRAY2) ATOMIC;

Multi-row INSERT

New Flavor

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 12 of 75

STMT = 'INSERT INTO T1 VALUES( ?, ?) FOR MULTIPLE ROWS ATOMIC';

PREPARE S1 FROM STMT;

EXECUTE S1 FOR :HV ROWSUSING :ARRAY1, :ARRAY2;

Multi-row INSERT - continued

Page 7: DB2

7

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 13 of 75

Returns multiple rows on one API crossing"wide" cursor with locks on multiple rowsSupports scrollable and non-scrollable, static and dynamic SQLSignificant performance boostDECLARE C1 CURSOR

WITH ROWSET POSITIONINGFOR SELECT COL1, COL2 FROM T1;

OPEN C1;FETCH FROM C1

FOR :hv ROWS INTO :ARRAY1, :ARRAY2;

Multi-row FETCH

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 14 of 75

Allows positioned UPDATE or DELETE to be used on a "wide" cursor

UPDATE T1 SET COL1='ABC'FOR CURSOR C1FOR ROW :hv OF ROWSET

Positioned UPDATE/DELETEof Multi-row FETCH

Page 8: DB2

8

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 15 of 75

Returns SQL error information ƒfor overall statementƒfor each condition (when multiple errors occur)

Supports SQL error message tokens greater than 70 bytes (SQLCA limitation)

INSERT INTO T1 FOR 5 ROWS VALUES(:ARRAY);GET DIAGNOSTICS :ERR_COUNT = NUMBER;

DO II = 1 TO ERR_COUNT;GET DIAGNOSTICS FOR CONDITION :II

:RC = RETURNED_SQLSTATE;END;

GET DIAGNOSTICS

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 16 of 75

Elegant technique for retrieving values created / modified by DB2 during INSERTƒidentity columns, sequence valuesƒuser-defined defaults, expressionsƒcolumns modified by triggersƒROWIDsƒINSERT with return or SELECT from INSERT

EXAMPLE:SELECT C1, C2, C3, C4, C5 FROM FINAL TABLE

( INSERT (C1, C5) INTO T1 VALUES('ABC', CURRENT DATE) );

INSERT within SELECT

Minimize trips across network

Page 9: DB2

9

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 17 of 75

ALTER support for Identity ColumnsƒGENERATED ALWAYS | BY DEFAULT

ƒRESTART WITH value

ƒINCREMENT BY

ƒMINVALUE

ƒMAXVALUE

ƒCYCLE | NO CYCLE

ƒCACHE | NO CACHE

ƒORDER | NO ORDER

Identity Column Improvements

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 18 of 75

Useful for porting Oracle applicationsNew SQL support:ƒCREATE SEQUENCEƒALTER SEQUENCE

–RESTART WITH value–INCREMENT BY–MINVALUE–MAXVALUE–CYCLE/NO CYCLE–CACHE/NO CACHE

ƒGRANT/REVOKE privileges for the sequence objectƒNEXT VALUE FOR EXPRESSIONƒPREVIOUS VALUE FOR EXPRESSION

Sequences

Page 10: DB2

10

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 19 of 75

Scrollable cursor that provides access to base table rather than work file -- allows viewing of updates by others. Defaults to single row fetch, so DDF applications should use:ƒmulti-row FETCHƒpositioned update/delete for multi-row FETCH

DECLARE C1 SENSITIVE DYNAMIC CURSORFOR SELECT C1, C2 FROM T1;

Dynamic Scrollable Cursors

Does not generate Workfile

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 20 of 75

Important for SQLJ and DDF apps–Less need for SET CURRENT PACKAGESET–Less network traffic for multiple PKLIST values–Easier to switch to/from JDBC and SQLJ–Better handling of nested stored procedure packages

Allows application to specify search list of package schemas (similar to PKLIST)

SET CURRENT PACKAGE PATH =ALPHA,BETA,PROD

CURRENT PACKAGE PATH

Page 11: DB2

11

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 21 of 75

Allows WebSphere persistence layer to minimize network traffic when using searched update and pessimistic locking.

PREPARE "SELECT C1, C2, C3 FROM T1 WHERE C1=? AND C2=? FOR READ ONLY KEEP UPDATE LOCKS"

OPEN

FETCH

CLOSE

UPDATE T1 SET C3=? WHERE C1=? AND C2=?;

DB2Server

x x x x x x x x x x x x x

x x x x x x x x x x x x xx x x x x x x x x x x x xx x x x x x x x x x x x x

READ ONLY USING UPDATE LOCKS

Could realize 50% network traffic reduction

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 22 of 75

Allows scalar fullselect where expressions were previously supported

SELECT C1 FROM T1 WHERE T2>(SELECT COL1 FROM T2 ...)

SELECT C1, (SELECT COL1 FROM T2...), C3

FROM T1

Scalar fullselect

Big for application vendors

Page 12: DB2

12

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 23 of 75

UPDATE NEW_PARTPRICE NSET PRICE =

CASEWHEN( (SELECT ONHAND#

FROM INVENTORYWHERE PART=N.PART) < 7 )

THEN 1.1 * PRICEWHEN( (SELECT ONHAND#

FROM INVENTORY WHERE PART=N.PART) > 2 )

THEN .8 * PRICEELSE PRICE

END;

Scalar fullselect - 2

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 24 of 75

Encourages index access for tables that have unpredictable cardinality Significant performance improvement for some SAP applications

CREATE TABLE XYZ ...... VOLATILE

VOLATILE Table Support

NPGTHRSH

Page 13: DB2

13

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 25 of 75

SELECT C1 FROM T1 WHEREC1 IS NOT DISTINCT FROM :hv;

SQL uses three-valued logic where any given comparison can return: TRUE, FALSE, or NULL

Applications can use IS NOT DISTINCT FROM to obtain a TRUE result instead of NULL when a comparing NULL values

C1 value :hv value RESULTNULL 'ABC' FALSENULL NULL TRUE'ABC' 'ABC' TRUE'ABC' NULL FALSE'ABC' 'DEF' FALSE

IS NOT DISTINCT FROM

More help for WebSphere

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 26 of 75

Bind option that controls when the Optimizer builds the access path information for dynamic SQL applications.ƒBy default, access path is calculated at PREPARE.ƒREOPT(ONCE)

–defers access path selection until OPEN–values of host variables on OPEN are used to calculate access path

–resulting access path is cached in the global prepare cache

REOPT(ONCE)

Page 14: DB2

14

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 27 of 75

EXPLAIN STMTCACHESTMTID=integerSTMTTOKEN=string

Enhancements to the EXPLAIN statement allow you to obtain EXPLAIN information for entries in the DB2 global prepare cache.Visual Explain is enhanced to exploit this new function.

EXPLAIN for global prepare cache

IFCID 316, 124 and some 173, 196 and 337 have statement id

Application program associates a statement token with a cached statement. The program can make this association with the RRSAF SET_ID function, or the sqleseti API.

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 28 of 75

XML value constructors: XMLELEMENT (xmlattributes), XMLFOREST,

XMLCONCAT, XMLAGG, XMLGEN

XML internaldata

XML Text Data

Relational Data

XML Data

DOMSAXXML2CLOB

Predicate

XML Value Constructors

XML Columns

SQL/XML - XML extensions to SQL

Page 15: DB2

15

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 29 of 75

New built-in functions for generating XMLƒXMLELEMENT generates XML element from argumentsƒXMLATTRIBUTES specify attributes for the XML element

within XMLELEMENTƒXMLFOREST creates forest of XML elements that share a

specific patternƒXMLCONCAT concatenates arguments to generate a

forest of XML elementsƒXMLAGG aggregate produces forest of XML elements

from a collection of XML elementsƒXML2CLOB converts transient XML data type into UTF-8

CLOB

Augment XML generation of XML Extender

XML Publishing Functions SQL/XML

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 30 of 75

SELECT XML2CLOB(

XMLELEMENT ( "Dept", XMLATTRIBUTES ( D.DEPTNO AS "deptno",

D.DEPTNAME AS "name" ), ( SELECT XMLAGG (

XMLELEMENT ( "Proj", XMLATTRIBUTES (P.PROJNO AS "projno",

P.PROJNAME AS "name"), ( SELECT XMLAGG (

XMLELEMENT ( "Emp", XMLATTRIBUTES (E.EMPNO as "empno"),

E.FIRSTNME || ' ' || E.LASTNAME )

) FROM DSN8810.EMPPROJACT EP,

DSN8810.EMP E WHERE EP.PROJNO = P.PROJNO AND

EP.EMPNO = E.EMPNO ) )

) FROM DSN8810.PROJ P WHERE P.DEPTNO = D.DEPTNO

) ) )

FROM DSN8810.DEPT D WHERE D.DEPTNO = 'D01';

Query:Result: (formatted for easy viewing)

<DeptDept deptno="D01" name="DEVELOPMENT CENTER"><ProjProj projno="AD3100" name="ADMIN SERVICES">

<EmpEmp empno="000010">CHRISTINE HAAS</Emp/Emp></Pro/Proj><ProjProj projno="MA2100" name="WELD LINE AUTOMATION">

<EmpEmp empno="000010">CHRISTINE HAAS</Emp/Emp><EmpEmp empno="000110">VINCENZO LUCCHESI</Emp/Emp>

</Proj/Proj></Dept/Dept>

Query Example - Demo Query 1

Page 16: DB2

16

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 31 of 75

Eliminates the need to explicitly declare a ROWID column in tables that include LOBs

DB2 will generate a "hidden" ROWID column, which is not visible on SELECT *

Simplifies porting of LOB applications from other platforms

Transparent ROWID column

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 32 of 75

Declared Temporary Table improvement that causes temp table to be dropped automatically at commit:ƒwhen no HELD cursors are open against the

temp table

Significant improvement for DDF threads that use CMTSTAT=INACTIVEƒstops declared temp tables from preventing

thread from going INACTIVE

ON COMMIT DROP enhancementProblem: Declared Temp Table has to be explicitly dropped.

Page 17: DB2

17

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 33 of 75

SQL statements can now be up to 2M bytes in length

Parse tree has been completely rearchitected to reduce SQLCODE -101 scenarios due to SQL statement length

Important for SQL Procedure Language applications

SQL statements up to 2M bytes

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 34 of 75

RETURN statement

SIGNAL/RESIGNAL support

CREATE PROCEDURE up to 2M bytes

Integrated debugger (just shipped with Unix and Windows)

GET DIAGNOSTICS for all fields in SQLCA

Get values from RETURN

ITERATE statement

SQL Procedure Language

Page 18: DB2

18

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 35 of 75

GROUP BY expression–SELECT A+B,C FROM T ORDER BY A+B GROUP BY A+B

Qualified column names on SET clause–UPDATE T1 SET T1.COL1...

Qualified column names on INSERT–INSERT T1.COL1 INTO T1 VALUES...

Multiple DISTINCT clauses–SELECT COUNT(DISTINCT(A1)), AVG(DISTINCT(A2)) FROM T2

Other SQL Improvements

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 36 of 75

Table has column defined AS SECURITY LABEL • Each row value has a specific security label• Get security labels from RACF • Save in rows for INSERT, UPDATE, LOAD, ...

Check for each new seclabel value accessed • If access is allowed, then normal access• If access is not allowed, data not returned

Runtime user to data checkingSeclabel values are cached to minimize cpuRequires z/OS V1R5 and Security Server (RACF)

Row Granularity Multilevel Security

Page 19: DB2

19

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 37 of 75

Multilevel Security by Row ...

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 38 of 75

Multilevel Security by Row

Page 20: DB2

20

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 39 of 75

Client information for this connectionProvided by sqleseti, Java, RRS SIGNON

CLIENT ACCTNG accounting string CLIENT APPLNAME value of application nameCLIENT USERID client user ID CLIENT WRKSTNNAME workstation name

New Special Registers

Could be helpful for WebSphere

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 40 of 75

Variables set by DB2, connection or signon exit

Built in function to retrieve value for a variable

Use function in views, triggers, stored procedures & constraints to enforce security policy

Can have more general, flexible access checks

Multiple columns, AND/OR logic, ...

Complements other security mechanisms

CREATE VIEW V1 AS SELECT * FROM T1 WHERE COL5 = GETVARIABLE(SYSIBM.SECLABEL);

Session Variables

Page 21: DB2

21

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 41 of 75

ENCRYPT: encrypt a column in a table with a user-provided encryption passwordƒENCRYPTION PASSWORD special register

DECRYPT_BIN

DECRYPT_CHAR

GET_HINT: obtain hint to help remember ENCRYPTION PASSWORD

GENERATE_UNIQUE creates a CHAR(13) FOR BIT DATA value that is unique across the sysplex

New Built-in Functions

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 42 of 75

Stored Procedures improvements–WLM management of TCBs

–TCBs are added/removed based on WLM recommendations

–MAX FAILURES on CREATE PROCEDURE

–Integrated debugger for SQL Procedure Language

–COMPJAVA (HPJ) is replaced by interpretive Java

RRS support for CAF migration–CAF-style "implicit" connection support

Stored Procedures & RRS

Page 22: DB2

22

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 43 of 75

Sometimes called Summary Tables, Automatic Summary Tables, Automatic Materialized Query Tables, Materialized Views, ...

Optimizer can rewrite queries to access MQT instead of base table or view

Pre-computed information, very significant performance improvement

Managed by user or system (SQL REFRESH)

Automatic rewrite or manual

Informational Referential Integrity

Materialized Query Tables

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 44 of 75

transitem(LLL)

trans (LL)

Location hierarchyprodline (s)

pgroup (s)

acct (L) cust (L)

year

N : 1 N : 1N : 1

(S)

WarehouseDB

Join

Aggregation

Join

Aggregation

Q11,Q12, ... Q21,Q22, ...

Compute Many Times

Join

Aggregation

Join

AggregationJoin

Aggregation

Join

Aggregation

s: Each Query Re-Computes!Without Materialized Query Table

Page 23: DB2

23

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 45 of 75

Join

Aggregation

Join

Aggregation

transitem(LLL)

trans (LL)

Location hierarchyprodline (s)

pgroup (s)

acct (L) cust (L)

year

N : 1 N : 1N : 1

(S)

WarehouseDB

Q11,Q12, ... Q21,Q22, ...

MQT MQT

Precompute Once

Reuse Many Times

Redundant ComputationWith Materialized Query Tables: Avoid

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 46 of 75

Optimizer improvement that addresses the same requirement as Hash JoinƒACCESS_TYPE='T' in PLAN tableƒuses sparse index to process the contents of

work fileƒImproves upon APAR PQ61458 on V7

Star Join Sparse Indexes

Page 24: DB2

24

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 47 of 75

Optimizer is enhanced to use parallel sort for multiple tables when cost tradeoff is advantageous

Parallel Sort

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 48 of 75

AFTER TRIGGER work files are eliminated when old/new transition variables are returned for 3 rows or less

Very significant performance enhancement when few or no triggers fired

Trigger Performance

Page 25: DB2

25

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 49 of 75

CARDINALITY clause

ƒSELECT * FROM TABLE(TABUDF(C2) CARDINALITY 30) AS ABC

Performance improvement to move data between table functions and DB2 using block data movement

Table Function Improvements

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 50 of 75

Non-uniform distribution statistics on non-index columns

RUNSTATS improvement that allows optimizer to consider non-uniform distribution statistics on columns that aren't part of an index

Current technique is separate DSTATS program

Significant performance improvement

RUNSTATS with UPDATE NONE REPORT NO

RUNSTATS Distribution Stats Enhanced

Page 26: DB2

26

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 51 of 75

DB2 is enhanced to allow index access when host variable & target column are not the same data type

Deals with programming languages that don't support the full range of SQL data types

ƒC/C++ has no DECIMAL data type

ƒJava has no fixed length CHAR data type

ƒetc.

Significant performance improvement for many applications

Simplifies application programmer & DBA tasks

Stage 1 Indexable Unlike-types

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 52 of 75

CONNECT with USERID/PASSWORD

Unicode in SQL or data

ODBC Improvements for z/OS USS users

Page 27: DB2

27

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 53 of 75

Significant improvements to Visual Explain tool:ƒMuch more detailed information about access pathƒMore statistical details for each node in the graphƒXML document describing query access path selectedƒEasier collection of information to send for help

Intelligent Visual Explain

Was SMALLTALK, now JAVA

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 54 of 75

Build, test & deploy Java & SQL Stored Procedures

Build SQL Table functions

Extract data from XML documents

DB2 Connect V8 Development Center

Page 28: DB2

28

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 55 of 75

BSDS for each DB2 member can include multiple LOCATION names for the DB2 serverEach LOCATION name is registered with WLM separately for WLM sysplex workload balancing informationUseful for:ƒconsolidating DB2 systemsƒworkload routing within sysplex

DB2LOC1

DB2LOC2

DB2LOCADB2 ClientCONNECT TO

DB2LOCACONNECT TO

DB2LOC1

Server LOCATION Aliases

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 56 of 75

CDB is enhanced so that the client LOCATION name does not have to match the remote server's LOCATION name

DB2 for z/OS Client

CONNECT TO LOC1

CONNECT TO LOC2

LOCATION ALIAS LINKNAMELOC1 PROD LOC1LINKLOC2 PROD LOC2LINK

SYSIBM.LOCATIONSDB2 LOCATION=PROD

DB2 LOCATION=PROD

Regional office #1

Regional office #2

Client LOCATION Aliases

Page 29: DB2

29

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 57 of 75

DDF automatically uses multi-row FETCH for read-only queriesReduces CPU cost of read-only queries significantly

DB2 Client

SELECT * FROM ...

DB2 for OS/390 V7

DB2 for z/OS V8

xxxDBM1xxxDISTOPENFETCHFETCHFETCHFETCH

xxxDISTOPENFETCH

xxxDBM1

Build all rowsfor buffer onone APIcrossing

DDF Block FETCH

32K buffer

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 58 of 75

–Encrypt data flowing on the wire

– Careful, watch out for overhead

–CDB improvements for data sharing member routing for TCP/IP

–Extended DESCRIBE for CLI & Java

–LOB streaming

–SQL Cancel – ODBC/JDBC/CLI SQL CANCEL cancels SQL not connection

–Auto-close for WITH HOLD cursors

– CPU reduction

–Reduced TCP/IP CPU cost

IMS IMS IMSIMS CICSWeb

Sphere

Strategic Open AccessEnterprise Server

DB2

Network Computing Improvements

Page 30: DB2

30

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 59 of 75

Type 2 and Type 4 driver2 - Local API (RRSAF) and 4 -TCP/IP using DDF

ƒUpdated to support JDBC/SQLJ 3.0 standard– savepoint support– connection pooling improvements– reusing PreparedStatements– standard connection pool properties– reset of server connection at getConnection– new metadata for PreparedStatements– return autogenerated keys– multiple open ResultSets for a single stored procedure– WITH HOLD cursors– improved BLOB/CLOB support

Key Java Improvements

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 60 of 75

New Statistics valuesƒQ3STHWIB - IDBACK high water mark

ƒQ3STHWIF - IDFORE high water mark

ƒQ3STHWCT - CTHREAD high water mark

ƒQLSTHWMD - MAXDBAT high water mark

ƒQLSTHWMC - CONDBAT high water mark

SQL counts added to package level accounting

Package information added to deadlock and timeout records (0172, 0196)

Enhanced IFC records

Page 31: DB2

31

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 61 of 75

DB2 Catalog is now stored in Unicode

–allows SQL to contain Unicode literals and names

–provides better integration with Java and Microsoft technologies

New built-in string functions for character-based string operations (SUBSTRING, CHAR_LENGTH, etc.)

Important to many ISVs

Enhanced Unicode Support

Clients use UNICODE

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 62 of 75

A single SQL statement can now intermix EBCDIC, ASCII and Unicode tables and host variables

Unlike host variables are translated to column CCSID

Unlike column CCSIDs are "promoted" to UnicodeƒMay require query to be materialized/sorted

SELECT T1.COL_EBCDIC ||T2.COL_ASCII ||T3.COL_UNICODE FROM T1,T2,T3 ...;

Multiple CCSIDs per statement

ie: Join to Catalog data

Page 32: DB2

32

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 63 of 75

–DB2 & IRLM are 64-bit exclusive–Base Pre-requisites:

–zSeries z800, z900 or later–z/OS R3 or above

–Major catalog changes:–Long fields–Unicode

–Migration Process:–From Version 7 only–Multi-step process–V7 and V8 data sharing coexistence supported in compatibility mode only

Building the e-infrastructureContinuous Availability Systems Management, SecurityPerformance/CapacityConnectivityProductivitySynergy: DB2 family & zSeries

= Total Cost of Ownership

Ready forReady for

DB2 for z/OS Version 8

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 64 of 75

64 Bit Means

zSeries, z/OS, z/Architecture & large real storageReal storage for performanceƒV6 data space advantages

–zSeries & 64 bit addressing64 bit virtual (used in V8)ƒz/OS 64-bit Virtual Storage

RoadmapƒImprove scalability, availability,

easeƒMove above the barƒHiperpool/dataspace no longer

needed

2 GB

DBM116 EB

Buffer pool

0

The bar

16M - Line

EDM poolRID poolSort poolComp dict

Page 33: DB2

33

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 65 of 75

64-bit Storage Usage

Freeing up storage in 31-bit area will allow:More concurrent threads

Higher transaction throughput

Hiperpools and data spaces are goneCan have a total of 1TB for buffer pools*Locks are moved above 2GB barDBDs get their own EDM cache above the bar

* Beware of over allocating buffer pools, need REAL to back them

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 66 of 75

Longer names (128 byte varchar Unicode)

ƒtable, view & alias

ƒcolumn (30)

ƒschema

ƒUDF, stored procedures, triggers, package

Some page sizes greater than 4K

ƒ4K, 8K, 16K, 32K pages in DB2 catalog

Indexes longer than 255 bytes

Contains Unicode data

DB2 Catalog V8

Page 34: DB2

34

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 67 of 75

Test with New Install & Migrate

Apply the Fallback SPE to all members

ƒStart all members at SPE level

Migrate to new release without new function (COMPAT Mode)

Enable New Function Mode

ƒThen in New Function Mode

Four step process for Migration

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 68 of 75

More robust migration processƒFewer migration & fallback errors

ƒAll customers apply the Fallback SPE

Customer control for migration process & timing for using new function

Reduced risk of problems in Fallback SPEƒReduced number of modules, fewer changes

Improved ability to deliver new function, while still supporting fallback & coexistence

Tighter Migration Customer Value

Page 35: DB2

35

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 69 of 75

ƒ Use valid host variable declaration for PREPARETrying once again

ƒ Valid VCAT required no x.y (V5 and up)ƒ No COMPJAVA, Use JITƒ CREATE, ALTER PROCEDURE WLM ONLYƒ Unicode used in DB2 catalog, changes order

–SQL statements, translation, lengths may change, Instrumentation option

ƒ Java Universal Client, SQLJ processƒ Index padding controlled by subsystem parameterƒ REORG SORTDATA & SORTKEYS defaultƒ REORG Implicit clustering index ƒ No SQL FLAGGER

Primary Incompatible Changes in V8

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 70 of 75

IBM DB2 Universal Database SQL Referencefor Cross Platform Development

A new SQL Reference book for the DB2 UDB family, not just one platform.http://www7b.software.ibm.com/dmdd/library/techarticle/0206sqlref/0206sqlref.html

z/OS OS/390 OS/400 AIX HP-UX Solaris Linux Windows

DB2 Family SQL Reference

Page 36: DB2

36

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 71 of 75

Migrate to DB2 for z/OS & OS/390 Version 7Migrate to z/OS V1R3 or laterƒz/OS V1R3 requires WLM goal modeƒSome functions require z/OS V1R4, V1R5

zSeries, z/Architecture 64 bit modeCOBOL: Migrate to IBM COBOL V2 or V3ƒNo OS/VS COBOL or VS COBOL IIƒCan run old COBOL load modules under LE

IMS V7CICS TS V1.3, V2.2... more to come

Getting ready for V8

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 72 of 75

Building the eBuilding the e--infrastructureinfrastructure

SQL OLTP Leadership: Multirow Fetch & Insert, Select within Insert, Dynamic Scrollable Cursors, ...

Breaking your limits: storage, name lengths, SQL statements, partitions, loggingPerformance Enhancements: MQTs, index useDatabase changes without an outage: add partition, rotate partitions, alter cluster

& Java Integration

DB2 for z/OS Version 8 is

Page 37: DB2

37

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 73 of 75

Thank You

for Attending!

Willie

IBM Certified Solutions Experts:DB2 V7 Database Administration for OS/390DB2 Application Development

IBM Certified Database Administrator – DB2 UDB version 8 for z/OS

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 74 of 75

Page 38: DB2

38

IBM Software Group | DB2 Information Management Software

Copyright © 2004 IBM CorporationAll rights reserved Slide 75 of 75

The End