SAP HANA Performance Guide for Developers Company

SAP HANA Performance Guide for Developers Company

PUBLIC SAP HANA Platform 2.0 SPS 04 Document Version: 1.1 – 2019-10-31 SAP HANA Performance Guide for Developers company. All rights reserved. All rights company. affiliate THE BEST RUN 2019 SAP SE or an SAP SE or an SAP SAP 2019 © Content 1 SAP HANA Performance Guide for Developers......................................6 2 Disclaimer................................................................. 7 3 Schema Design..............................................................8 3.1 Choosing the Appropriate Table Type...............................................8 3.2 Creating Indexes..............................................................9 Primary Key Indexes........................................................10 Secondary Indexes.........................................................11 Multi-Column Index Types....................................................12 Costs Associated with Indexes.................................................13 When to Create Indexes..................................................... 14 3.3 Partitioning Tables............................................................15 3.4 Query Processing Examples.....................................................16 3.5 Delta Tables and Main Tables....................................................18 3.6 Denormalization.............................................................19 3.7 Additional Recommendations....................................................21 4 Query Execution Engine Overview...............................................22 4.1 New Query Processing Engines.................................................. 24 4.2 ESX Example...............................................................25 4.3 Disabling the ESX and HEX Engines...............................................26 5 SQL Query Performance......................................................28 5.1 SQL Process............................................................... 28 SQL Processing Components.................................................29 5.2 SAP HANA SQL Optimizer......................................................31 Rule-Based Optimization....................................................32 Cost-Based Optimization....................................................36 Decisions Not Subject to the SQL Optimizer.......................................48 Query Optimization Steps: Overview ............................................49 5.3 Analysis Tools.............................................................. 50 SQL Plan Cache...........................................................50 Explain Plan............................................................. 54 Plan Visualizer............................................................60 SQL Trace...............................................................68 SQL Optimization Step Debug Trace............................................70 SQL Optimization Time Debug Trace............................................77 SAP HANA Performance Guide for Developers 2 PUBLIC Content Views and Tables..........................................................82 5.4 Case Studies...............................................................83 Simple Examples..........................................................83 Performance Fluctuation of an SDA Query with UNION ALL............................95 Composite OOM due to Memory Consumed over 40 Gigabytes by a Single Query........... 103 Performance Degradation of a View after an Upgrade Caused by Calculation View Unfolding ..................................................................... 109 5.5 SQL Tuning Guidelines........................................................116 General Guidelines........................................................116 Avoiding Implicit Type Casting in Queries.........................................117 Avoiding Inefficient Predicates in Joins ..........................................118 Avoiding Inefficient Predicates in EXISTS/IN ......................................123 Avoiding Set Operations ....................................................124 Improving Performance for Multiple Column Joins..................................125 Using Hints to Alter a Query Plan..............................................126 Additional Recommendations................................................ 131 6 SQLScript Performance Guidelines.............................................134 6.1 Calling Procedures.......................................................... 134 Passing Named Parameters................................................. 135 Changing the Container Signature.............................................136 Accessing and Assigning Variable Values........................................ 136 Assigning Scalar Variables...................................................138 6.2 Working with Tables and Table Variables........................................... 138 Checking Whether a Table or Table Variable is Empty................................138 Determining the Size of a Table Variable or Table...................................140 Accessing a Specific Table Cell................................................141 Searching for Key-Value Pairs in Table Variables....................................142 Avoiding the No Data Found Exception..........................................144 Inserting Table Variables into Other Table Variables .................................144 Inserting Records into Table Variables.......................................... 145 Updating Individual Records in Table Variables.................................... 147 Deleting Individual Records in Table Variables.....................................148 6.3 Blocking Statement Inlining with the NO_INLINE Hint..................................150 6.4 Skipping Expensive Queries.................................................... 151 6.5 Using Dynamic SQL with SQLScript.............................................. 152 Using Input and Output Parameters............................................153 6.6 Simplifying Application Coding with Parallel Operators.................................154 Map Merge Operator...................................................... 154 Map Reduce Operator......................................................156 6.7 Replacing Row-Based Calculations with Set-Based Calculations.......................... 162 6.8 Avoiding Busy Waiting........................................................165 SAP HANA Performance Guide for Developers Content PUBLIC 3 6.9 Best Practices for Using SQLScript...............................................166 Reduce the Complexity of SQL Statements ...................................... 167 Identify Common Sub-Expressions............................................ 167 Multi-Level Aggregation.....................................................167 Reduce Dependencies..................................................... 168 Avoid Using Cursors.......................................................168 Avoid Using Dynamic SQL...................................................170 7 Optimization Features in Calculation Views.......................................171 7.1 Calculation View Instantiation...................................................172 7.2 Setting Join Cardinality....................................................... 176 Join Cardinality.......................................................... 177 Examples...............................................................178 7.3 Optimizing Join Columns......................................................198 Optimize Join Columns Option............................................... 198 Prerequisites for Pruning Join Columns......................................... 199 Example...............................................................201 7.4 Using Dynamic Joins.........................................................210 Dynamic Join Example..................................................... 211 Workaround for Queries Without Requested Join Attributes...........................217 7.5 Union Node Pruning.........................................................220 Pruning Configuration Table.................................................222 Example with a Pruning Configuration Table......................................222 Example with a Constant Mapping.............................................225 Example Tables..........................................................227 7.6 Influencing the Degree of Parallelization...........................................228 Example: Create the Table.................................................. 229 Example: Create the Model..................................................230 Example: Apply Parallelization Based on Table Partitions.............................233 Example: Apply Parallelization Based on Distinct Entries in a Column....................236 Verifying the Degree of Parallelization.......................................... 238 Constraints.............................................................241 7.7 Using "Execute in SQL Engine" in Calculation Views...................................242 Impact of the "Execute in SQL Engine" Option ....................................243 Checking Whether a Query is Unfolded......................................... 246 Influencing Whether a Query is Unfolded........................................246 7.8 Push Down Filters in Rank Nodes................................................248 7.9 Condensed Performance Suggestions...........................................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    256 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us