Database Tips
Some common tricks for quick database optimizations
See what is slowing things down -
`show full processlist;
Sometimes adding index will give error when moving from 5.7 to 8 to change that you can set the sql_mode
SELECT @@SESSION.sql_mode; // See what is the current mode
// For ex for Date error
SET SESSION sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
ALTER TABLE `wp_posts` ADD INDEX `post_date_gmt` (`post_date_gmt`);