Whats New on SAP HANA SPS 11 Core Database Capabilities

18
1 2014 SAP AG or an SAP affiliate company. All rights reserved. SAP HANA SPS 11 - What’s New? HANA Core SAP HANA Product Management December, 2015 (Delta from SPS 10 to SPS 11)

Transcript of Whats New on SAP HANA SPS 11 Core Database Capabilities

Short Presentation Title

SAP HANA SPS 11 - Whats New? HANA CoreSAP HANA Product Management December, 2015

(Delta from SPS 10 to SPS 11)

#2014 SAP AG or an SAP affiliate company. All rights reserved.

2014 SAP AG or an SAP affiliate company. All rights reserved.#introduction1

AgendaDynamic Range Partitioning

Result Cache Extension (View Cache) for SQL Views, CalcViews and CDS Views

MiscFlexible Table enhancement, Select with Partition Restriction

2015 SAP SE or an SAP affiliate company. All rights reserved.#Public2

Dynamic Range Partitioning

2015 SAP SE or an SAP affiliate company. All rights reserved.#Public3

Partitioning - OverviewPartitioning supports the creation of very large tables by decomposing them into smaller and more manageable pieces. Partitioning is transparent for most SQL queries and Data Manipulation Language (DML) statements.Typical use cases for partitioningLoad-balancingPerformance: parallelization, partition pruning, mergeOvercome 2 billion rows limitTypes of partitioningSingle-Level partitioning: hash, range, round-robinMulti-Level partitioning: hash-range, hash-round-robin, hash-hash, round-robin-range, range-range

FebJanMarHANA Server 1OTHERS

FebJanMarHANA Server 2OTHERS

2015 SAP SE or an SAP affiliate company. All rights reserved.#Public4

Dynamic Range Partitioning - Overview Before SPS11: Active partition management for fast growing tables required (monitoring, add partition) In case of range partitioned tables it may lead to huge OTHERS partition As of SPS11: allows an automatic and dynamic (via a background job) range partitioning for a table based only on the size of the OTHERS partitioncan be applied to single-level range partitioned tables as well as multi-level hash-range, range-range, roundrobin-range tables

FebJanMarHANA DatabaseOTHERS

FebJanMarHANA DatabaseBefore SPS11Dynamic PartOthersAs of SPS11huge OTHERS partitiondynamically added partition, keeps OTHERS partition small (user defined)

2015 SAP SE or an SAP affiliate company. All rights reserved.#Public5

Dynamic Range Partitioning - Details FunctionalityThe user can specify a threshold value that will trigger the cut of the current OTHERS partition and the creation of a new dynamic partitionDefine the threshold at table level (metadata) or system parameter HANA background job evaluates periodically the number of rows in the current OTHERS partition and generates a new dynamic range partition from OTHERS, if the threshold is exceededPre-requisite: The range partitioning column is a non-null monotonically increasing valueThe following datatypes for the range partitioning column are supported: INT, VARCHAR, DATE, TIMESTAMP, SECONDDATESQL Syntax: CREATE COLUMN TABLE T1 (A VARCHAR(5) NOT NULL, NUM INTEGER NOT NULL) PARTITION BY RANGE (A AS INT) (PARTITION OTHERS DYNAMIC THRESHOLD 3000000);ALTER TABLE T PARTITION OTHERS DYNAMIC THRESHOLD 1000000; ALTER TABLE T PARTITION OTHERS NO DYNAMICConfiguration Parameter: indexserver.ini [partitioning] dynamic_range_check_time_interval_sec (default value: 900; deactivate: -1): Interval in sec for the Dynamic Range Background Job dynamic_range_default_threshold (default value: 100 000 000): number of rows; used when no threshold is defined in table metadata

2015 SAP SE or an SAP affiliate company. All rights reserved.#Public6

Result Cache Extension (View Cache)for SQL Views, CalcViews and CDS Views

2015 SAP SE or an SAP affiliate company. All rights reserved.#Public7

OverviewCustomer Issue: Complex CDS-views have been suffered from lack of multi-user scalability due to large CPU consumptionSolution: Avoid redundant computation of identical and frequent queries in read-mostly workloads for complex CDS Views, SQL Views and CalcViewsBasic Concept:Query result on complex view is cached and refreshed periodically. The maximum staleness restriction can be specified by users.Features: Ease of use: No application modification necessarySelectively enabled for sets of queries using a view definition (DDL) statementTwo types of view caches: aggregated cache that allows explicit aggregation types for caching (MIN, MAX, COUNT, SUM)parameterized cache (caching of table function)

