I've been doing some intensive pruning and can add a little something that might help.
Not all front-end deleting of content or auto-pruning of dead profiles cleans up everything in the database or on your server, so I checked my module tables in PHP MyAdmin.
It's also a great place to mass edit titles, uri, descriptions and tags in a blitz; but probably not for very large and active communities.
I don't know which custom mods you have, so can't tell you where to look.
Back up Everything before you start
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Photos - Edit titles and uri
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In 'bx_photos_main' table.
Delete orphan files from
/public_html/modules/boonex/photos/data/files
(usually in groups of five: image, image_m; image_ri; image_rt; image_t)
I actually transferred all images to my hard drive first; to compare (image id) reference in database vs (owner) profile numbers that no longer exist, through /profile_info.php?ID=
Michel on Meta-Travel.com