Monday, March 7, 2022

SDA - Database Statistics for Virtual Tables

In order to speed up data processing for objects leveraging HANA Smart Data Access (SDA) there need to be a database statistics build. It is a concept known in many databases. Once the table is indexed, no of records is known, meta data is described etc. the processing of that table is much faster.  It is valid for tables consumed in SAP HANA or SAP BW based on SDA. As the SDA doesn’t store the data in HANA DB persistently it uses virtual tables instead also those can be indexed in order to run the SQL statements in efficient manner – so called efficient query plan.  

In SAP BW there is an ABAP program called RSSDA_CREATE_TABLE_STAT to be used to create database statistics for HANA Virtual Tables. BW’s objects like InfoProviders (aDSO and Open ODS Views) and DataSources are supported by the report. There are three types if the DB statistics that can be generated by the program:


1. Record Count – very basic one, providing only no of records

2. Simple - basic statistics like min, max, null count, count, and distinct count

3. Histogram – most detailed type, it estimates a data distribution in a single-column data source


To incorporate the DB statistics creation for SDA based data sources in BW use ABAP process type in process chains. Higher versions of BW 7.5 even have a new process type (SSDA_CREATE_TABLE_STAT under category 'Other') available for including the creation of statistics in BW Process Chains.

More information:

1990181 - BW HANA SDA: Create Database Statistics for Virtual Tables of Open ODS Views and Near-Line Storage (NLS) Archives

SAP HANA SQL and System Views Reference

No comments: