SQLScript - A New Avatar of SQL in HANA

In this article we will learn about SQLScript in SAP HANA.

Introduction of SQLScript:

The SAP HANA database has its own scripting language named SQLScript.

  • SQLScript is a collection of extensions to Structured Query Language (SQL).
  • It is used to push down data intensive logic into the database.

The extensions are:


Motivation & Goals of SQLScript:
  • Improve readability and structure of data-intensive logic 
    • Pass results of one SQL statement to another
    • Break complex SQL into smaller parts
  • Bring data-intensive application logic close to database 
    • Declarative Logic including SELECT queries, Built-In CalcEngine functions
    • Orchestration Logic including DDL, DML, assignment, imperative logic
  • Container for special-purpose operator logic 
    • R script


Why Do We Need SQLScript?

The main goal of SQLScript is to allow the execution of data intensive calculations inside SAP HANA.
There are two reasons why this is required to achieve the best performance:
  • Moving calculations to the database layer eliminates the need to transfer large amounts of data from the database to the application
  • Calculations need to be executed in the database layer to get the maximum benefit from SAP HANA features such as fast column operations, query optimization and parallel execution. 
  • If applications fetch data as sets of rows for processing on application level they will not benefit from these features


Advantage of SQLScript:

Compared to plain SQL queries, SQLScript has the following advantages: 


Continue reading:

1 comment: