DOAG 2015 . DB2 SHOOTOUT · PDF filePL/SQL and ABAP/4 Know How ... Dilbert Barfriend Dilbert...
-
Upload
truongngoc -
Category
Documents
-
view
215 -
download
2
Transcript of DOAG 2015 . DB2 SHOOTOUT · PDF filePL/SQL and ABAP/4 Know How ... Dilbert Barfriend Dilbert...
Copyright © 2015 ITGAIN GmbH 1
ORACLE VS. DB2 SHOOTOUT
DOAG 2015
Oracle vs. DB2 Shootout
Copyright © 2015 ITGAIN GmbH 2
INTRODUCTION
Today in the blue corner:
Robert Barić
Oracle KnowHow since 9i/10g
DB2 KnowHow since 9.1
Development Know How
6 years with ITGAIN
Specialized in Performance Tuning andBackup/Recovery
Anytime in the red corner:
Gerret Bachmann
Oracle KnowHow since 8i
Had learned COBOL long ago
PL/SQL and ABAP/4 Know How
4 years with ITGAIN
Specialized in Performance Tuning
Oracle vs. DB2 Shootout
Why do we compare ?
Who are we ?
Copyright © 2015 ITGAIN GmbH 3
A RICH SET OF SIMILAR FEATURES
Oracle vs. DB2 Shootout
Partioning
Compression
Online Backup
„Remote“ DB access
Trigger
Programming language
Online Reorg
XML / JSON
CBO / statistics
Column Organized Tables
RDBMS
ACID
Standby Database
Cluster Database
Parallel Processing
.. And many more
Copyright © 2015 ITGAIN GmbH 4
SHARED HISTORY
Oracle vs. DB2 Shootout
1970 1975 1980 1985 1990 1995 2000 2005 2010 2015
Research study byEdgar F. Coddby order of IBM: DB-Prototype System R
First Installation
DB2 for MVS
Announcement DB2 für OS/2
OS/2 Database
DB2 for Windows
8i (CBO, Java VM, Unicode, LOBs)
9i (Flashback, SPFile)
10g (ASM, ADDM)
V7 (Unicode, SQL/PL)
V8 (Partitioning)
V9.7 (Cursor Stability)
V10 (Opt. Parallel.)
11g (Adv. Comp.)
12cV2 (1st Version)
V4 (Read Consistency)
Copyright © 2015 ITGAIN GmbH 5
DB2: DATA PARTITIONING FEATURE (DPF )
Oracle vs. DB2 Shootout
SELECT dept, SUM(sal)
FROM emp
GROUP BY dept
Coordinator
Copyright © 2015 ITGAIN GmbH 6
DPF: TABLESPACE AND TABLE CREATION
CREATE DATABASE PARTITION GROUP D1PG
ON DBPARTITIONNUMS (1, 2, 3, 4, 5, 6, 7);
CREATE LARGE TABLESPACE DPF_TBSP1
IN DATABASE PARTITION GROUP D1PG
PAGESIZE 16384
MANAGED BY DATABASE;
CREATE TABLE EMPLOYEE (
EMP_ID VARCHAR(50) NOT NULL,
EMP_FIRST_NAME VARCHAR(50) NOT NULL,
EMP_LAST_NAME VARCHAR(50) SMALLINT,
ROW_INSERT_TMSTMP TIMESTAMP)
DISTRIBUTE BY HASH (EMP_ID)
IN DPF_TBSP1
INDEX IN DPF_TBSP1_IX;
Oracle vs. DB2 Shootout
Copyright © 2015 ITGAIN GmbH 7
DATAGUARD VS HADR (STANDBY)
On Standby only Dirty Reads
No Backup on Standby
Max. 3 Standby databases
Oracle vs. DB2 Shootout
Primary Database
StandbyDatabase
Clients Clients
Data Changes
Primary Site StandbySite
DB2Oracle
On Standby Consistent Reads
Backup on Standby
Max. 30 Standby databases
Copyright © 2015 ITGAIN GmbH 8
DB2: ISOLATION LEVEL „UNCOMMITTED READ“
Oracle vs. DB2 Shootout
T1
T2
SELECT NAME
FROM CUST
WHERE ID = 1337;
UPDATE CUST
SET NAME = 'Tom'
WHERE ID = 1337;
Thinks about
COMMIT or
ROLLBACK…
CUST
ID = 1337
NAME = 'Thomas'
CUST
ID = 1337
NAME = 'Tom'
SELECT NAME
FROM CUST
WHERE ID = 1337
WITH UR;
CUST
ID = 1337
NAME = 'Tom'
Copyright © 2015 ITGAIN GmbH 9
RAC VS. PURESCALE: ARCHITECTURE
Oracle vs. DB2 Shootout
Member
CF CF
CF CF
Cluster-Caching facilities (CF)Global Locking + Page Cache
Primary CF Secondary CF
Members with integrated CF
Copyright © 2015 ITGAIN GmbH 11
Header
Row 4
Row 2
Row 1
ITL Slot 1
Row 3
ITL Slot 2
ITL Slot 3
UPDATE … WHERE ROW=1;
UPDATE … WHERE ROW=2;
UPDATE … WHERE ROW=3;
UPDATE … WHERE ROW=4;ITL Slot 4
Row 5UPDATE … WHERE ROW=5; ITL waits
ALTER TABLE…
INITRANS=10
ORACLE LOCKING
ITL-slots on block level per session
Number of slots grows with table
Oracle vs. DB2 Shootout
Session 1
Session 2
Session 3
Session 4
Copyright © 2015 ITGAIN GmbH 12
DB2 NIGHTMARE: „LOCK ESCALATION“
Oracle vs. DB2 Shootout
Lock Manager Lock Manager
UPDATE … WHERE ROW=1;
UPDATE … WHERE ROW=2;
UPDATE … WHERE ROW=3;
UPDATE … WHERE ROW=4;
UPDATE … WHERE ROW=8;
UPDATE … WHERE ROW=12;
UPDATE … WHERE ROW=9;
4
2
1
3
8
6
5
7
12
10
9
11
Table SHOOTOUT
1 2 3 4 8Table SHOOTOUT
DML Wait
Copyright © 2015 ITGAIN GmbH 13
TABLE COMPRESSION
1 Bachmann
1 Baric
2
chmann
ric
Nor man
Oracle DB2
1
1
2
Robert Bachmann
Robert Baric
Nick King
Norbert Barman
Dilbert Barfriend friendDilbert Barfriend Dil 3
3Norbert Barman
2 2Nick King 2
2
Uncompressed
1 Robert Ba
Nick2
3 Bert Bar
Oracle vs. DB2 Shootout
1 Robert
2 Nick King King
Copyright © 2015 ITGAIN GmbH 14
DB2
Oracle
TABLE / BLOCK DICTIONARY
Titel des Foliensatzes
Block 1 Block 2 Block 3
Norbert Norbert Norbert
Page 1 Page2 Page3
1 1 11 Norbert
Table Dictionary
Copyright © 2015 ITGAIN GmbH 15
INDEX COMPRESSION DB2
Variable Slot Directory
Prefix Compression (from beginning byte-values)
RID (RowID) Compression
Oracle vs. DB2 Shootout
Compress
Fixed Slot Dir
Tom, Tall 102030
Tom, Thin
102032
102035
Index Keys RID
Var. Slot Dir
~1all 102030
~1hin
2
102035
Index Keys RID
~1=Tom, T Symbols
Page (Block) Page (Block)
Copyright © 2015 ITGAIN GmbH 16
RIDDLE: WHAT HAPPENS?
CREATE TABLE RIDDLE(
ID INTEGER,
TEXT CHAR (20));
INSERT INTO RIDDLE VALUES (1, 'Now what?');
ROLLBACK;
SELECT * FROM RIDDLE;
0 rows found Table not found
DDL can be rolled back!
ORACLE: DB2:
Oracle vs. DB2 Shootout
Copyright © 2015 ITGAIN GmbH 17
DB2: REORG PENDING STATE
Change last month
ALTER TABLE RIDDLE
ALTER COLUMN TEXT SET DATA TYPE VARCHAR(30); COMMIT;
Change last week
ALTER TABLE RIDDLE
ALTER COLUMN TEXT SET DATA TYPE VARCHAR(40); COMMIT;
Change today
ALTER TABLE RIDDLE
ALTER COLUMN TEXT SET DATA TYPE VARCHAR(50); COMMIT;
Table switches to „reorg pending state“
Cannot be used until reorg is done
Can take a while…
„3 STRIKES“:
Oracle vs. DB2 Shootout
Copyright © 2015 ITGAIN GmbH 18
ORACLE COMPATIBILITY MODE
$> DB2SET DB2_COMPATIBILITY_VECTOR = ORA
$> DB2SET DB2_DEFERRED_PREPARE_SEMANTICS = YES
$> db2stop; db2start
$> db2 "create database testdb PAGESIZE 32 K"
$> db2 connect to testdb;
Oracle vs. DB2 Shootout
Oracle SQL syntax supported
PL/SQL support with oracle data type
Similiar behivour adjustable
Copyright © 2015 ITGAIN GmbH 19
ORACLE COMPATIBILITY MODE („98% COMPATIBLE“)
Oracle
SQL> INSERT INTO
<table> AS
SELECT LEVEL FROM DUAL
CONNECT BY LEVEL <
10000;
10.000 rows inserted
SYS.DBMS_ Packages: 554
SYS.UTL_ Packages: 21
V$ Views: 768
DB2
$> db2 INSERT INTO
<TABLE> AS
SELECT LEVEL FROM DUAL
CONNECT BY LEVEL <
10000;
ERROR: (Max recursion 64)
SYS.DBMS_ Packages: 8
SYS.UTL_ Packages: 4
V$ Views: ?
No Oracle Tools (DP, sqlldr)
Oracle vs. DB2 Shootout
Copyright © 2015 ITGAIN GmbH 20
GENERATION OF CSV-FILES
Oracle SQL*Plus
SQL> SET PAGESIZE 0
SQL> SET LINESIZE 1000
SQL> SET COLSEP ','
SQL> SPOOL export.csv
SQL> SELECT * FROM …
SQL> SPOOL OFF
SQL Developer SELECT /*csv*/ *
FROM <table>;
SET SQLFORMAT csv
Run as script
DB2
$> db2 "select *
from cust where … " |
grep … > records.txt
$> db2 EXPORT TO
export.csv of DEL
SELECT * FROM CUST
Oracle vs. DB2 Shootout
1, "Tom", "Barfrau"
2, "Tim", "Bersarker"
3, "Norbert", "Barmann"
Copyright © 2015 ITGAIN GmbH 21
PEFORMANCE: STUDY OF JCSCR
Independant stdy
Tested several RDBMS on identical ardware:
Intel Xeon E5649, 6x2 Cores 2.53GHz, 32GB RAM
MS Windows Server 2008, 64-bit.
Simulates ERP ( 1 Mio. records per table)
10 SQL (SELECT, Joins, UPDATE, DELETE)
Oracle vs. DB2 Shootout
Copyright © 2015 ITGAIN GmbH 22
PEFORMANCE: STUDY OF JCSCR
Runtime of 10 SQL-statements of different complexity:
Oracle vs. DB2 Shootout
0
5
10
15
20
25
Oracle DB2
0
20
40
60
80
100
120
140
Oracle DB2
0
20
40
60
80
100
120
140
Oracle DB2
0
100
200
300
400
500
Oracle DB2
0
200
400
600
800
1000
Oracle DB2
0
500
1000
1500
2000
2500
3000
Oracle DB2
0
100
200
300
400
500
600
700
Oracle DB2
0
2000
4000
6000
8000
10000
Oracle DB2
0
20
40
60
80
100
120
Oracle DB2
0
50
100
150
200
Oracle DB2
Copyright © 2015 ITGAIN GmbH 23
PERFORMANCE: CONCLUSION
According to this study:
For long running queries DB2 is faster
For short running queries Oracle is faster
Oracle vs. DB2 Shootout
0
500
1000
1500
2000
2500
3000
Oracle DB2
0
20
40
60
80
100
120
Oracle DB2
Worst case for Oracle Best case for Oracle
Smaller is better
Copyright © 2015 ITGAIN GmbH 24
SUPPORTED OS
DB2
DB2 LUW
Linux
Unix (HP/UX Itanium, AIX)
Windows
DB2 for z/OS
DB2 for i
Version 7 Release 1 (aka DB2/400)
DB2 Server for VSE & VM
Version 7.4
(Different code base)
Oracle
Windows
Linux
HP/UX Itanium
AIX
Solaris
Oracle vs. DB2 Shootout
Copyright © 2015 ITGAIN GmbH 25
LICENSE MODELS
DB2
Processor Value Unit (PVU)
Authorized User Single InstallLicense (AUSI or AU)
Terabyte Pricing (TB)
Pay per whole TB
Limited Use Socket (LUS)
Licensing by sockets
Fixed Term Licence (FTL)
License for one year
Oracle
Processor
Named User Plus (NUP)
Oracle vs. DB2 Shootout
Copyright © 2015 ITGAIN GmbH 26
EDITIONS
DB2
DB2 Express-C
DB2 Express Server Edition
DB2 Developer Edition
DB2 Workgroup Server Edition
DB2 Enterprise Server Edition
DB2 Advanced Workgroup Server Edition
DB2 Advanced Enterprise Server Edition
Oracle
Express (11g)
Personal Edition
Standard Edition (SE)
Standard Edition 2 (SE2)
Enterprise Edition (EE)
Oracle vs. DB2 Shootout
Copyright © 2015 ITGAIN GmbH 27
DB2: LIMITS & LICENSES
Oracle vs. DB2 Shootout
Express-C (Free)
Express Server
Workgroup Server
Enterprise Server
AdvancedWorkgroup
AdvancedEnterprise
Memory 16 GB 64 GB 128 GB Unlimited 128 GB Unlimited
CPU (Cores)
Throttledfor 2 cores
Throttledfor 8 cores
4 sockets, 16 cores
Unlimited 16 Cores Unlimited
Data 15 TB 15 TB 15 TB Unlimited 15 TB Unlimited
LicenseLimits
N/A Min. 5 AU200 PVUs
Min. 5 AU 25 AU per 100 PVU
25 AU per 100 PVU
None
LicenseOptions
FTL, LUV, PVU, AU
LUS, PVU, AU PVU, AU PVU, AU, TB PVU, AU, TB
„All in“ - - - - ● ●
Copyright © 2015 ITGAIN GmbH 28
DB2 „OPTIONS AND PACKS“
Titel des Foliensatzes
High Value Capability Express
Edition
Workgroup
Server
Edition
Enterprise
Server
Edition
Advanced
Workgroup
Edition
Advanced
Enterprise
Edition
Comments
Performance Management
OPM, WLM, OQWT,
Data Server Manager
Native Encryption
BLU Acceleration feature
DB2 pureScale feature
pureScale member
limitations in WSE
and ESE
Database Partitioning (MPP)
Table and Index Compression
Optim Tools,
Data Server Manager
Rest of Optim tools
Optim tools available
separately
Heterogeneous Data
Virtualization
Federation Server is
available separately
Advanced Recovery Feature
Optim Workload Replay
Included
Separate BVO
Copyright © 2015 ITGAIN GmbH 29
COMPARISON OF CONFIGURATIONS: SINGLE INSTANCE, SE2
DB2 Workgroup Edition
1 AU = 428,20 $
5 Users Minimum
1 CPU = 21.410 $
Max. 4 sockets /16 cores
128 GB RAM
50 Users ~ 1 CPU
2 CPU / 100 User
42.820 $
Oracle SE2
1 NUP = 350 $ + 77 $ = 427 $
10 Users Minimum
1 CPU = 21.350 $
Max. 2 sockets
50 Users ~ 1 CPU
2 CPU / 100 User
42.700 $
Oracle vs. DB2 Shootout
2 CPU / 100 User128 GB RAM
Copyright © 2015 ITGAIN GmbH 30
COMPARISON OF CONFIGURATIONS: 4-NODE CLUSTER (4*4 CPUS)
DB2 Enterprise Advanced
DB Enterprise Advanced
4*4*68.400$= 1.094.400$
PureScale
included 0$
Partitioning
included 0$
Adaptive Compression
included 0$
Total: 1.094.400 $
+ 2 CF Server
Oracle EE + Partitioning + AC
Enterprise Edition
4*4* 57.950$= 927.200$
Real Application Clusters
4*4* 5.060$= 80.960$
Partitioning
4*4* 14.030$= 224.480$
Advanced Compression
4*4* 14.030$= 224.480$
Total: 1.376.160 $
Oracle vs. DB2 Shootout
4 * 4 CPU / 256 GB RAM
Copyright © 2015 ITGAIN GmbH 31
ROUNDUP
Oracle No DB2 mode necessary
Complicated license model
Always consistent
No Lock escalation
DDL auto commit
No Strikes for Table DDL
Standby: Backup, Consistent Read
Column Compression bound toExadata-Storage
No Shared Nothing MPP solution
…
DB2 Oracle compatibility-mode
More flexible and morecomplicated license model
Supports dirty reads
Lock escalation possible
DDL Rollback
3 Strikes Table DDL
Standby: Dirty Reads only
More Advanced compression forTables and Indexes
Massively Parallel Processing (MPP)
…
Oracle vs. DB2 Shootout
Copyright © 2015 ITGAIN GmbH 32
Oracle vs. DB2 Shootout
Q & A