DDLVSDDS AS400
DDLVSDDS AS400
DDLVSDDS AS400
17A
ITEMCLAS
2A
PRICE
9P 2
COMP(GT 0)
K ITEMNBR
ITEMCLAS
PRICE
8.005.00-
XXXXXXXXXXXXXXXXX
XX
+++++++++++++
Performance enhancements
Many applications have an average of 25 reads to every write.
If you move the validity checking to write time, performance
will be better.
DDL defaults to REUSEDLT, or reuse deleted records.
Allows concurrent write support.
Performance enhancements
(cont)
DDL defined files will have a 64K page size vs 8-32K
page size from DDS.
Source?
Store in QDDSSRC, compile with RUNSQLSTM
17A
ITEMCLAS
2A
PRICE
9P 2
COMP(GT 0)
COLHDG(' ' 'Price')
K ITEMNBR
Column headings
Constraints
ITEMCLAS CHAR (2 ) NOT NULL WITH DEFAULT,
CHECK (ITEMCLAS<>' ' ),
FOREIGN KEY (ITEMCLAS)
REFERENCES IIC (ICLAS)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
RCDFMT clause
In older releases of i5/os SQL did not support the RCDFMT
clause. Commonly what one did was CREATE TABLE and
then rename it.
Embedding UDFs
CREATE VIEW wPricing
AS SELECT LPROD, LQORD, LCUST, LRDTE,
pricing(lprod, lqord, lcust, lrdte) as PRICE
FROM ordline
Identity columns
CREATE TABLE ROB/ORDMAST
(ORDNBR INTEGER GENERATED ALWAYS AS IDENTITY,
CUSTNBR INTEGER,
ITEMNBR CHAR (17));
INSERT INTO ROB/ORDMAST
(CUSTNBR, ITEMNBR) VALUES(5, 'A');
SELECT * FROM ORDMAST;
ORDNBR
CUSTNBR
1
5
ITEMNBR
A
Identity value
Exec sql
VALUES IDENTITY_VAL_LOCAL() INTO
:IVAR;
ADDPFCST trick
Bibliography
http://www-03.ibm.com/servers/eserver/iseries/db2/pdf/
Performance_DDS_SQL.pdf
http://faq.midrange.com/data/cache/462.html
SQL Performance Diagnosis on IBM DB2 Universal Database for
iSeries
http://www.redbooks.ibm.com/abstracts/sg246654.html?Open
Modernizing IBM eServer iSeries Application Data Access - A
Roadmap
Cornerstone
http://www.redbooks.ibm.com/abstracts/sg246393.html?Open
Preparing for and Tuning the SQL Query Engine on DB2 for
i5/OS
http://www.redbooks.ibm.com/abstracts/sg246598.html?Open
Database performance and query optimization
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/rzajq/r
zajq.pdf
DB2 Universal Database for iSeries Administration: The
Graphical Way on V5R3
http://www.redbooks.ibm.com/abstracts/sg246092.html?Open
Mastering SQL Performance with Visual Explain - V5R3 Update
http://www03.ibm.com/servers/enable/site/education/abstracts/2dc6_abs.html