I am quite new to the both MySQL and AWS RDS service. I just find my query to the MySQL on a small RDS instance takes roughly more than 5 seconds. Besides, I notice with the CloudWatch that the CPU of the rds is always 100% consumed. The size of my database is around 1 million now. Can any tell me what I can do to fix this?
One query is like this:
mysql> EXPLAIN SELECT * FROM iApps;
+----+-------------+--------------+------+---------------+------+---------+------+---------+-------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+--------------+------+---------------+------+---------+------+---------+-------+
| 1 | SIMPLE | iApps | ALL | NULL | NULL | NULL | NULL | 1165255 | |
+----+-------------+--------------+------+---------------+------+---------+------+---------+-------+
1 row in set (0.04 sec)
Here is another query:
mysql> EXPLAIN SELECT * FROM iApps WHERE familyName='Thompson' AND firstName='David';
+----+-------------+--------------+------+---------------+------+---------+------+---------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+--------------+------+---------------+------+---------+------+---------+-------------+
| 1 | SIMPLE | iApps | ALL | NULL | NULL | NULL | NULL | 1166070 | Using where |
+----+-------------+--------------+------+---------------+------+---------+------+---------+-------------+
1 row in set (0.08 sec)
The time here is quite small, but it's quite slow with my code. I use python package mysqldb for all the operations, could that be the problem?
I did search online for this issue. But I don't really get the solutions from the pages. I'm entry level for the database.