DB2 f iDB2 for iUpdate Trends and DirectionsUpdate, Trends and DirectionsMike CainIBM DB2 f i C f E llIBM DB2 for i Center of ExcellenceRochester, MN [email protected]
© 2008 IBM Corporation
DB2 Familyz/OS, i, Linux/Unix/Windows (LUW)
Managing family compatibility Information Management Architecture Board SQL Language CouncilSQL Language Council
Common design, algorithms, and code sharing where possible
Two Types of Differences Short term differences based on different release dates and
different customer priorities Long term differences based on Operating System differences Long term differences based on Operating System differences
(Isolated to database configuration, management, and utilities)
IBM DB2 Cross Platform Reference http://www.ibm.com/developerworks/db2/library/techarticle/db2co
mmon/
© 2008 IBM Corporation
DB2 for i – How is it different from other DB2sDB2 for i How is it different from other DB2s
Not a separate product – integrated into System i
Not a separate chargeNot a separate charge
Release number is not the same
Native and SQL InterfacesNative and SQL Interfaces
Easier to use and maintain
Management GUI is S stem i Na igatorManagement GUI is System i Navigator
© 2008 IBM Corporation
DB2 for i Major Strengths
Openness and standards Interoperability Performance
l b l Scalability Security
N ti l l t National language support Ease of use and management
© 2008 IBM Corporation
An Open DatabaseAn Open Database
ANS, ISO, FIPS, and JIS SQL StandardANS, ISO, FIPS, and JIS SQL StandardOpen Group - Distributed Relational Database ArchitectureOpen Group - XA Resource Manager APIs ANS and ISO SQL Call Level InterfaceANS d ISO SQL d E t l P d ANS and ISO SQL and External Procedures UCS-2, UTF-8, UTF-16 (Unicode - ISO 10646)ODBCJDBCOLE and ADO.NETUS Government C2 SecurityEuro Character support
Oracle 10g
ISO/ANS SQL Standard - Core
Euro Character support...
DB2 for z/OS
Microsoft SQL Server 2005
DB2 for i
DB2 for LUW
© 2008 IBM Corporation
0 10 20 30 40 50 60 70 80 90
Interoperability – DRDAp y
DB2 for z/OS DB2 for z/O SDB2 for VM and VSEDB2 for VM and VSE
DB2 for iDB2 for AIXDB2 for HP-UX DB2 for Sun SolarisDB2 for W indows
DB2 for VM and VSEDB2 for iDB2 for AIXDB2 for HP-UX DB2 for Sun SolarisDB2 for W indowsDB2 f Li i
DDM/DRDAP l
DDM/DRDA P t lDB2 for Liniux
Inform ix Txaction
Attachm ateGrandview
DB2 for Lin iux
Server and Client
ProtocolsProtocols
HiT SoftwareMicrosoftOracleRocketStarQuestSybase/MDI
FileTek, Inc.G randview P latinum Technology Inc. XDB System s
W all DataXDB System s
Oracle and Microsoft do not
Application Server (Data)support DRDA as a Server
© 2008 IBM Corporation
System i - Logical Partitioning (LPAR)System i Logical Partitioning (LPAR)
DB2 for i DB2 for LinuxDB2 for i DB2 for AIX DB2 for Windows
JDBC JDBC JDBC JDBCJDBCCLI
DRDADDM
JDBCODBCDRDA
JDBCDRDA
JDBCODBC
OLE DB.NETDRDA
Power Server
LPAR LPAR LPAR LPAR IXS/IXA
© 2008 IBM Corporation
DB2 for i: Strategy and GoalsDB2 for i: Strategy and Goals
Preserve your development investments
Get more out of the OS and DBMS
Ease of use, ease of management
Support data-centric programming and information pp p g gmanagement
SQL is the strategic language and interface for DDL, DML and PSM
SQL is the strategic language and interface
© 2008 IBM Corporation
On the WebOn the Web
DB2 for i Home Page http://www.ibm.com/systems/i/software/db2/
System i Advantages http://www-1.ibm.com/systems/i/advantages/
System i Access y http://www.ibm.com/systems/i/access/
DB2 for i Java http://www.ibm.com/systems/i/software/db2/javadb2.html
Education and PublicationsEducation and Publications http://www.ibm.com/systems/i/ - Click on Education
http://publib.boulder.ibm.com/iseries/
Newsgroups and Forums comp.databases.ibm-db2comp.databases.ibm db2 comp.sys.ibm.as400.misc groups
Questions can be sent to: [email protected]
© 2008 IBM Corporation
DB2® for i 6.1 Enhancements
© 2008 IBM Corporation
6 1 SQL Enhancements 6.1 SQL Enhancements
Queries Schema statements (DDL)Queries Grouping Sets and Super groups VALUES in FROM INSERT in FROM
Schema statements (DDL) Decimal Float Expressions in Indexes ROW CHANGE TIMESTAMP
Data Change statements (DML)E t d d I di t V i bl V l
Full Outer Join Hidden Columns NCHAR, NVARCHAR, and NCLOB ALTER FUNCTION
Ignore unsupported syntax Extended Indicator Variable Values Skip Locked Data
S l F ti
Ignore unsupported syntax SYSTOOLS/SYSIBMADM FOR EACH STATEMENT INSTEAD OF trigger
Mi llScalar Functions TIMESTAMP_FORMAT and
VARCHAR_FORMAT enhancements LOCATE function fix (PTF)
Miscellaneous Statistics catalog views (V5R4 PTF) CLIENT special registers FOR BIT DATA and binary compatibility
ENCRYPT_AES
ASCII (UTF-8 result)
MONTHS_BETWEEN, ROUND TIMESTAMP and
FOR BIT DATA and binary compatibility Output parameter support for
heterogeneous CALL BX literals
© 2008 IBM Corporation
ROUND_TIMESTAMP, and TRUNC_TIMESTAMP
GROUPING SETSGROUPING SETS
Produce the result based on two different grouping sets of rows from the SALES table.
SELECT WEEK(SALES_DATE) AS WEEK,DAYOFWEEK(SALES_DATE) AS DAY_WEEK,SALES_PERSON,SUM(SALES) AS UNITS SOLD
Prior to this support you would have to run multiple queries
SUM(SALES) AS UNITS_SOLDFROM SALESWHERE WEEK(SALES_DATE) = 13GROUP BY GROUPING SETS( (WEEK(SALES_DATE), SALES_PERSON),
(DAYOFWEEK(SALES DATE) SALES PERSON) )
CUBE and ROLLUP included in this support
(DAYOFWEEK(SALES_DATE), SALES_PERSON) )ORDER BY WEEK, DAY_WEEK, SALES_PERSON
The rows with WEEK 13 are from the first grouping set and the other rows are from the second grouping set.
© 2008 IBM Corporation
VALUES in FROMVALUES in FROM
Form the cross product of this table ″X″ with the SALES table. This add columns ″R1″ and ″R2″ to every row add columns R1 and R2 to every row.
SELECT R1, R2, WEEK(SALES_DATE) AS WEEK, DAYOFWEEK(SALES DATE) AS DAY WEEK
Equivalent to creating a temporary table, inserting rows, and then
DAYOFWEEK(SALES_DATE) AS DAY_WEEK,MONTH(SALES_DATE) AS MONTH, REGION, SALES AS UNITS_SOLD
FROM SALES ( VALUES(‘GROUP 1’ ’GROUP 2’) ) AS X (R1 R2)
using the temporary table in the query
FROM SALES, ( VALUES( GROUP 1 , GROUP 2 ) ) AS X (R1,R2)
© 2008 IBM Corporation
INSERT in FROMINSERT in FROMInsert customer numbers into the new SALES table that has an identity column and return the
generated values.
CREATE TABLE SALES2 (SALES_ID INTEGER AS IDENTITY, SALES_DATE DATE DEFAULT CURRENT DATE, SALES_PERSON FOR COLUMN SALES00001 VARCHAR(15) ,
No easy way to return generated values prior to this supportREGION VARCHAR(15),
SALES INTEGER );
SELECT *
to this support
FROM FINAL TABLE ( INSERT INTO SALES2 ( SALES_DATE, SALES_PERSON, REGION, SALES )SELECT * FROM SALES )
ORDER BY INPUT SEQUENCE;
© 2008 IBM Corporation
EXTENDED INDICATOR VALUESEXTENDED INDICATOR VALUES
Get the next row in the transaction table for update and skip any rows that are currently locked.
EXEC SQL DECLARE x CURSOR WITH EXTENDED INDICATORS FOR SELECT * FROM corpdata.transaction;
EXEC SQL OPEN x; EXEC SQL FETCH INTO i d
Prior to this support you would have to update all columns or would have to
diff t UPDATEEXEC SQL FETCH x INTO :trans:inds; … inds1 = -5; EXEC SQL UPDATE corpdata.transaction
SET TRANSOPERATION t i d 1
use a different UPDATE statement for every combination of columns you wanted to update.SET TRANSOPERATION = :top:inds1,
CUSTOMERID = :cid:inds2, TRANSINFO = :top:inds3
WHERE CURRENT OF x; EXEC SQL CLOSE x;
y p
Applies to UPDATE and INSERT VALUES, also allowed on PREPARE.EXEC SQL CLOSE x;
Indicator Values Meaning0 Value is provided0 Value is provided-1, -2, -3, -4, and -6 Null value-5 Default value-7 Column is treated as if it had not been
specified in the statement
© 2008 IBM Corporation
specified in the statement.
DECIMAL FLOATDECIMAL FLOAT
New numeric data type with attributes of both decimal and floating point – IEEE 754R
CREATE TABLE mjatst.table1 (c1 DECFLOAT(16)
New numeric data type ith t d dc1 DECFLOAT(16) ,
c2 DECFLOAT(34) );with extended accuracy and performance.
DECFLOAT(16) DECFLOAT(34)
Guarantees 16 digits of precision Guarantees 34 digits of precisionGuarantees 16 digits of precision Guarantees 34 digits of precision
8 bytes long 16 bytes long
Exponent range 10-383 to 10384 Exponent range 10-6143 to 106144
Infinity – NaN – SNaN special values Infinity – NaN – SNaN special values
© 2008 IBM Corporation
Expressions and Selection in IndexesExpressions and Selection in Indexes
CREATE INDEX mjatst index1 ON mjatst table1CREATE INDEX mjatst.index1 ON mjatst.table1(c1*c2) ;
CREATE INDEX mjatst.index2 ON mjatst.table1(c1*c2)
WHERE c1 > 14;
SQL create index enhancements for key expressions and sparseexpressions and sparse indexes.
SQE can use indexes with expressions butwith expressions, but does not provide support for sparse indexes yet
© 2008 IBM Corporation
ROW CHANGE TIMESTAMPROW CHANGE TIMESTAMPCREATE TABLE mjatst.table4 (
c1 INT,c2 VARCHAR(20), New standard way of c3 TIMESTAMP NOT NULL IMPLICITLY HIDDEN
FOR EACH ROW ON UPDATE AS ROW CHANGE TIMESTAMP );
INSERT INTO mjatst.table4 (c1, c2) VALUES
(1, ‘FIRST’), (2, ‘SECOND’), (3, ‘THIRD’);
updating a timestamp column on any update or insert.
(1, FIRST ), (2, SECOND ), (3, THIRD ); SELECT c1, c2, c3 FROM mjatst.table4;
UPDATE mjatst.table4 SET c1 = 4, c2 = ‘FOURTH’ WHERE C1 = 1;SELECT c1, c2, c3 FROM mjatst.table4;
© 2008 IBM Corporation
Hidden Columns Hidden Columns CREATE TABLE mjatst.table3 (
c1 INT,c2 VARCHAR(20),c2 VARCHAR(20),c3 TIMESTAMP IMPLICITLY HIDDEN;
INSERT INTO mjatst.table3 (c1, c2, c3) VALUES
(1, ‘FIRST’, CURRENT TIMESTAMP),
(2 ‘SECOND’ CURRENT TIMESTAMP) New standard way of “hidi ” l h(2, SECOND , CURRENT TIMESTAMP),
(3, ‘THIRD’, CURRENT TIMESTAMP); SELECT * FROM mjatst.table3;
“hiding” a column when querying all columns.
SELECT c1, c2, c3 FROM mjatst.table3;
© 2008 IBM Corporation
FULL OUTER JOINFULL OUTER JOIN
J i th t bl th PROD# l t t t bl f ll t d d t Join the tables on the PROD# column to get a table of all parts and products, showing the supplier information, if any.
SELECT PART, SUPPLIER
Equivalent to UNION ALL of LEFT OUTER SUPPLIER,
PARTS.PROD#, PRODUCT
FROM PARTS FULL OUTER JOIN PRODUCTS ON PARTS PROD# = PRODUCTS PROD#;
JOIN and RIGHT EXCEPTION JOIN
FULL OUTER JOIN PRODUCTS ON PARTS.PROD# = PRODUCTS.PROD#;
© 2008 IBM Corporation
COMMENT and LABEL EnhancementsCOMMENT and LABEL Enhancements
COMMENT ON CONSTRAINT mjatst.cst IS ‘A long description up to 2000 bytes’;
LABEL ON CONSTRAINT mjatst.cst IS ‘A short description up to 50 bytes’;
LABEL ON FUNCTION mjatst.fun IS ‘A short description up to 50 bytes’;
LABEL ON PROCEDURE mjatst.prc IS ‘A short description up to 50 bytes’;
LABEL ON ROUTINE mjatst.rtn IS ‘A short description up to 50 bytes’;
LABEL ON TRIGGER mjatst.trg IS ‘A short description up to 50 bytes’;
LABEL ON TYPE mjatst.typ IS ‘A short description up to 50 bytes’;
Add descriptive information to constraints, routines, and triggers.
© 2008 IBM Corporation
SKIP LOCKED DATASKIP LOCKED DATA
Get the next row in the transaction table for update and skip any rows that are currently locked.
DECLARE X CURSOR FOR SELECT * FROM transaction WITH CSSKIP LOCKED DATA
OPEN X;
Prior to this support you would have waited on locks
OPEN X; FETCH X INTO …
© 2008 IBM Corporation
SQL Enhancements – Scalar FunctionsSQL Enhancements Scalar Functions
Datetime Functions
TIMESTAMP_FORMAT Returns a timestamp from a character string representation of a timestamp according to the specified format of the string.
VARCHAR FORMAT R t h t t i t ti f ti t ith th
Datetime Functions
VARCHAR_FORMAT Returns a character string representation of a timestamp, with the string in a specified format
MONTHS_BETWEEN Returns an estimate of the number of months between two dates
ROUND TIMESTAMP Returns a timestamp rounded to the specified unit ROUND_TIMESTAMP Returns a timestamp rounded to the specified unit.
TRUNC_TIMESTAMP Returns a timestamp truncated to the specified unit.
String Functions
ASCII Returns the ASCII code value of the leftmost character of the argument as an integer
CHR R t th h t th t h th ASCII d l ifi d b th
g
CHR Returns the character that has the ASCII code value specified by the argument.
ENCRYPT_AES Encrypts a string using the AES encryption algorithm
© 2008 IBM Corporation
NCHAR NVARCHAR NCLOBNCHAR, NVARCHAR, NCLOB
CREATE TABLE mjatst.table2 (c1 NCHAR(10),c2 NVARCHAR(20),c3 NCLOB(1M) );
New standard way of specifying UTF-16.
NATIONAL CHARACTER NATIONAL CHARNCHAR NATIONAL CHARACTER (n)
GRAPHIC (1) CCSID 1200
GRAPHIC (n) CCSID 1200NATIONAL CHAR (n)NCHAR (n)
NATIONAL CHARACTER VARYING (n)NATIONAL CHAR VARYING (n)
VARGRAPHIC (n) CCSID 1200
NCHAR VARYING (n)NVARCHAR (n)
NATIONAL CHARACTER LARGE OBJECT NCHAR LARGE OBJECT
DBCLOB (1M) CCSID 1200NCHAR LARGE OBJECTNCLOBNATIONAL CHARACTER LARGE OBJECT (n)NCHAR LARGE OBJECT (n)NCLOB (n)
DBCLOB (n) CCSID 1200
© 2008 IBM Corporation
O ( )
ALTER FUNCTIONALTER FUNCTION
ALTER FUNCTION j t t f 1 ALTER FUNCTION mjatst.func1
ALTER NOT DETERMINISTIC
RETURNS NULL ON NULL OUTPUT;
Change a function without having to reissue grants.
ALTER FUNCTION mjatst.func1
REPLACE (p1 VARCHAR(10)) RETURNS INT
BEGING
DECLARE x INT;
RETURN (SELECT MAX(LENGTH) FROM QSYS2.SYSCOLUMNS
WHERE DATA_TYPE = p1);
END;
© 2008 IBM Corporation
Ignore unsupported syntaxIgnore unsupported syntax
CREATE TABLESPACE TS1 MANAGED BY DATABASE USING (device ’/dev/rcont $N’ 20000)
SQLSTATE: 01505SQLCODE: +143Message: Statement CREATE TABLESPACE ignored.
CREATE TABLE mjatst.newt1 (c1 INT) INDEX IN ts1SQLSTATE: 01680
SQLCODE: +20367
Message: Clause INDEX IN ignored.
Statements and clauses that will never be necessary on i are
Message: Clause INDEX IN ignored.
CREATE TABLE mjatst.t1 (c1 INT) IN ts1
SQLSTATE: 42704
SQLCODE: 204 necessary on i are ignored making ports easier.
SQLCODE: -204
Message: TS1 in MJA type *NODGRP not found.
© 2008 IBM Corporation
FOR EACH STATEMENT INSTEAD OF triggerFOR EACH STATEMENT INSTEAD OF trigger
CREATE TRIGGER mjatst.trgins1 INSTEAD OF INSERT ON mjatst.v1
FOR EACH STATEMENT
BEGIN
…
END;
Allow INSTEAD OFAllow INSTEAD OF triggers to be FOR EACH STATEMENT.
PTFed to V5R4
© 2008 IBM Corporation
BX LiteralsBX Literals
CREATE TABLE qtemp.binary1 (c1 VARBINARY(1000));
INSERT INTO qtemp.binary1 VALUES( BX’A1B2C3D4’ );
Alternative method of specifying binary
SYSTOOLS and SYSIBMADM
specifying binary constants.
SYSTEM PATH changes for SQL naming:
″QSYS″ ″QSYS2″ ″SYSPROC″ ″SYSIBMADM″ ″th l f th th i ti ID f th t t t″
S S OO S a d S S
Two new system schemas to house
″QSYS″, ″QSYS2″, ″SYSPROC″, ″SYSIBMADM″, ″the value of the authorization ID of the statement″
schemas to house future information.
© 2008 IBM Corporation
Statistics Catalog ViewsStatistics Catalog Views
SYSCOLUMNSTAT Contains one row for every column in a table partition or table member and one row for every column statistics collection.
SYSPARTITIONINDEXSTAT Contains one row for every index built over a table partition or table member.
SYSPARTITIONSTAT Contains one row for every table partition or table member.
SYSTABLEINDEXSTAT Contains one row for every index that has at least one partition or member built over a table. If the index is over more than one partition or member, the statistics include all those partitions and members.
SYSTABLESTAT Contains one row for every table that has at least one partition or member. If the table has more than one partition or member, the statistics include all partitions and members.
New views allow simple access to statistics.
SELECT table_schema, table_name, table_partition, number_rows, number_deleted_rows
FROM QSYS2 SYSPARTITIONSTAT
These were PTFed to V5R4FROM QSYS2.SYSPARTITIONSTAT
WHERE table_schema = ‘MJATST’
© 2008 IBM Corporation
Statistics Catalog ViewsStatistics Catalog ViewsSYSINDEXSTAT Contains one row for every SQL index. Use this view when you want to see information for a
specific SQL index or set of SQL indexes. The information is similar to that returned via Show Indexes in System i Navigator.
SYSMQTSTAT Contains one row for every materialized table. Use this view when you want to see information Q y yabout a specified materialized query table or set of materialized query tables. The information is similar to that returned via Show Materialized Query Tables in System i Navigator.
SYSPACKAGESTAT Contains one row for each SQL package in the SQL schema.
SYSPARTITIONINDEXES Contains one row for every index built over a table partition or table member Use this view SYSPARTITIONINDEXES Contains one row for every index built over a table partition or table member. Use this view when you want to see index information for indexes built on a specified table or set of tables. The information is similar to that returned via Show Indexes in System i Navigator.
SYSPARTITIONMQTS Contains one row for every materialized table built over a table partition or table member. Use this view when you want to see materialized query table information for materialized tables this view when you want to see materialized query table information for materialized tables built on a specified table or set of tables. The information is similar to that returned via Show Materialized Query Tables in System i Navigator.
SYSPROGRAMSTAT Contains one row for each program, service program, and module that contains SQL statements.
New views allow
SELECT package_schema, package_name, package_type, number_statements, package_used_sizeFROM QSYS2.SYSPACKAGESTATWHERE package_schema LIKE ‘Q%’
simple access to statistics.
NOT PTFed
© 2008 IBM Corporation
CLIENT Special RegistersCLIENT Special RegistersCURRENT CLIENT_ACCTNG Contains the value of the accounting string from the client information specified for
this connection.
CURRENT CLIENT_APPLNAME Contains the value of the application name from the client information specified for this connection.
CURRENT CLIENT_PROGRAMID Contains the value of the client program ID from the client information specified for this connection.
CURRENT CLIENT_USERID Contains the value of the client user ID from the client information specified for this connection.
CURRENT CLIENT_WRKSTNNAME Contains the value of the workstation name from the client information specified for this connection.
Provides the ability to The values of the special registers can be changed through:• The Set Client Information (SQLESETI) API
SELECT CURRENT CLIENT_ACCTNG AS "Client Accounting",
" l l "
track the real user and application. Besides direct access, database monitor will capture the values and
• The Set Client Information (SQLESETI) API.• In CLI, the SQLSetConnectAttr() API.• In JDBC, the setClientInfo connection method.
CURRENT CLIENT_APPLNAME AS "Client Application",
CURRENT CLIENT_PROGRAMID AS "Client Program",
CURRENT CLIENT_USERID AS "Client User",
CURRENT CLIENT_WRKSTNNAME AS "Client Workstation“ FROM sysibm.sysdummy1;
will capture the values and Current SQL for a job will show values.
© 2008 IBM Corporation
Interoperability – DRDA Interoperability DRDA
DB2 for z/OSDB2 f VM d VSE
DB2 for z/OSDB2 for VM and VSEDB2 for iDB2 for AIXDB2 for HP-UX DB2 for Sun SolarisDB2 for W indowsDB2 f Li i
DB2 for VM and VSEDB2 for iDB2 for AIXDB2 for HP-UX DB2 for Sun SolarisDB2 for W indows
DDM/DRDA Protocols
DDM/DRDA Protocols
DB2 for Liniux Inform ix Txaction
Attachm ateGrandview HiT S ft
DB2 for W indowsDB2 for Liniux Server and Client
HiT SoftwareMicrosoftOracleRocketStarQuestSybase/MDIW ll D t
FileTek, Inc.Grandview Platinum Technology Inc. XDB S t
6.1DDM and DRDA IPv6DRDA Identity tokensDRDA LOB OptimizationsW all Data
XDB System s XDB Systems DRDA LOB Optimizations
DRDA Authentication MethodsDRDA Scrollable CursorsOutput parameter support for heterogeneous CALL
ApplicationServer (Data)Oracle and Microsoft do not
t DRDA S
© 2008 IBM Corporation
support DRDA as a Server
6 1 Application Development6.1 Application Development
CLI Alias support in Metadata APIs
Native JDBC
JDBC 4 0 as suppo t etadata s Row-wise array INSERT Wide APIs
JDBC 4.0
CLI Handle Threshold Exit
Embedded SQL JDBC JDBC 4.0 Alias support in Metadata APIs Returning DEFAULT
Embedded SQL RPG Precompiler Variable Scoping Precompiler IFS support Unicode support in COBOL
Returning DEFAULT Return update counts
XDA
RUNSQLSTM IFS support
SQL Server Mode Serviceability improvements
NET
Run SQL Scripts flagger
.NET Multiple-row INSERT Additional data type support Visual Studio integration
© 2008 IBM Corporation
g Distributed transaction support Exploit ADO.NET 2.0
SQL Query Engine (SQE) SQL Query Engine (SQE)
SQE CharacteristicsSQE Characteristics Parallel to Normal Release Enhancements Object Oriented Design Enhanced Performance primarily for complex queries Enhanced Optimization Engine
Virtually all SQL queries use
SQE! Enhanced Optimization Engine Enhanced Statistics Encoded Vector Indexes Enhancements
SQE Delivery
SQE!
SQE DeliveryFirst Wave V5R2 GASecond Wave mid-V5R2 Third Wave V5R3 GAF th W id V5R3 6.1 SQE (Stage 6)
CCSID translation support Lateral Correlation UDTF support
Fourth Wave mid-V5R3 Fifth Wave V5R4 GA
UDTF support Significant optimization time improvements Other miscellaneous performance
© 2008 IBM Corporation
6 1 Performance
SQL Runtime Performance Improvements
6.1 Performance
Host Server Variable Length compression (V5R4 PTF) SQL CALL cache improvements Optimization time improvements Long name resolve Long name resolve Large page use (64K)
Database Maintenance Performance Improvementsp ALWCANCEL(*YES) Reorganize No Longer Requires *EXCL Lock Reorganize and LOB segment crossers (V5R4 PTF) ALTER TABLE performance
D t b ild EVI (V5R4 PTF) Do not rebuild EVIs (V5R4 PTF) Preserve indexes in tables with LOBs (segment crossers)
SQL Performance Tools ImprovementsSQL Performance Tools Improvements Performance Monitor Improvements
3010 fixes and Unicode 1000 records for non-SQL
© 2008 IBM Corporation
Filter by port number and ipV6
6 1 Increased Limits6.1 Increased Limits
SQL Application and Runtime Limits 64K result row length (partial – V5R4 PTF) 128-byte cursor and statement names
M th 120 l i GROUP BY More than 120 columns in GROUP BY Larger in-use table
Database Object Limits Number of schemas - number of dependent logicals – (partial V5R4 PTF) Increase ALTER TABLE number of dependents supported Increase Save number of dependents supported
© 2008 IBM Corporation
6 1 Availability/Recovery6.1 Availability/Recovery
Database O tl l i l fil d MQT t Outlaw logical file and MQT restore
XA and DDL improvements
Quiesce transactions for XSM Switchover
Serviceability improvements Serviceability improvements
Eliminate package corruption (V5R4 PTF)
Journaling Statistics DDL entries
Implicit library journaling (STRJRNLIB, ENDJRNLIB, SQL CREATE SCHEMA)
End Journal While Open
Start and End Journal *ALL objects in a library
Merge APYJRNCHG and APYJRNCHGX
Change journal exit point (QIBM QJO CHG JRNRCV) Change journal exit point (QIBM_QJO_CHG_JRNRCV)
List eligible but unprotected access paths (DSPRCYAP)
Miscellaneous recovery improvements
© 2008 IBM Corporation
6 1 System i NavigatorOn Demand Performance Center
• Copy to spreadsheet• Customization for Analyze• Condensed Advice (PTF)
6.1 System i Navigator
• Plan Cache Event Monitor• Plan Cache properties and resize• Fast summary compare• Reset last used date and stats• Monitor filters - Storage Governor & Port• Monitor filters Storage Governor & Port• Show statements enhancements• Visual Explain while running• Additional SQL Job Information
Health Center• Environmental limits• Package and procedure in Size Limits• File activity• Journals and receivers in Overview• Journals and receivers in Overview
Database Management • Schema based info• Show object locksShow object locks• Label and Comment cleanup
Run SQL Statements• Automatic flagger
© 2008 IBM Corporation
gg• Save to spreadsheet• Save to source member • Save to UTF-8
DB2 for iDB2 for iWhat’s New Since 6.1
© 2008 IBM Corporation
Web Based Query and Reporting
Web-based query and report writing product that replaces IBM Query for iSeries (Query/400)
Base Product
Q y p g
Base Product
Report and graphing Assistants
Power Painter
Spreadsheet integration
W b bl Q /400 t Web-enable Query/400 report
DB2 for i cross system Queries
Additional IBM Features
Active Reports (Disconnected)
On Line Analytical Processing
Developer’s Workbench
Advanced metadata creation
SQL Wizard
HTML Layout Painter
Additional Add-On Available
ERP System Integration
250+ Database/Cube/Mining Connectors
F d il f h // ib / /i/db2
/ / g
Extract/Transformation/Load
Visual Discovery
MS Excel Add-In
Automatic Report Distribution / Intelligent Bursting
© 2008 IBM Corporation
For more details, refer to: http://www.ibm.com/systems/i/db2 Automatic Report Distribution / Intelligent Bursting
IBM DB2 Web Query for i IBM DB2 Web Query for i Report Broker
Additional product IBM DB2 Web Query for i Easy to use graphical scheduler for
automating report execution in the background background
Schedule reports to run on daily, weekly, monthly, or certain days of the week. Specify blackout dates when reports should NOT be runG t t i diff t f t Generate reports in many different formats, including PDF, spread-sheets, or as an “active” report with the Active Reports feature of DB2 Web Query
Automate the report distribution function i il t i l lti l via email to single users or multiple users
through a distribution list Intelligently burst the reports to send
sections of the report to regional managers with only data pertinent to their job/region
F d il f h // ib / /i/db2
© 2008 IBM Corporation
For more details, refer to: http://www.ibm.com/systems/i/db2
IBM DB2 Web Query for i Q ySoftware Development Kit (SDK)
Additional product IBM DB2 Web Query for i
Enables application integration of the h h freporting environment through a set of
SOA-based Web Services
Customize a web application to work with DB2 Web Query and Report Broker functions
Invoke these functions from an existing application
Link to a report from a URL within a portal interface interface
F d il f h // ib / /i/db2
© 2008 IBM Corporation
For more details, refer to: http://www.ibm.com/systems/i/db2
MySQLMySQL
Most popular open source DBF tl d ith PHP Frequently used with PHP
Two stages Stage 1
Runs AIX version of MySQL in PASE with Support by MySQL
Uses existing Storage engines (MyISAM)
Stage 2
Custom storage engine that integrates MySQL with DB2 for i
© 2008 IBM Corporation
OmniFind Text Search Server for DB2 for i
No-charge offering (5733-OMF)
Quickly search text in DB2 columns with advanced linguistic methods
OmniFind can index and search: Adobe PDF
Rich Text Format (RTF)
HTML
XML
Lotus 123
Lotus Freelance Lotus Freelance
Lotus WordPro
Microsoft Excel
Microsoft PowerPoint
Microsoft Word
Open Office 1.1 & 2.0
JustSystems Ichitaro
© 2008 IBM Corporation
DB2® for i Post 6 1 DB2® for i Post 6.1 Enhancements
© 2008 IBM Corporation
Post V5R4 GA EnhancementsPost V5R4 GA EnhancementsPerformanceValidate Constraints without Checking
Systems Management
SQL Server Mixed Mode for Batch Processing • V5R4 - Database Group SF99504 Version 18• 6.1 - Database Group SF99601 Version 6
Preserve EVI Indexes on ALTER • V5R4 - Database Group SF99504 Version 19 (planned)
• V5R4 - Database Group SF99504 Version 19 (planned)• 6.1 - Database Group SF99601 Version 8 (planned)
Allow QSQSRVR jobs in a User Subsystem • V5R4 - Database Group SF99504 Version 18• V5R4 - Database Group SF99504 Version 19 (planned)
• 6.1 - In the base release
CPYFRMIMPF performance • V5R4 - Database Group SF99504 Version 19 • 6.1 - Database Group SF99601 Version 8
• V5R4 - Database Group SF99504 Version 18• 6.1 - Database Group SF99601 Version 8 (planned)
Add “Server Mode Connecting Job” to QUSRJOBI() and System i Navigator
Materialize Member List Seize • V5R4 - Database Group SF99504 Version 20
• 6.1 – Database Group SF99601 Version 9 (planned) Audit and Security
• V5R4 - Database Group SF99504 Version 18
• 6.1 - Database Group SF99601 Version 7
Solid State Disks (SSD)
V5R4 - Database Group SF99504 Version 21 and 22 (planned)
6 1 Database Group SF99601 Version 9 and 10
Audit and Security
SECURE columns • V5R4 - Database Group SF99504 Version 19 (planned)
• 6.1 - Database Group SF99601 Version 8 (planned) 6.1 – Database Group SF99601 Version 9 and 10
(planned)
© 2008 IBM Corporation
Check the DB2 for i Home Page
Post 6 1 GA EnhancementsPost 6.1 GA Enhancements
PerformanceSQL P d P f E h t SQL Procedure Performance Enhancements • Database Group SF99601 Version 7
PROGRAM TYPE SUB on CREATE PROCEDURE (SQL) • Database Group SF99601 Version 7
A dit d S it
Function
Allow Unqualified SRVPGM Names for Routines Database Group SF99601 Version 8
Database Group SF99601 Version 7
Audit and Security
RUNSQLSTM/STRSQL and client special register • Database Group SF99601 Version 7
Database Group SF99601 Version 8
*JOBCTL No Longer Required for STRDBMON on JOB(*)• Database Group SF99601 Version 8
STRDBMON over a ViewAvailability and Recovery
• Database Group SF99601 Version 9 (planned) Prevent EVI Rebuild On Cancel During Catch Up• Database Group SF99601 Version 10 (planned)
Internal Error (-901) Service Logging
© 2008 IBM Corporation
Database Group SF99601 Version 10 (planned)
Solid State Disks (SSD)Solid State Disks (SSD)
Allows a user to indicate a media preference on an SQL table, SQL index, physical file, and logical file
CL command support UNIT(*SSD) on CRTPF, CRTLF, and CRTSRCPF*
UNIT(*SSD) on CHGPF CHGLF and CHGSRCPF* UNIT(*SSD) on CHGPF, CHGLF, and CHGSRCPF
SQL statement support UNIT SSD on the object level
CREATE TABLE
ALTER TABLE
CREATE INDEX
UNIT SSD on the partition level CREATE TABLE
ALTER TABLE ... ADD PARTITION
ALTER TABLE ... ALTER PARTITION
CHGxxx and ALTER will asynchronously move data and indexes
V5R4 - Database Group SF99504 Version 21 and 22 (planned)6.1 – Database Group SF99601 Version 9 and 10 (planned)
© 2008 IBM Corporation
SECURE columns P t t d t iSECURE columns
Issue an SQL CALL to secure column CCNBR in table LIB1.Orders:
Protects secure data in a database monitor and plan cache.
CALL SYSPROC.SET_COLUMN_ATTRIBUTE ('LIB1', 'ORDERS', 'CCNBR', 'SECURE YES');
P d i iParameter descriptions:
Table_Schema VARCHAR(10) The system name of a table's schema.
Table_Name VARCHAR(10) The system name of a table.
Column_Name VARCHAR(10) The system column name that is secured.
Attribute VARCHAR(10) The attribute being set for the column.
The valid values of the Attribute are:
SECURE NO This col mn does not contain data that needs to be sec ed in a database monito o plan SECURE NO - This column does not contain data that needs to be secured in a database monitor or plan cache.
SECURE YES - This column contains data that needs to be secured in a database monitor or plan cache. All variable values for any query that references this column will not be visible in a database monitor or plan cache unless the security officer has started the database monitor or the security officer is accessing the plan cache.
Notes Calling the procedure will require an exclusive lock and enough authority to alter the table.
© 2008 IBM Corporation
It will generate a journal entry so the HABPs can replay it on another system.
SECURE columnsSECURE columns
Prior to V7R1, the following statements may need to be issued once:
CREATE PROCEDURE SYSPROC.SET_COLUMN_ATTRIBUTE (Table_Schema VARCHAR(10),Table_Name VARCHAR(10),Column_Name VARCHAR(10),Attribute VARCHAR(10) )LANGUAGE C PARAMETER STYLE SQLMODIFIES SQL DATASPECIFIC QDBCATTREXTERNAL NAME 'QSYS/QDBSSUDF2(QDBCATTR)';
© 2008 IBM Corporation
GRANT EXECUTE ON PROCEDURE SYSPROC.SET_COLUMN_ATTRIBUTE TO PUBLIC;
SQL Server ModeSubsystem control
SQL Server mode jobs (QSQSRVR) reside within the QSYSWRK subsystem.Some customers want the server mode jobs to run in the subsystem of the application, to permit better performance controls and serviceability.
The support is enabled with an environment variableThe support is enabled with an environment variable.
To enable the switch:
ADDENVVAR ENVVAR(QIBM_SRVRMODE_SBS) VALUE('*SAME') LEVEL(*SYS)
SQL CLI control provided via new connection attribute SQLSetConnectAttr() -SQL ATTR SERVERMODE SUBSYSTEMSQL_ATTR_SERVERMODE_SUBSYSTEM
JDBC control provided via new connection property - servermode subsystem
© 2008 IBM Corporation
SQL Server ModeImproved identification of current user
Some customers have thousands of active SQL Server mode jobs. System i Navigator has been improved to show the current application user and thread.
© 2008 IBM Corporation
SQL Server ModeImproved identification of current user
Green screen users can see the connecting job, but not the thread detail.
© 2008 IBM Corporation
Collect SQL detailsFor all statements executedFor all statements executedvia STRSQL or RUNSQLSTM
Start SQL Interactive Session (STRSQL command) users willobserve the following client special register values:
CLIENT PROGRAMID = 'STRSQL'CLIENT APPLNAME = 'START SQL INTERACTIVE SESSION'CLIENT USERID = The current user's nameCLIENT WRKSTNNAME = The DB2 for i database nameCLIENT ACCTNG = The current user's accounting code
(i.e. ACGCDE parameter on CHGUSRPRF)(i.e. ACGCDE parameter on CHGUSRPRF)
Run SQL Statements (RUNSQLSTM command) users willobserve the following client special register values:
CLIENT PROGRAMID = 'RUNSQLSTM'CLIENT APPLNAME = 'RUN SQL STATEMENTS'CLIENT USERID = The current user's nameCLIENT WRKSTNNAME = The DB2 for i database nameCLIENT WRKSTNNAME The DB2 for i database nameCLIENT ACCTNG = The current user's accounting code
(i.e. ACGCDE parameter on CHGUSRPRF)
© 2008 IBM Corporation
Collect SQL detailsfor all statements executedfor all statements executedvia STRSQL or RUNSQLSTM
Corporate auditing requirements (SOX) are becoming more demanding.SOX officers are responsible for establishing and maintaining internal controls.Some companies have decided to record and archive all the SQL statement activity for command interface users.Th D t b M it li t i t filt b d t l thi dThe Database Monitor client register pre-filters can be used to solve this need.
Example:
STRDBMON OUTFILE(QGPL/STRSQLMON1) STRDBMON OUTFILE(QGPL/STRSQLMON1) OUTMBR(*FIRST *REPLACE) JOB(*ALL/*ALL/QPADE*) TYPE(*DETAIL) COMMENT('FTRCLTPGM(STRSQL)') COMMENT( FTRCLTPGM(STRSQL) )
<.....>
ENDDBMON JOB(*ALL/*ALL/QPADE*) ) ENDDBMON JOB( ALL/ ALL/QPADE ) )
© 2008 IBM Corporation
Collect SQL detailsonly for statements executedonly for statements executedby CQE or SQE
Focus monitor collection on either CQE or SQE queries. This helps to minimize the overhead of monitoring SQL requests.
Example:
STRDBMON OUTFILE(lib/file) …COMMENT('WANT_CQE_ONLY')
STRDBMON OUTFILE(lib/file) …COMMENT('WANT_SQE_ONLY')
© 2008 IBM Corporation
CREATE PROCEDURE – PROGRAM TYPE SUBCREATE PROCEDURE PROGRAM TYPE SUB
Add the following option to CREATE PROCEDURE (SQL) and ALTER PROCEDURE (SQL).
option-list
>--+-------------------+----->+-PROGRAM TYPE MAIN-+ '-PROGRAM TYPE SUB--'
Service program calls perform faster than program calls
PROGRAM TYPE MAINSpecifies that the routine executes as the main entry point in a program. The external program generated will be a *PGM object.
PROGRAM TYPE SUBSpecifies that the routine executes as a procedure in a service program. The external program generated will be a *SRVPGM object.
© 2008 IBM Corporation
DB2® for i What’s NextDisclaimer: The following information is tentative
and might not come to fruition.
IBM makes no guarantees or commitments to provide the features or IBM makes no guarantees or commitments to provide the features or functions listed here.
© 2008 IBM Corporation
Possible Future SQL Enhancements Possible Future SQL Enhancements
Queries and Data Change statements (DML) MERGE
Schema statements (DDL) XML data type
MERGE Result set support in embedded SQL
XML data type Global variables Array support in routines Encryption enhancements (FIELDPROCS) Three-part Aliases Partition table enhancements
Scalar Functions Scalar Functions XML functions MQ Series functions TIMESTAMP_FORMAT and VARCHAR_FORMAT enhancements
Miscellaneous Parameter marker enhancements Expressions in CALL
© 2008 IBM Corporation
Expressions in CALL
Possible Future SQL Query Engine (SQE) Possible Future SQL Query Engine (SQE)
SQE Ch t i tiSQE Characteristics Parallel to Normal Release Enhancements Object Oriented Design Enhanced Performance primarily for complex queries Enhanced Optimization Engine Enhanced Statistics Encoded Vector Indexes Enhancements
SQE DeliveryFirst Wave V5R2 GASecond Wave mid-V5R2 Third Wave V5R3 GAFourth Wave mid-V5R3 Fifth Wave V5R4 GASixth Wave 6.1 GA
SQE (Stage 7)• Logical File support• Adaptive Query Processing (AQP)• Other miscellaneous performance enhancementsp
© 2008 IBM Corporation
Possible Future Performance Enhancements
SQL Runtime Performance Improvements SQL function enhancements (inline functions)
Possible Future Performance Enhancements
Q ( ) OVRDBF and REUSEDLT(NO) support available now via Lab Services EVI enhancements
CREATE ENCODED VECTOR INDEX idx2 ON sales (region)INCLUDE ( SUM(sales) )
SELECT region SUM(sales) FROM sales GROUP BY regionSELECT region, SUM(sales) FROM sales GROUP BY region
Database Maintenance Performance Improvements ALTER TABLE performance and concurrency
© 2008 IBM Corporation
Possible Future Limits/Availability/RecoveryPossible Future Limits/Availability/Recovery
SQL Application and Runtime Limits128 b t h
Database
128-byte schema names
Database Currently Committed
Allow transactions to span *SYSBAS and IASPs
CHGPFCST CHECK(*YES *NO)
Journaling
( ) CHGSRCF TEXT(*FROMMBR) SRCTYPE(*FROMMBR)
Journaling Additional filtering based on generic names on STRJRNLIB and CHGJRNOBJ
to control what journaling implicitly gets started
Additional control on whether journal entries for an object(s) should be f l d lfiltered on remote journaling
Option 42 (HA Journal Performance)
© 2008 IBM Corporation
Possible Future System i Navigator
On Demand Performance CenterD t b it
Possible Future System i Navigator
• Database monitor− Client register filter−Monitor over a View (PTFed)
• Authority changes• SQL details for a jobSQL details for a job• Save Show Statements
Database Management • Support for DB enhancements• Support for Omnifind indexes• Large list performance• Partitioned table enhancement for Show
Indexes and Show MQTs • Generate SQL option to include GRANTsGe e ate SQ opt o to c ude G s• Status
− Reorganize enhancements− Index build − ALTER TABLE
Save folder contents• Save folder contents
© 2008 IBM Corporation
© 2008 IBM Corporation
© 2008 IBM Corporation