7.4Bloom · AnNot started

Hints & buffering

Reading depth

What you'll learn

Prefer rewrites over hints (hints outlive their reason); pick the right ABAP buffer mode; and remember FAE and BYPASSING BUFFER skip the buffer, which is not the HANA cache.

  • Hints go via `%_HINTS`, e.g. `%_HINTS HDB 'USE_HEX_PLAN'` on HANA.
  • Prefer a statement rewrite over a hint — hints outlive their justification.
  • Buffer modes: single-record (point lookups), generic (leading-key groups), full (tiny config tables).

Database hints let you override the optimizer from Open SQL via the `%_HINTS` clause — for HANA, for instance, `%_HINTS HDB 'USE_HEX_PLAN'`. They are a last resort, not a first move: a hint freezes a decision that was correct for one data distribution and one release, and it tends to outlive its justification, so a statement rewrite that makes the optimizer choose the right plan on its own is almost always preferable to pinning the plan with a hint.

The ABAP table buffer is a separate, application-server-side cache with three modes. Single-record buffering caches individual rows by full key — best for frequent point lookups. Generic-area buffering caches groups of rows sharing a leading key prefix — useful for customizing tables read by a leading key. Full buffering caches the whole table — for tiny, rarely-changing config tables. Choosing the mode is a property of the table and the access pattern, not the statement.

Two facts trip people up. FOR ALL ENTRIES and the explicit `BYPASSING BUFFER` addition both skip the ABAP buffer entirely, so a 'buffered' table read with FAE still goes to the database. And the HANA column-store cache is *not* the ABAP buffer — they are independent layers, and both can be in play for the same table. Reasoning about performance means knowing which cache, if any, a given read actually consults.

Key points

  • Hints go via `%_HINTS`, e.g. `%_HINTS HDB 'USE_HEX_PLAN'` on HANA.
  • Prefer a statement rewrite over a hint — hints outlive their justification.
  • Buffer modes: single-record (point lookups), generic (leading-key groups), full (tiny config tables).
  • FOR ALL ENTRIES and BYPASSING BUFFER skip the ABAP buffer.
  • The HANA column-store cache is independent of the ABAP buffer; both can apply.

Examples

An HDB hint in Open SQL

A HANA hint pins the plan — use it only when a rewrite cannot get the optimizer there, because the hint will outlive the data distribution that justified it.

ABAPselect * from bseg
  where bukrs = '1000'
  %_HINTS HDB 'USE_HEX_PLAN'
  into table @data(lt_bseg).

Source notes: clean-core-curriculum §7.4

Ask Claude

Build a prompt from this lesson + your question and open a fresh Claude chat with it pre-filled — handy for adapting a before/after pattern to your own object.