......................................2009.11.13 by Rize Jin...........................................
..................................Scenario a: Insert 100,1000 index units.......................
For Clustered-Mode:
Right now we got totlely 93692 blocks writen.
insert 100000 index units cost 99721 ms.
******************* WriteHead Fuc. *************************
**** HeadBlock.RootBlock: 68 ****
**** HeadBlock.AllocBlock: 2341 ****
************************ END ******************************
因为缓存机制的缘故10万次写入,变成了93692次写入;
分裂次数:(2340 - 1588) = 752;
一次分裂会有一个擦除操作和两次写入操作;
如果设写入操作耗时:200us, 删除操作耗时: 2ms ;
可以导出10万次index units的插入操作总耗时: 752*2ms + (93692 + 752) * 200us = 20392.8 ms;
For Non-clustered-Mode:
mysql> select 100000/63;
+-----------+
| 100000/63 |
+-----------+
| 1587.3016 |
+-----------+
这个模式不存在分裂, 总耗时: 1588*200us = 317.6 ms
.....................................2009.11.15 by Rize Jin..........................................
.....................................and search 100,1000 times.....................................
For Clustered-Mode:
Right now we got totlely 6815 blocks writen.
******************* WriteHead Fuc. *************************
**** HeadBlock.RootBlock: 68 ****
**** HeadBlock.AllocBlock: 231 ****
************************ END ******************************
可以得出1万次index units的插入操作总耗时: 230*2ms + (6815 + 230) * 200us = 1869 ms;
设读一个页的耗时是:15us;
树高为2;
则100,000次的读操作的耗时为: 15 * 2 *100, 000 = 3000 ms;
则情景B的总耗时:4869 ms.
For Non-clustered-Mode:
插入总耗时: 159*200us = 31.8 ms;
一个逻辑节点到底对应多少个物理页,是比较难说明的,而且并不固定,它是大于等于1并且小于等于63的数字,可以假设它是24;
则100,000次的读操作的耗时为: 15 * 2 * 24 * 100, 000 = 72000 ms;
则情景B的总耗时:72031.8 ms.
.....................................2009.11.15 by Rize Jin..........................................
.....................................and search 50,1000 times.....................................
For Clustered-Mode:
Right now we got totlely 44698 blocks writen.
******************* WriteHead Fuc. *************************5万次index units的插入操作总耗时: 1177*2ms + (44698 + 1177) * 200us = 11529 ms;
树高为3;
则情景c的总耗时:13779 ms
For Non-clustered-Mode:
插入总耗时: 794*200us = 158.8 ms;
则50,000次的读操作的耗时为: 15 * 2 * 8 * 50, 000 = 12000 ms;
则情景c的总耗时:12158.8 ms.