Why are my deleted records still there?

Sugar Dev Team —  January 7, 2013 — 2 Comments

I came across this forums question recently…

I deleted some leads but their records are still in the “leads” table in MySQL Sugar database, why ?

Yes, you are right, we do what’s known as a “soft delete” of records, meaning we just set a flag on the record to tell the app to ignore the record, but not remove the record itself. This makes things a bit safer in case a user accidentally deletes a record, so the sys admin can simply go flip the flag to bring back the record rather than do a database restore to get it back.

However, there is a performance hit that can happen over time, where if there gets to be a lot of deleted records it can slow down queries quite a bit ( both INSERT/UPDATES and SELECTS as well ). But Sugar has a nice way to deal with this with the ‘Prune Database’ scheduler job.

This job will remove all deleted records from the system each time it runs. We recommend running this at least once a month to keep the database sizes reasonable.

2 responses to Why are my deleted records still there?

  1. 

    So how does “sys admin can simply go flip the flag to bring back the record”, via Sugar admin backend?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s