Hello,
I’m using Mautic Versions 6.0.2 and 7.0.1
If you’ve spent any time working with Mautic—especially in a testing or staging environment—you may have noticed something unexpected when deleting contacts: they don’t fully disappear from the database.
Instead of being permanently removed, Mautic performs what’s known as a soft delete on the leads table.
What Actually Happens During Deletion?
When a contact is deleted in Mautic, the system does not remove the row entirely. Rather, it:
-
Sets most fields in the record to
NULL -
Retains certain date-related fields (such as timestamps)
-
Keeps the row itself in the database
This means the database continues to grow over time, even if you regularly delete contacts through the UI.
Why This Matters
In smaller or short-lived environments, this behavior may go unnoticed. However, in scenarios like mine—where a test instance is used repeatedly for importing and validating contacts and companies—this can become a problem.
Over time, repeated imports and deletions can lead to:
-
A large number of “empty” rows in the
leadstable -
Increased table size
-
Slower query performance
-
General system slowdown
This is particularly noticeable when running bulk operations, segment updates, or imports.
Real-World Example
In my workflow, I use a dedicated Mautic test instance to validate contact and company imports before pushing data to production. After several cycles of importing and deleting test data, I began to notice a gradual slowdown in the system.
Given Mautic’s soft delete behavior, it’s likely that these accumulated, partially-null records are contributing to the performance degradation.
If you’re seeing unexplained slowdowns, it’s worth taking a closer look at your leads table—you might find that deleted contacts are still hanging around.
Does Mautic have any built-in scripts to hard delete these soft delete rows ?
And should Mautic actually use soft deletes on the leads table in the first place? The row is useless as all the field are NULL except for timestamps etc. Why keep it ?
Thanks