LimitationsNo data freshness guarantees for view caches (depends on user definition)

AvailabilityPilotversion with rev102 (SAP note 2232909)GA with SPS11

2015 SAP SE or an SAP affiliate company. All rights reserved.#Public8

How it worksInitial PlanTop-level view matchingProjectGroupByFilterCDS_VIEWProjectView Cache(CDS_VIEW)Check if GroupBy is usedCheck if projection columns & aggregation type is matched with cache specView Cache on CDS_VIEWFilterGroupByProjectNESTED_CDS_VIEWJoinExecution Plan after View-Cache matching (name-based matching)First query generates the cache entry; Cache will be refreshed periodically => defined by retention time

2015 SAP SE or an SAP affiliate company. All rights reserved.#Public9

How to useView related DDL:CREATE VIEW SIMPLE_VIEW AS (SELECT A, SUM(KF1), MAX(KF2), MIN(KF3), COUNT(KF4) FROM SIMPLE_TABLE GROUP BY A) WITH CACHE RETENTION 100;ALTER VIEW DROP | ADD | ALTER CACHE ...;

Table function related DDL: CREATE FUNCTION SIMPLE_FUNCTION (INPUT_VAL INT) RETURNS TABLE (A INT, KF1 INT, KF2, INT, KF3 INT, KF4 INT) LANGUAGE SQLSCRIPT ASBEGIN RETURN A, SUM(KF1 + INTPUT_VAL), MIN(KF2), MIN(KF3), KF4 FROM SIMPLE_TABLE GROUP BY A;WITH CACHE RETENTION 100;

System Views:SELECT * FROM RESULT_CACHE; shows all cached views and table functionsSELECT * FROM RESULT_CACHE_COLUMNS; shows all cached columns of cached view and table functions

2015 SAP SE or an SAP affiliate company. All rights reserved.#Public10

How to use - cont.

Monitoring Views:SELECT * FROM M_RESULT_CACHE; shows cache-related information, e.g. cache id, cache key, memory size, record countSELECT * FROM M_RESULT_CACHE_EXCLUSIONS; list of excluded views from caching Views in this list will not be cached by HANA, even if the user has created the view cache HANA adds views to the list automatically, if the cache result exceeds total cache size and cache refresh time > cache retention time

Configuration:indexserver.ini [result_cache] enabled = yes (default: no);indexserver.ini [result_cache] total_size = (default: 10000);Note: The section [result_cache] must be created in the indexserver.ini

System Commands:ALTER SYSTEM CLEAR RESULT CACHE; ALTER SYSTEM REFRESH RESULT CACHE ; object_name can be found in system view RESULT_CACHE

2015 SAP SE or an SAP affiliate company. All rights reserved.#Public11

