HANA Architecture Basics
What makes SAP HANA different from a traditional disk-based database?
HANA is an in-memory, columnar database: tables live in RAM in column format, which makes aggregations and scans dramatically faster. It combines OLTP and OLAP in one engine, so operational and analytical workloads run on the same data without replication. For developers, the practical effect is that heavy lifting moves into the database layer.
Row store vs column store — when does each apply?
Column store is the default and suits analytical access — reading few columns across many rows. Row store fits transactional patterns touching whole rows by primary key, like configuration tables. HANA chooses column store automatically for most tables; you switch to row store explicitly only for narrow, write-heavy system tables.
What is code push-down and why do interviewers keep asking about it?
Code push-down means executing data-intensive logic inside HANA (SQLScript, CDS, calculation views) instead of fetching rows to the application server. Less data transfer, parallel columnar execution, and lower ABAP memory consumption. If your answer to a performance question doesn't mention push-down, it is probably incomplete.
Key takeaway: HANA rewards set-based, in-database logic and punishes row-by-row ABAP loops over large datasets. Design with that asymmetry in mind.
SQLScript and AMDP
What is SQLScript, and when should a developer write it?
SQLScript is HANA's procedural extension to SQL for complex data logic — loops, conditionals, and table variables — that plain SQL cannot express. Use it inside table functions, procedures, and calculation view script nodes. Prefer declarative SQL or CE functions first; reach for imperative SQLScript only when set logic is genuinely insufficient.
What is AMDP and how does it relate to ABAP?
ABAP Managed Database Procedures let ABAP developers write database procedures in SQLScript managed as ABAP repository objects. The AMDP class method carries the SQLScript body, runs in HANA, and is called like a normal ABAP method. It is the sanctioned way to put HANA-native logic under ABAP version control and transport.
CLASS zcl_calc DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES if_amdp_marker_hdb.
METHODS get_totals
IMPORTING VALUE(iv_bukrs) TYPE bukrs
EXPORTING VALUE(et_data) TYPE ztt_totals.
ENDCLASS.
"Implementation uses METHOD ... BY DATABASE PROCEDURE
" FOR HDB LANGUAGE SQLSCRIPT.
What are table variables and CE functions in SQLScript?
Table variables hold intermediate result sets within a procedure without materializing temp tables. CE functions (CE_PROJECTION, CE_AGGREGATION, CE_JOIN) are the older calculation-engine API for column operations. Modern code favors plain SQLScript SELECTs; CE functions survive mainly in migrated legacy procedures.
Modeling: Calculation Views vs CDS
Calculation view vs CDS view — which should you use?
Calculation views are HANA-native graphical/SQLScript models, strong for complex analytics with hierarchies, unions, and scripted nodes. CDS views are ABAP-managed, transportable with the application, and integrate with OData, DCL, and RAP. In S/4HANA ABAP development, CDS is the default; calculation views fit BW/4HANA and native HANA scenarios.
What are the node types in a graphical calculation view?
Projection nodes filter and shape columns, join nodes combine data sources, union nodes stack them, aggregation nodes group and sum, and rank nodes compute top-N. Script-based nodes embed SQLScript for logic the graphical nodes cannot express. Knowing the node palette and when to use a script node is standard interview fare.
How do input parameters work in calculation views?
Input parameters make a calculation view context-dependent — a posting date or company code the consumer supplies at runtime. They enable currency conversion with date-specific rates and partitioned pruning. From ABAP, pass them via parameterized CDS consumption or explicit parameter mapping in the data preview.
Key takeaway: CDS for ABAP-managed models with security and OData; calculation views for native HANA analytics. Input parameters keep both reusable.
Performance and HANA Cloud
How do you diagnose a slow HANA query?
Start with PlanViz (the explain plan visualizer) to see where time goes — joins, aggregations, or data transfer. Check for missing partition pruning, filters applied too late, and row-store tables scanned in bulk. In the ABAP stack, ST05's SQL trace and the SQL Monitor show which statements the application actually fires.
What is partitioning and when does it help?
Partitioning splits large tables across multiple hosts or storage units by range or hash, enabling parallel scans and partition pruning — skipping irrelevant partitions when the query filters on the partition key. Date-range partitioning on transactional tables is the classic win. Wrong partition keys, though, just add overhead.
What should developers know about SAP HANA Cloud vs on-premise HANA?
HANA Cloud is the managed database-as-a-service on BTP: elastic scaling, separate compute and storage, and native integration with CAP and the Cloud Foundry environment. Developers connect via service bindings and write the same SQLScript and CDS. The operational differences — backup, scaling, multi-environment handling — are platform-managed rather than DBA tasks.
How does data tiering affect development choices?
HANA offers hot/warm/cold tiers: hot data in memory, warm in extended storage, cold in the data lake. Developers should be aware that warm-storage tables have query restrictions — some operations are slower or unsupported. Design partitioning and aging strategies with the functional team so rarely-touched history doesn't consume expensive memory.
What is the role of HANA in the clean-core S/4HANA strategy?
HANA hosts the CDS-based virtual data model that keeps custom logic out of modified standard tables. Extensions live in custom CDS views and side-by-side services rather than core modifications. For developers, clean core means: build on released CDS views and APIs, never on private tables.
Got a HANA curveball from a recent interview? Post it in the comments.