code change · fixAL Developmentofficial - Microsoftreviewed - checked by Opus

#135 Correct severe misconception about SetCurrentKey in the knowledge base

Documentation corrected to clarify that SetCurrentKey only affects SQL sort order, not index selection by SQL Server, removing outdated guidance that misled AL developers.

Pull request · merged into main on 2026-08-23 by dcenic · 6 files (+74 -40), 6 AL · fix · tier official · reviewed (checked by Opus)

What changed

  • SetCurrentKey generates ORDER BY clauses, not SQL index hints
  • SQL Server query optimizer can ignore the specified key entirely
  • Using SetCurrentKey when sorting is unnecessary hurts performance
  • Removed incorrect article claiming SetCurrentKey aligns keys with filters
  • Added accurate article explaining SetCurrentKey’s actual behavior

AL objects touched

  • microsoft/knowledge/performance/apply-filters-before-iterating.md: modified, not in the BC? snapshot
  • microsoft/knowledge/performance/setcurrentkey-aligns-key-with-filters.good.al: removed
  • microsoft/knowledge/performance/setcurrentkey-aligns-key-with-filters.md: removed
  • microsoft/knowledge/performance/setcurrentkey-sets-sort-order-not-index-hint.bad.al: added, not in the BC? snapshot yet
  • microsoft/knowledge/performance/setcurrentkey-sets-sort-order-not-index-hint.good.al: added, not in the BC? snapshot yet
  • microsoft/knowledge/performance/setcurrentkey-sets-sort-order-not-index-hint.md: added, not in the BC? snapshot yet

Context

  • Systems: development, platform

Source: metadata of a merged pull request in microsoft/BCQuality (bcquality): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).