Linux 2.6.32-308.8.2.el5.028stab101.1 (inform) 14.08.2013 _x86_64_ (1 CPU) Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util ... Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util
Файловая система Разм Исп Дост Исп% смонтирована на /dev/simfs 9,8G 6,0G 3,9G 61% / tmpfs 600M 0 600M 0% /lib/init/rw tmpfs 600M 0 600M 0% /dev/shm
Стандартный подход — лица, осуществляющие мониторинг ..., вылавливают негативные отзывы
$db->select()
->from(...)
->where('device_id = ?', $device_id)
->where('data_date >= ?', $date1)
->where('data_date <= ?', $date2)
->order('data_date');
select count(*) from archive_hour;
select * from archive_hour where device_id = 11 and archive_date >= '2013-01-01' and archive_date <= '2013-02-01';
select * from archive_hour where device_id = 11 and archive_date >= '2012-01-01' and archive_date <= '2013-02-01';
explain select * from archive_hour where device_id = 11 and archive_date >= '2012-01-01' and archive_date <= '2013-02-01';
+----+-------------+--------------+-------+------------------+---------+---------+------+-------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+--------------+-------+------------------+---------+---------+------+-------+-------------+
| 1 | SIMPLE | archive_hour | range | PRIMARY,max_hour | PRIMARY | 12 | NULL | 12121 | Using where |
+----+-------------+--------------+-------+------------------+---------+---------+------+-------+-------------+
show create table archive_hour;
+--------------+--------------------------------------------------------------------------------------------------------
| Table | Create Table
+--------------+--------------------------------------------------------------------------------------------------------
| archive_hour | CREATE TABLE `archive_hour` (
`device_id` int(11) NOT NULL,
`archive_date` datetime NOT NULL,
blablabla // 20 значений double
PRIMARY KEY (`device_id`,`archive_date`),
KEY `max_hour` (`device_id`,`archive_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
/*!50100 PARTITION BY RANGE (MONTH(archive_date))
(PARTITION p01 VALUES LESS THAN (2) ENGINE = InnoDB,
PARTITION p02 VALUES LESS THAN (3) ENGINE = InnoDB,
...
PARTITION p12 VALUES LESS THAN (13) ENGINE = InnoDB,
PARTITION pmaxval VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */