Formie comes with a number of command line utilities that can be run on-demand, or on a set schedule.
A cleanup tasks to ensure fields aren't orphaned. Not normally required.
A cleanup task to ensure Synced Fields are neat. Not normally required.
Deletes any incomplete submissions that exceed the "Maximum Incomplete Submission Age" plugin setting.
Deletes any submissions that exceed your data retention form settings.
A cleanup task to ensure deleted forms have their content tables also deleted. Not normally required.
Each of the above commands are also run automatically through Craft's Garbage Collection, so there's no need to add these commands unless you want fine-grained control over when they run.
Available for Craft 3. Get it from the plugin store.