# How to bulk delete entries older than x days using MySQL?

**URL:** <https://community.gravityforms.com/t/how-to-bulk-delete-entries-older-than-x-days-using-mysql/14008>\
**Category:** Get Help\
**Tags:** wp-cli, custom, mysql, delete\_entry, database\
**Created:** [December 5, 2022, 7:20am UTC](https://community.gravityforms.com/t/how-to-bulk-delete-entries-older-than-x-days-using-mysql/14008 "2022-12-05T07:20:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![michaeledi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/michaeledi/32/61_2.png) [@michaeledi](https://community.gravityforms.com/u/michaeledi)\
**Post date:** [December 5, 2022, 7:20am UTC](https://community.gravityforms.com/t/how-to-bulk-delete-entries-older-than-x-days-using-mysql/14008/1 "2022-12-05T07:20:10Z")

</div>

I’ve got over 30k entries with massive and long field values that I want to cleanup.

Previously I tried the [WP-CLI to filter and delete old entries](https://community.gravityforms.com/t/how-to-bulk-delete-old-entries-using-wp-cli/11209/2), but stuck at the export step since is still took me decades… It’s been 4 days and I still haven’t successfully exported 5000 entries… I guess it’s because my entries have lots of long text and HTML value that slowed down the whole exporting process.

So I have to look back on MySQL method which I left on [How to cleanly delete Gravity Forms entries with SQL? - Get Help - Gravity Forms](https://community.gravityforms.com/t/how-to-cleanly-delete-gravity-forms-entries-with-sql/8460/4)

So basically I wish the SQL queries can do:

1. Filter the entries older than x days
2. Bulk delete the entries completely including the entry, entry\_meta, entry\_notes, gravityflow\_activity\_log etc…

Is there a possible solution to this?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/gravityforms1/original/2X/f/fef63f0599c45e0218c30d9f5d7ca8bff9b00189.png) [@system](https://community.gravityforms.com/u/system)\
**Post date:** [January 4, 2023, 7:20am UTC](https://community.gravityforms.com/t/how-to-bulk-delete-entries-older-than-x-days-using-mysql/14008/2 "2023-01-04T07:20:34Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
