With full recognition that this is not considered a best practice (and is generally considered a worst practice) does anyone know if it is safe to delete field revisions directly from the DB via a DELETE query assuming I can guarantee that only the latest revision is being used/referenced everywhere on the site.

I ask this question because I have a particular field that has grown so large the our update hook is taking too long. I'm looking to cheat and seeing if anyone has had experience with this.

  • If you keep the revision of the entity then reverting to it will display it as if there is no value for the field.
    – Eyal
    Sep 1, 2016 at 17:23
  • If you delete the revision from the entity then it might cause problems when displaying a list of all revisions or anywhere that a developer might assume the revision exists.
    – Eyal
    Sep 1, 2016 at 17:24
  • ... and if I'm ok with that, then this should be a safe operation, right? Nothing should explode
    – bleen
    Sep 1, 2016 at 17:25
  • I didn't try it but I have read some of the code that works with revisions. From I gather it should be fine. Just in case you should export the data you are about to delete and keep it a a csv file
    – Eyal
    Sep 1, 2016 at 17:27

1 Answer 1


There was a module in 7 that tried to solve this, Field SQL No Revisions. I am not sure how far along a Drupal 8 port is, but this is where you might want to start. However, that module keeps those tables empty, instead of just the 'latest' record.

Previously (7.x), I used to have hook_cron routines that would purge revision tables of any old data not being used to keep size down. We had some DBs that were huge due to that, which made backups and dev syncing take forever and be cumbersome. It really helped. You'll want to be careful and use the respective API over a database query, so the rest of Drupal is informed about what is happening and can take action (or if your site has no dependencies it might not matter, but it is always, always safer).

  • For my usecase we just need to do this one time because of one field that got out of hand. We have put in a fix so that we are storing much less data in this field, but I want to just zap the revisions in one shot. Thoughts?
    – bleen
    Sep 1, 2016 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.