---
id: change/bcquality/135
type: change
title: "#135 Correct severe misconception about SetCurrentKey in the knowledge base"
summary: Documentation corrected to clarify that SetCurrentKey only affects SQL sort order, not index selection by SQL Server, removing outdated guidance that misled AL developers.
tier: official
language: en
tags:
  - fix
  - main
system: development
review:
  state: reviewed
  by: opus
  at: "2026-10-08T02:07:55.565Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 9203e3ce2bef2e2af77ba83b94dd884661d1ef3f
evidence:
  - kind: code
    url: https://github.com/microsoft/BCQuality/pull/135
    title: "microsoft/BCQuality#135: Correct severe misconception about SetCurrentKey in the knowledge base"
    date: "2026-08-23"
    commit: 9203e3ce2bef2e2af77ba83b94dd884661d1ef3f
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
number: 135
repo: microsoft/BCQuality
source_id: bcquality-prs
url: https://github.com/microsoft/BCQuality/pull/135
kind: pr
base_branch: main
major: null
merged_at: "2026-08-23T18:07:14Z"
author: dcenic
author_type: User
community_contribution: false
labels: []
change_class: code
change_kind: fix
behavior_change: false
breaking: false
files:
  count: 6
  additions: 74
  deletions: 40
  al: 6
apps: []
objects_touched: []
objects_unjoined:
  - path: microsoft/knowledge/performance/apply-filters-before-iterating.md
    status: modified
    reason: not-in-snapshot
  - path: microsoft/knowledge/performance/setcurrentkey-aligns-key-with-filters.good.al
    status: removed
    reason: removed
  - path: microsoft/knowledge/performance/setcurrentkey-aligns-key-with-filters.md
    status: removed
    reason: removed
  - path: microsoft/knowledge/performance/setcurrentkey-sets-sort-order-not-index-hint.bad.al
    status: added
    reason: not-in-snapshot
  - path: microsoft/knowledge/performance/setcurrentkey-sets-sort-order-not-index-hint.good.al
    status: added
    reason: not-in-snapshot
  - path: microsoft/knowledge/performance/setcurrentkey-sets-sort-order-not-index-hint.md
    status: added
    reason: not-in-snapshot
obsoletions: []
backports: []
fixes_issues: []
work_items: []
systems:
  - development
  - platform
quote: null
joined_against:
  major: null
  commit: null
---

# #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](https://github.com/microsoft/BCQuality/pull/135) · 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).
