This blog post is more oriented to ISVs, but anyone could benefit from it and compared to other posts it is shorter and more serious. So less meme and more meat.
Resumed in a nutshell:
Obsoleting Key (and SIFT) does NOT apply any changes to existing metadata structure.
Let’s make a simple example to make you a believer.
I cloned “Customer Ledger Entry” table as is and named “DTA.Cust. Ledger Entry“ (what a shiny fantasia…). With all its own fields and, overall keys.
Deployed this dummy extension with just that table in it and everything is perfect. I have all SQL Indexes

and SQL Indexed Views (aka V-SIFT).

Now. Let’s say that I want to deprecate / obsolete e.g. Key2 (already highlighted in orange in the previous pictures, for your convenience).
What you (or some) might think of, is that simply declaring obsolete = removed such key, as shown below, you get the SQL index and its V-SIFT dropped.

After all, the world Removed… might let you think that SQL index will be removed.
Do you think so? Wanna bet?…

Tagging a key as obsoleted won’t do anything but remove from Visual Studio Code IntelliSense the capability of showing it as an available key or make it impossible the use of its declaration in some exotic code. Nothing more than that.
Deploying your extension that way, in an environment that has already deployed the original version, will NOT drop the existing SQL Index nor any V-SIFT associated with it.
What is the correct way to obsolete keys AND be sure to have cleaned them up accordingly, then? Easy peasy.

Declaring false maintain SQL and SIFT index. THIS will drop SQL Index

and the associated Indexed View (if any).

In this way, there won’t be any more useless indexes that reduces time to insert, update or delete records, can be the cause of tricky deadlocks (overall SIFTs) and delay maintenance time.
Lessons learned? I think so.
What are you saying? “…in version 26 (Dynamics 365 Business Central 2025 Wave 1) they will be gone anyway. It is a stepping-stone”.

NO CICCIO ! (that’s italian… sorry), it won’t be like that. Only 1st party app (aka the ones with Microsoft as publisher) are games for the metadata Armageddon. The prune of obsolete entity for all 3rd party apps (aka all the ones that have a publisher different than Microsoft) is not planned. YET.
CONCLUSION
Check your obsolete keys and be sure you have MaintainSqlIndex and MaintainSiftIndex set to false. This will ensure that your SQL Index and Indexed View are dropped.


Leave a comment