Hi
we have an Umbraco 13 (13.8.1) site running on an Azure app service it’s calling the below query every hour on it’s S2 SQL server database which is triggering alerts presumably removing old versions of content:
DELETE FROM [umbracoPropertyData]
WHERE ([umbracoPropertyData].[versionId] IN (@0,@1, ... @1999)
the version list is 2000 long!
the server spends a good 10 minutes coming up with an execution plan and then appears to do nothing
Copilot analysed the execution plan and came back with:
Key Findings
1. Query Overview
- The query is a
DELETE
fromumbracoPropertyData
using a largeIN
clause onversionId
.- The plan shows parallelism, indicating SQL Server is trying to optimize performance by using multiple threads.
2. High Cost Operators
- The top cost contributors are:
- Clustered Index Delete on
umbracoPropertyData
(very expensive).- Nested Loops and Key Lookups, which are costly when repeated for many rows.
- Index Spool and Sort operations, which suggest SQL Server is buffering data due to memory pressure.
3. Memory Grant Issues
- The plan shows zero memory granted, even though the query requested ~53 MB.
- This likely causes spills to tempdb, which are slow and I/O intensive.
4. Index Usage
- The query uses
IX_umbracoPropertyData_VersionId
, which is good.- However, non-clustered index updates and clustered index deletes are still very expensive due to the volume of rows.
is there a way to reduce the batch size of these deletions?
any advice to work around?
Thanks
-Matt