The WP-Sweep plugin is in the WP repository and has, as of the time of writing, over 100,000 active installations. It cleans up the database and comes highly recommended as well as being speedy in doing its job. It comes with a health warning that before you do any sweep, to backup your database first because any sweep done is irreversible. I have used it on this site, and other straightforward WordPress sites, and also on an e-commerce site running WooCommerce.

I deleted WP-Sweep after using it, on the basis that I can always download it as and when I want to sweep away the cobwebs. So where it says there are over 100,000 active installations, there may be others who have done what I have, and junked it after use.