Remarks on other Result Cache in HANAColumn Store Result Cache ( [cache] -> resultcache_enabled = yesLimitations: Only usable for queries entirely operating on column store tables/viewsCache is invalidated if one of the base tables the query operates on is updatedEach query and parameter set has a separate cache entrySQL-Syntax:SELECT ... WITH PARAMETERS ('CACHE'=('REALTIME')); the result will be cached, which is the default. SELECT ... WITH PARAMETERS ('CACHE'=('TIME_CONTROLLED', 'N')); the result will be cached for N secondsALTER SYSTEM CLEAR COLUMN RESULT CACHE; clears the result cache

2015 SAP SE or an SAP affiliate company. All rights reserved.#Public12

Miscellaneous

2015 SAP SE or an SAP affiliate company. All rights reserved.#Public13

Flexible Table enhancementFlexibel Table: schema-flexible database tables that support data items with greatly varying sets of attributesUse Cases: store classification data (e.g. search), graph data, input data sets (e.g. KXEN) Feature: Dynamic columns (but has at least one static column predefined in the schema)Dynamic columns can be created automatically during a data insertion operation, an update operation, or a replace/upsert operationDynamic column is automatically dropped if and only if no values are left (NULL values)By default, NVARCHAR(5000) will be used as the default data type for dynamic columns Enhancement: Automatic Datatype Detection by scanning the input data and deriving the best matching data type from it The data type is not changed after the initial creation of the column SQL Syntax: CREATE COLUMN TABLE ( ) WITH SCHEMA FLEXIBILITY (DEFAULT DATA TYPE *)

Automatic Data Type Promotionthe existing column type of a dynamic column will be altered to a more generic data type that is able to store the old and the new data without any loss of informationSQL Syntax: CREATE COLUMN TABLE ( ) WITH SCHEMA FLEXIBILITY (AUTO DATA TYPE PROMOTION)

Combination of both: SQL Syntax: CREATE COLUMN TABLE ( ) WITH SCHEMA FLEXIBILITY (DEFAULT DATA TYPE * AUTO DATA TYPE PROMOTION)

2015 SAP SE or an SAP affiliate company. All rights reserved.#Public14

Flexible Table with Automatic Datatype Detection / Promotion

SESSION LAYERSQL Compiler front-endNormal Table

COL1 INTEGERCOL2 VARCHARRule 1: Add column Action: Compare input values list and actual table columns. Decide type and execute ALTER TABLE if applicable.Rule 2: Promote datatypeAction: Decide promote type and execute ALTER COLUMN if applicable.Flexible Table

COL1 INTEGERCOL2 VARCHAR

INSERT INTO Tab(COL1, COL2, COL3) VALUES(1, xyz, 5);

ExceptionSQL Compiler front-end

Retry

Add columnFlexible Table

COL1 INTEGERCOL2 VARCHARCOL3 INTEGERSQL Compiler front-end

Retry

Alter columnFlexible Table

COL1 INTEGERCOL2 VARCHARCOL3 INTEGER

Flexible Table

COL1 INTEGERCOL2 VARCHARCOL3 DECIMAL

INSERT INTO FlexTab(COL1, COL2, COL3) VALUES(1, abc, 5); INSERT INTO FlexTab(COL1, COL2, COL3) VALUES(2, xyz, 1.5);

2015 SAP SE or an SAP affiliate company. All rights reserved.#PublicSELECT with partition restriction DefinitionAn optional explicit specification of a partition or a list of partitions followed by the table reference in FROM clause of SELECT and target table reference of DMLsUse Case: Application-controlled access to dedicated partitions of a table Example: a table is defined a partitioned table with 4 hash partitions CREATE COLUMN TABLE mytab (a INT, b INT, c INT, PRIMARY KEY (a, b)) PARTITION BY HASH (a, b) PARTITIONS 4access or modifies the 1st partition SELECT * FROM mytab PARTITION (1) WHERE a = 1 AND b = 1;the partition ID can be obtained from the monitoring view M_CS_PARTITIONS

Current Scope: Only single table access without join & aggregation will be handled in SPS11

2015 SAP SE or an SAP affiliate company. All rights reserved.#Public16

DisclaimerThis presentation outlines our general product direction and should not be relied on in making a purchase decision. This presentation is not subject to your license agreement or any other agreement with SAP. SAP has no obligation to pursue any course of business outlined in this presentation or to develop or release any functionality mentioned in this presentation. This presentation and SAPs strategy and possible future developments are subject to change and may be changed by SAP at any time for any reason without notice. This document is provided without a warranty of any kind, either express or implied, including but not limited to, the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. SAP assumes no responsibility for errors or omissions in this document, except if such damages were caused by SAP intentionally or grossly negligent.

2015 SAP SE or an SAP affiliate company. All rights reserved.#Public

17

Thank youContact information

Ruediger KarlSAP HANA Product [email protected]

2015 SAP SE or an SAP affiliate company. All rights reserved.

2015 SAP SE or an SAP affiliate company. All rights reserved.#Public18

2015 SAP SE or an SAP affiliate company. All rights reserved.No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP SE or an SAP affiliate company.SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in Germany and other countries. Please see http://global12.sap.com/corporate-en/legal/copyright/index.epx for additional trademark information and notices.Some software products marketed by SAP SE and its distributors contain proprietary software components of other software vendors.National product specifications may vary.These materials are provided by SAP SE or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP SE or its affiliated companies shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP SE or SAP affiliate company products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty. In particular, SAP SE or its affiliated companies have no obligation to pursue any course of business outlined in this document or any related presentation, or to develop or release any functionality mentioned therein. This document, or any related presentation, and SAP SEs or its affiliated companies strategy and possible future developments, products, and/or platform directions and functionality are all subject to change and may be changed by SAP SE or its affiliated companies at any time for any reason without notice. The information in this document is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. All forward-looking statements are subject to various risks and uncertainties that could cause actual results to differ materially from expectations. Readers are cautioned not to place undue reliance on these forward-looking statements, which speak only as of their dates, and they should not be relied upon in making purchasing decisions.

2015 SAP SE or an SAP affiliate company. All rights reserved.#Public19