Mastodon's database size can often be reduced either through Postgres' VACUUM command or the pg_repack extension, the latter usually being more effective as a lot of the size is in index bloat which VACUUM does not touch. Mind that I do not recommend running VACUUM FULL unless you absolutely need to reclaim disk space on the system.
Speaking of vacuuming, the upcoming version of Mastodon will provide admins with the option to define a content retention policy that will evict all remote posts past a defined date. A harsh, but most effective way to keep the database (and by extension, media cache) to a constant size, as far as activity by local users allows.