customer analyzing sap cds on db2 - ibmsap optimizer profiles for db2 hint specification detached...
TRANSCRIPT
Analyzing SAP CDS on DB2Jörg Maier, SAP
April 14, 2016
Customer
© 2016 SAP SE or an SAP affiliate company. All rights reserved. 2Customer
Legal informationPlease note
IBM’s statements regarding its plans, directions, and intent are subject to change or withdrawal without notice at IBM’s sole discretion. Information
regarding potential future products is intended to outline our general product direction and it should not be relied on in making a purchasing decision.
The information mentioned regarding potential future products is not a commitment, promise, or legal obligation to deliver any material, code or
functionality. Information about potential future products may not be incorporated into any contract. The development, release, and timing of any future
features or functionality described for our products remains at our sole discretion.
Performance is based on measurements and projections using standard IBM benchmarks in a controlled environment. The
actual throughput or performance that any user will experience will vary depending upon many factors, including
considerations such as the amount of multiprogramming in the user’s job stream, the I/O configuration, the storage
configuration, and the workload processed. Therefore, no assurance can be given that an individual user will achieve results
similar to those stated here.
Availability. References in this presentation to IBM products, programs, or services do not imply that they will be available in all countries in which IBM
operates.
The workshops, sessions and materials have been prepared by IBM or the session speakers and reflect their own views. They are provided for
informational purposes only, and are neither intended to, nor shall have the effect of being, legal or other guidance or advice to any participant. While
efforts were made to verify the completeness and accuracy of the information contained in this presentation, it is provided AS-IS without warranty of any
kind, express or implied. IBM shall not be responsible for any damages arising out of the use of, or otherwise related to, this presentation or any other
materials. Nothing contained in this presentation is intended to, nor shall have the effect of, creating any warranties or representations from IBM
or its suppliers or licensors, or altering the terms and conditions of the applicable license agreement governing the use of IBM software.
All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have
achieved. Actual environmental costs and performance characteristics may vary by customer. Nothing contained in these materials is intended to, nor
shall have the effect of, stating or implying that any activities undertaken by you will result in any specific sales, revenue growth or other results.
© 2016 SAP SE or an SAP affiliate company. All rights reserved. 3Customer
Agenda
Introduction
Core Data Services – chances and challenges
Recent development
Motivation
Increasing use of CDS with recent SAP shipments
© 2016 SAP SE or an SAP affiliate company. All rights reserved. 4Customer
Agenda
Working on example queries – how to dismantle complex CDS queries
ZCL_ANYDB_CDSTEST_TORQUAN_Q
ZCP_PERF_POSREP_EOD
CDS – DB2 Administration
CATMAINT (e.g. after System Copies) -> How to DROP and re-CREATE CDS objects
SAP Optimizer profiles for DB2
© 2016 SAP SE or an SAP affiliate company. All rights reserved. 5Customer
Introduction – Core Data Services
• CDS from SAP point of view: CDS view as re-usable building blocks to get an SAP object out of the DBMS
o Encourage app developers to build views over view over views over …
o Speed up app development
o Enable app developer with no DB know-how to write efficient code
Improved elapse time by exploiting more DBMS functionality (UDF, table function, scalar function)
Improved elapse time by running generic app functionality within the DBMS
• CDS from DB2 point of view: Cope with a lot more DB2 objects (other than tables and indexes)
o The objects often depend of each other (maintenance challenge/dependency graph)
o UDFs called often (performance challenge, debugging capability missing, monitoring challenge)
o Need to map ABAP semantics to DB2 semantics, for example RTRIM, CASE
o Lots of DECFLOAT usage because of DECIMAL limitations
© 2016 SAP SE or an SAP affiliate company. All rights reserved. 6Customer
Motivation
• OLAP and OLTP move closer together
• SELECTs get complex
Increasing use of CDS in recent SAP shipment
SAP ERP EHP8 is shipped with 2300+ CDS views
CDS is used as well in other products
– SOLMAN 7.2
– Plain Netweaver 7.4 and 7.5 use CDS for ABAP development
© 2016 SAP SE or an SAP affiliate company. All rights reserved. 7Customer
CDS in NetWeaver 7.50 and beyond
• New NW 7.50 SQL and CDS Features
• Built-in data type INT8
• Global Temporary Tables (GTTs)
• SELECT with UNION
• INSERT FROM SELECT
• SQL expressions on left hand sides of comparisons, e.g., ROUND, CONCAT, LPAD, RTRIM
• New scalar UDFs like
• DATS_IS_VALID(date), DATS_DAYS_BETWEEN(d1,
d2),TSTMP_CURRENT_UTCTIMESTAMP()
• ABAP runtime automatically maintains global session variables
• CLIENT, APPLICATIONUSER, LOCALE_SAP
© 2016 SAP SE or an SAP affiliate company. All rights reserved. 8Customer
Sample Query I - ZCL_ANYDB_CDSTEST_TORQUAN_Q
SELECT *…. Typical CDS SQL. Simple query,
here on a table UDF
© 2016 SAP SE or an SAP affiliate company. All rights reserved. 9Customer
Sample Query I - ZCL_ANYDB_CDSTEST_TORQUAN_Q
© 2016 SAP SE or an SAP affiliate company. All rights reserved. 10Customer
Sample Query I - ZCL_ANYDB_CDSTEST_TORQUAN_Q
• 38 tables
• 3 table UDFs
• 41 views
• 2 scalar
functions
© 2016 SAP SE or an SAP affiliate company. All rights reserved. 11Customer
Sample Query I - ZCL_ANYDB_CDSTEST_TORQUAN_Q
© 2016 SAP SE or an SAP affiliate company. All rights reserved. 12Customer
Sample Query II - ZCP_PERF_POSREP_EOD
© 2016 SAP SE or an SAP affiliate company. All rights reserved. 13Customer
Sample Query II - ZCP_PERF_POSREP_EOD
© 2016 SAP SE or an SAP affiliate company. All rights reserved. 14Customer
Sample Query II - ZCP_PERF_POSREP_EOD
• Simple dependency line
• Fetch rows from underlying
object, usually only one
dependant object
• Only one join
(ICOEX110EODL)
• Two affected tables
© 2016 SAP SE or an SAP affiliate company. All rights reserved. 15Customer
Sample Query II - ZCP_PERF_POSREP_EOD
• original query with markers
substituted by literals
• >20 seconds,
• CCOEXRP110POEODQ
• >20 seconds
© 2016 SAP SE or an SAP affiliate company. All rights reserved. 16Customer
Sample Query II - ZCP_PERF_POSREP_EOD
• ICOEX110EODL
• >20 seconds
• PCOEX110IL
• < 1 millisecond
© 2016 SAP SE or an SAP affiliate company. All rights reserved. 17Customer
Sample Query II - ZCP_PERF_POSREP_EOD
• Query comparable to ICOEX110EODL
• TUDF replaced by table
• Predicates of lower level functions added
• < 1.7 seconds
© 2016 SAP SE or an SAP affiliate company. All rights reserved. 18Customer
Sample Query II - ZCP_PERF_POSREP_EOD
Toplevel query on DB2 12 ESP
< 1 sec
© 2016 SAP SE or an SAP affiliate company. All rights reserved. 19Customer
Dependency Browser
Possibility to browse the dependencies of
Views
Table Functions
Scalar Functions
Tables
Procedures
Global Variables
Triggers
Two detail views
Get detail information on the selected object
Display the create statement of the selected object
Structured display of the dependencies
of all the dependent object
Possibility to look for dependencies
up and downwards
© 2016 SAP SE or an SAP affiliate company. All rights reserved. 20Customer
Dependency BrowserTrigger Monitoring
© 2016 SAP SE or an SAP affiliate company. All rights reserved. 21Customer
CATMAINT SCHEMA SWITCHDEPENDENCY HANDLING
Issue
• Some objects need to be removed before calling SCHEMA
SWITCH
• Old method of re-activation via R3ldctl does not work for
CDS objects
Suggested solution
• DROP objects in dependency order. Plan is to write a tool
to generate the DROP DDL, or execute the DROP
immediately
• Re-activate scalar UDFs with RUTCNVFUNCCRE1 (from 7.4
SP8) and SAP CDS views with RUTDDLSACT
© 2016 SAP SE or an SAP affiliate company. All rights reserved. 22Customer
SAP Optimizer profiles for DB2Hint specification detached from ABAP sources
Issue
• CDS queries benefit from specific settings (DEGREE, QUERY OPTIMIZATION,
SUBSTITUTE_VALUES)
• Current hint mechanisms do not apply:
• BIND QUERY fails when stmt changes (different order, select list, …)
• DSN_PROFILE_TABLE no match possible for specific VIEW/table UDF object
• ABAP hints can not be used for generated stmts (e.g. SADL)
Suggested solution
• Specify a hint/guideline as a row in an SAP table (DB2_OPTIM_PROFIL).
• Supported Guidelines for now: QUERY_ACCELERATION and DEGREE
• This feature is the our development release lib_dbsl; it will be available in 7.51.We plan to do a
down port to 745 kernels (SAP NetWeaver 7.50).
• See Note 2270401 - DB2 z/OS: SAP Optimizer profiles for DB2