I have a table that is closely approaching 2 million records. This table stores a history of transactions. This is on a high traffic website but also the table is not accessed regularly. We currently have no slow queries due to this table, but am looking as to when I should expect to need to migrate data from this table to a data archival method.
The server is an amazon ec2 high cpu medium box.
High-CPU Medium Instance
1.7 GB of memory
5 EC2 Compute Units (2 virtual cores with 2.5 EC2 Compute Units each)
350 GB of instance storage
32-bit platform
I/O Performance: Moderate
API name: c1.medium
Engine: InnoDB
Version: 10
Row_format: Compact
Rows: 1677878
Avg_row_length: 71
Data_length: 120209408
Max_data_length: 0
Index_length: 246497280
Data_free: 0
Auto_increment: 1914179
Create_time: 2011-08-07 20:15:29
Update_time: NULL
Check_time: NULL
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
Comment: InnoDB free: 7168 kB
Few questions:
At which point might I start seeing performance degrade due to the amount of records in this table?
What settings should I be checking on the mysql server, via SHOW INNODB STATUS and on the table itself(ie, row format) to ensure I am maximizing performance as I need it?
What metrics should I be gathering to calculate performance over time?
So many questions!! To your first point, you will probably start to notice performance problems if you start to cause full table scans or joins that create temp tables. You can track this by looking at the EXPLAIN output for your queries. Here is some info on EXPLAIN:
http://weevilgenius.net/2010/09/mysql-explain-reference/
For the settings, ideally it is great if you can fit your entire database in memory. Here are the variables that are probably most helpful to tune:
You'll want to make most of these as big as reasonable (you will want to research some of these as some are per connection and some are global). You mentioned SHOW INNODB STATUS which is a great place to start, try looking at these fields:
These should show you if you are bound by IO somewhere. Then check:
to make sure you have free buffers.
Regarding your last question of what to monitor, more is better. I use OpenNMS to monitor our MySQL server performance. Here are the things we currently trend/alert on drastic changes: