---
id: change/bcapps/13952
type: change
title: "#13952 Add key on Email Message Attachment Data to speed up email deletion"
summary: A database key is added on the Data field of Email Message Attachment table to significantly improve performance when deleting emails, particularly during email storage cleanup operations.
tier: official
language: en
tags:
  - performance
  - main
  - bc30
  - table email message attachment
system: platform
review:
  state: reviewed
  by: opus
  at: "2026-11-13T00:59:29.577Z"
  flags: []
generated:
  at: "2026-11-30T10:37:49.603Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 1dec201bd2dd5817f662e9322211978f45ae2aad
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/13952
    title: "microsoft/BCApps#13952: Add key on Email Message Attachment Data to speed up email deletion"
    date: "2026-11-12"
    commit: 1dec201bd2dd5817f662e9322211978f45ae2aad
    t: null
    quote: null
links:
  learn: []
  objects:
    - object/table/8904
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
  related:
    - to: https://learn.microsoft.com/dynamics365/business-central/ui-how-send-documents-email
      title: Send documents and emails
      label: possibly related
      why: Documents email and attachment functionality that benefits from database performance optimization.
      by: model
number: 13952
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/13952
kind: pr
base_branch: main
major: "30"
merged_at: "2026-11-12T12:57:37Z"
author: mynjj
author_type: User
community_contribution: false
labels:
  - "AL: System Application"
  - "Team: Integrations"
change_class: code
change_kind: performance
behavior_change: false
breaking: false
files:
  count: 1
  additions: 4
  deletions: 0
  al: 1
apps:
  - System Application
objects_touched:
  - key: table/8904
    page: table/8904
    type: table
    id: 8904
    name: Email Message Attachment
    app: System Application
    status: modified
objects_unjoined: []
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 658823
systems:
  - platform
quote: null
joined_against:
  major: "30"
  commit: d2abc1d2ceae394331716c8183ef60e1534c2ce0
---

# #13952 Add key on Email Message Attachment Data to speed up email deletion

> A database key is added on the Data field of Email Message Attachment table to significantly improve performance when deleting emails, particularly during email storage cleanup operations.

[Pull request](https://github.com/microsoft/BCApps/pull/13952) · merged into `main` (BC30) on 2026-11-12 by mynjj · 1 file (+4 -0), 1 AL · performance · tier official · reviewed (checked by Opus)

## What changed

- Adds an index on the Data media field to avoid full table scans during attachment deletion
- Directly improves email deletion performance for large tenants
- Uses the same approach as the existing Document Attachment table key
- Addresses performance bottleneck in Payables Agent email cleanup

## AL objects touched

- [Table 8904 "Email Message Attachment"](../../objects/table/8904.md), System Application: modified

## Context

- Work items: AB#658823
- Labels: AL: System Application, Team: Integrations
- Systems: platform

## Possibly related

No source states these links: they share an object, a model read them, or a person found the same subject.

- [Send documents and emails](https://learn.microsoft.com/dynamics365/business-central/ui-how-send-documents-email) — possibly related: Documents email and attachment functionality that benefits from database performance optimization. (model-linked)

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