MySQL consuming high CPU

Following the migration from version 3.3 to 3.4, a portal hosting multiple journals is experiencing high CPU usage.
Queries involving joins between the submissions and publications tables are causing the system to crash, resulting in timeouts.

Logs

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
mysql 4930 284 25.7 3925604 972192 ? Sl 20:40 20:25 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
wwgvaa 5316 1.2 1.2 505012 46020 ? S 20:45 0:01 php-fpm: pool domain_com
wwgvaa 4979 0.5 1.2 505100 45840 ? S 20:40 0:02 php-fpm: pool domain_com
wwgvaa 4981 0.5 1.1 431364 43792 ? S 20:40 0:02 php-fpm: pool domain_com

mysql -e “SHOW PROCESSLIST;”

| 263 | user_database | localhost | user_databaseojs34 | Execute | 60 | Sending data | select s.* from submissions as s left join publications as po on s.current_publication_ | | 266 | user_database | localhost | user_databaseojs34 | Execute | 44 | Sending data | select s.* from submissionsassleft joinpublicationsaspoons.current_publication_ |
| 273 | user_database | localhost | user_databaseojs34 | Execute | 17 | Sending data | select s.* from submissions as s left join publications as po on s.current_publication_ | | 278 | user_database | localhost | user_databaseojs34 | Execute | 14 | Sending data | select s.* from submissionsassleft joinpublicationsaspoons.current_publication_ |
| 283 | user_database | localhost | user_databaseojs34 | Execute | 13 | Sending data | select count(*) as aggregate from submissions as s left join publications as po on s.`curr |

What application are you using?

OJS 3.4 (more new version)
MySQL 5.7
Apache 2.4

Additional information

Server VPS with 4GB RAM
Linux CentroOS
3vCPU
100 GB disc space

We discovered that the `submission_search_object_keywords` table was 540 MB in size, contained over 5.1 million rows, and was causing the `mysqld` service to hang. The solution was implemented using the following code:
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE submission_search_object_keywords;
TRUNCATE TABLE submission_search_objects;
TRUNCATE TABLE submission_search_keyword_list;
SET FOREIGN_KEY_CHECKS = 1;

The system is now running without interruptions.

Hi @AntSoft_Systems_On_D,

Deleting the contents of these tables removes the search index, which means your search interface won’t provide any results.

For another solution, I recommend reviewing this thread:

Regards,
Alec Smecher
Public Knowledge Project Team