I have 16 million rows in these 2 tables in Drupal.My sites are slow and these 2 tables top the slow query log. Can I safely truncate them?
Also, issuing a truncate command, hangs the system. Is there a way I can delete rows in batches?
Watchdog yes, Session has a timestamp that you should probably use to make sure any currently connected users don't lose their session. If you don't mind a little downtime, it might be worth it to turn the maintenance option on and then truncate both tables at a traffic-low/ appropriate time.
You have an answer to your immediate problem, but dblog should be pruned automatically by cron. The number of rows to keep is a setting, admin/settings/logging/dblog
dblog can also be cleared and pruned to an extent with drush.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With