Hi
I have a database with HUGE table which holds historical mrtg utilization data for 12 months, see below
-rw-rw---- 1 mysql mysql 8924 2008-01-29 11:17 mrtg_util.frm
-rw-rw---- 1 mysql mysql 8750329384 2009-02-27 11:30 mrtg_util.MYD
-rw-rw---- 1 mysql mysql 2473731072 2009-02-27 11:30 mrtg_util.MYI
So there are over 300 million records in this table and physical size is over 10Gb. The machine this MYSQL runs on has only 3Gb of DRAM.
Here is table structure, very simple
mysql> describe mrtg_util;
+-----------------------+---------+------+-----+---------+-- --------------+
| Field | Type | Null | Key | Default | Extra |
+-----------------------+---------+------+-----+---------+-- --------------+
| mrtg_util_id | int(11) | | PRI | NULL | auto_increment |
| mrtg_util_in_val | int(11) | | | 0 | |
| mrtg_util_out_val | int(11) | | | 0 | |
| mrtg_util_tst | int(11) | | | 0 | |
| mrtg_util_mrtg_cfg_id | int(11) | | | 0 | |
| mrtg_util_in_val_abs | int(11) | | | 0 | |
| mrtg_util_out_val_abs | int(11) | | | 0 | |
+-----------------------+---------+------+-----+---------+-- --------------+
When my code accesses (SELECT)this table (to get for example 3 months worth of data), my machine runs out of memory and as result starts paging (swapping) which dramatically reduces its performance and it takes few minutes before I see result which is already too late as Web browser has timeout by then.
Could you please tell me what is the best way to address problems like that.
I was thinking about splitting this big table into 12 monthly tables, but the resulting monthly table might still exceed RAM size with the same result.
Really appreciate your help with this.
Best regards
Mikhail Chelomanov
Brisbane Australia
I have a database with HUGE table which holds historical mrtg utilization data for 12 months, see below
-rw-rw---- 1 mysql mysql 8924 2008-01-29 11:17 mrtg_util.frm
-rw-rw---- 1 mysql mysql 8750329384 2009-02-27 11:30 mrtg_util.MYD
-rw-rw---- 1 mysql mysql 2473731072 2009-02-27 11:30 mrtg_util.MYI
So there are over 300 million records in this table and physical size is over 10Gb. The machine this MYSQL runs on has only 3Gb of DRAM.
Here is table structure, very simple
mysql> describe mrtg_util;
+-----------------------+---------+------+-----+---------+-- --------------+
| Field | Type | Null | Key | Default | Extra |
+-----------------------+---------+------+-----+---------+-- --------------+
| mrtg_util_id | int(11) | | PRI | NULL | auto_increment |
| mrtg_util_in_val | int(11) | | | 0 | |
| mrtg_util_out_val | int(11) | | | 0 | |
| mrtg_util_tst | int(11) | | | 0 | |
| mrtg_util_mrtg_cfg_id | int(11) | | | 0 | |
| mrtg_util_in_val_abs | int(11) | | | 0 | |
| mrtg_util_out_val_abs | int(11) | | | 0 | |
+-----------------------+---------+------+-----+---------+-- --------------+
When my code accesses (SELECT)this table (to get for example 3 months worth of data), my machine runs out of memory and as result starts paging (swapping) which dramatically reduces its performance and it takes few minutes before I see result which is already too late as Web browser has timeout by then.
Could you please tell me what is the best way to address problems like that.
I was thinking about splitting this big table into 12 monthly tables, but the resulting monthly table might still exceed RAM size with the same result.
Really appreciate your help with this.
Best regards
Mikhail Chelomanov
Brisbane Australia
Comment