bcquality/microsoft/knowledge/performance/prefer-related-table-over-extension-on-hot-ledgers.md
Jesper Schulz-Wedde b6da405376 Improve partner onboarding and documentation navigation
Lead with a complete plugin quick start and add task-oriented usage, troubleshooting, customization, and contribution guides. Preserve the broader plugin framing, correct conflicting contract guidance, support Agents folder reviews, and align repository validation. Convert existing sample references to clickable links without changing knowledge rules.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-09 17:25:29 +02:00

1.9 KiB

bc-version domain keywords technologies countries application-area
23..
performance
tableextension
companion-table
gl-entry
related-table
flowfield
hot-table
al
w1
all

Prefer a related table over stored fields on hot ledgers

Contributions welcome — open a PR to refine or extend this article.

Description

Since v23, all extensions on the same base table share at most one companion-table join, and the platform automatically excludes that join on List, ListPart, and OData pages when partial records are in effect and no extension field is loaded. However, the join is still paid on every posting path and any AL code that accesses an extension field — or that runs without partial-record semantics. On hot tables — G/L Entry, Item Ledger Entry, Cust. Ledger Entry — even a single access per posted row adds up at volume. A related table keyed by the ledger Entry No., optionally surfaced with a FlowField or FactBox, leaves the base read path entirely untouched. Agents extend G/L Entry because it is "where the posting already is".

Best Practice

Put optional, sparse, or integration attributes in a related table with the ledger entry number as primary key. Show them from a FactBox or a FlowField. Use a tableextension stored field only when the value must appear as a native list column and is read on almost every access.

See sample: prefer-related-table-over-extension-on-hot-ledgers.good.al.

Anti Pattern

tableextension on "G/L Entry" (or another posting table) that adds several stored Text/Blob fields used only by one integration. The companion join is paid on every posting and on any AL code path that loads extension fields, even when those columns are not needed for the current operation.

See sample: prefer-related-table-over-extension-on-hot-ledgers.bad.al.