deleteOrphanedProperties() is slow and causes deadlocks and timeouts

Steps to reproduce

When you delete an event, the asset manager method deleteOrphanedProperties() is called, which runs the query:

DELETE p FROM oc_assets_properties p LEFT JOIN oc_assets_snapshot e ON p.mediapackage_id = e.mediapackage_id WHERE e.id IS NULL;

This is slow because it does almost a full table scan on oc_assets_properties, which can have millions of rows.

This doesn't seem necessary, as the properties should get deleted for a specific mediapackage when that MP is deleted.

At best, it's a maintenance task that could get run once a day.

Assignee

Unassigned

Reporter

Stephen Marquard

Severity

Performance

Tags (folksonomy)

None

Components

Fix versions

Affects versions

Priority

Major
Configure