This question is extension of my previous question "How to monitor InnoDB Disk I/O Required for MySQL? "
As mention in my previous question i want to count total number of disk i/o per query, but while testing i got confused with some result ,
i am using below example ::
mysql> explain user; ------->[user table from Website database]
+----------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+----------------+
| username | varchar(50) | YES | UNI | NULL | |
| id | int(11) | NO | PRI | NULL | auto_increment |
| password | varchar(50) | YES | | NULL | |
+----------+-------------+------+-----+---------+----------------+
I have created a index on username.
My analysis is
before running any query system variable status was
'Created_tmp_disk_tables', '1'
'Created_tmp_files', '12'
'Created_tmp_tables', '8'
'Key_reads', '0'
'Key_writes', '0'
'Innodb_buffer_pool_reads', '425'
'Innodb_log_writes', '26'
when i tried
insert into user (`username`,`password`) values ("xyz1","xyz1");
'Created_tmp_disk_tables', '1'
'Created_tmp_files', '12'
'Created_tmp_tables', '8'
'Key_reads', '0'
'Key_writes', '0'
'Innodb_buffer_pool_reads', '425'
'Innodb_log_writes', '27' -------> (shows one write operation in Innodb_log )
when i tried
Select * from user where username ="xyz1";
'Created_tmp_disk_tables', '1'
'Created_tmp_files', '12'
'Created_tmp_tables', '8'
'Key_reads', '0'
'Key_writes', '0'
'Innodb_buffer_pool_reads', '425'
'Innodb_log_writes', '27'
and when i tried
UPDATE user SET `username`="xyz1", `password`="hello"
WHERE `username`="devlad1";
'Created_tmp_disk_tables', '1'
'Created_tmp_files', '12'
'Created_tmp_tables', '8'
'Key_reads', '0'
'Key_writes', '0'
'Innodb_buffer_pool_reads', '425'
'Innodb_log_writes', '29'------>[shows two write operation to log]
My first question are
1). I am calculating disk i/o correctly or i am missing something here?
2). I have create index on 'username' so while doing insert or update index > count should be modify but varible "Key_writes" keep showing me '0' ,what > does it means? is index is caching some where ?
thanks in advance!!!!