All of you might know WordPress has a trash feature, just like Recycle bin in Windows PC, so whenever we delete something it goes into trash, if we want we can recover it later and if you don't want to recover you can delete it permanently.
But mostly it happens that we delete some posts and don't even remember to delete it permanently this makes database bigger in size, thus taking more time to process and making the site slow.
Just add the below lines of code in wp-config.php :
define('EMPTY_TRASH_DAYS', 7 ); // Empty trash after every 7 days
The above code will automatically empty trash every 7th day. thus cleaning up your database and making you website Optimized and faster.