请问下各位老师,对sysbench 产生的sbtest1表进行测试
执行了2次explain analyze delete from sbtest1 limit 1000,有下列2个疑问?
1.执行第二次explain analyze delete from sbtest1 limit 1000 后,执行计划里面的total_keys 为什么是3001,按照我的理解应该是2000左右才对,
2.执行第二次explain analyze delete from sbtest1 limit 1000 后,执行计划里面的key_skipped_count 为什么变成了4000
按照我的理解 key_skipped_count RocksDB代表 扫数据时所有遇到的 Key 数量,怎么会变成4000,就执行了2次delete limit 1000,
mysql> explain analyze delete from sbtest1 limit 1000;
±-----------------------------±--------±--------±----------±--------------±--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------±-------------------------------±---------±-----+
| id | estRows | actRows | task | access object | execution info | operator info | memory | disk |
±-----------------------------±--------±--------±----------±--------------±--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------±-------------------------------±---------±-----+
| Delete_4 | N/A | 0 | root | | time:14.3ms, loops:1 | N/A | 247.5 KB | N/A |
| └─Limit_8 | 1000.00 | 1000 | root | | time:9.89ms, loops:2 | offset:0, count:1000 | N/A | N/A |
| └─TableReader_12 | 1000.00 | 1000 | root | | time:9.88ms, loops:1, cop_task: {num: 3, max: 4.11ms, min: 2.75ms, avg: 3.22ms, p95: 4.11ms, max_proc_keys: 992, p95_proc_keys: 992, tot_proc: 1ms, rpc_num: 3, rpc_time: 9.64ms, copr_cache_hit_ratio: 0.00, distsql_concurrency: 1} | data:Limit_11 | 302.7 KB | N/A |
| └─Limit_11 | 1000.00 | 1696 | cop[tikv] | | tikv_task:{proc max:2ms, min:0s, avg: 1.33ms, p80:2ms, p95:2ms, iters:12, tasks:3}, scan_detail: {total_process_keys: 1696, total_process_keys_size: 379904, total_keys: 1699, get_snapshot_time: 832.6µs, rocksdb: {key_skipped_count: 1696, block: {cache_hit_count: 25, read_count: 2, read_byte: 52.2 KB, read_time: 394.1µs}}} | offset:0, count:1000 | N/A | N/A |
| └─TableFullScan_10 | 1000.00 | 1696 | cop[tikv] | table:sbtest1 | tikv_task:{proc max:2ms, min:0s, avg: 1.33ms, p80:2ms, p95:2ms, iters:12, tasks:3} | keep order:false, stats:pseudo | N/A | N/A |
±-----------------------------±--------±--------±----------±--------------±--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------±-------------------------------±---------±-----+
5 rows in set (0.10 sec)
mysql> show variables like ‘%paging%’;
±---------------------±------+
| Variable_name | Value |
±---------------------±------+
| tidb_enable_paging | ON |
| tidb_max_paging_size | 50000 |
| tidb_min_paging_size | 128 |
±---------------------±------+
3 rows in set (0.01 sec)
mysql> set tidb_enable_paging = OFF;
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like ‘%paging%’;
±---------------------±------+
| Variable_name | Value |
±---------------------±------+
| tidb_enable_paging | OFF |
| tidb_max_paging_size | 50000 |
| tidb_min_paging_size | 128 |
±---------------------±------+
3 rows in set (0.00 sec)
mysql> explain analyze delete from sbtest1 limit 1000;
±-----------------------------±--------±--------±----------±--------------±---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------±-------------------------------±---------±-----+
| id | estRows | actRows | task | access object | execution info | operator info | memory | disk |
±-----------------------------±--------±--------±----------±--------------±---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------±-------------------------------±---------±-----+
| Delete_4 | N/A | 0 | root | | time:9ms, loops:1 | N/A | 220.6 KB | N/A |
| └─Limit_8 | 1000.00 | 1000 | root | | time:4.68ms, loops:2 | offset:0, count:1000 | N/A | N/A |
| └─TableReader_12 | 1000.00 | 1000 | root | | time:4.68ms, loops:1, cop_task: {num: 1, max: 4.58ms, proc_keys: 1000, tot_proc: 1ms, rpc_num: 1, rpc_time: 4.56ms, copr_cache_hit_ratio: 0.00, distsql_concurrency: 1} | data:Limit_11 | 205.6 KB | N/A |
| └─Limit_11 | 1000.00 | 1000 | cop[tikv] | | tikv_task:{time:2ms, loops:6}, scan_detail: {total_process_keys: 1000, total_process_keys_size: 224000, total_keys: 3001, get_snapshot_time: 781µs, rocksdb: {delete_skipped_count: 1000, key_skipped_count: 4000, block: {cache_hit_count: 14}}} | offset:0, count:1000 | N/A | N/A |
| └─TableFullScan_10 | 1000.00 | 1000 | cop[tikv] | table:sbtest1 | tikv_task:{time:2ms, loops:6} | keep order:false, stats:pseudo | N/A | N/A |
±-----------------------------±--------±--------±----------±--------------±---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------±-------------------------------±---------±-----+
5 rows in set (0.09 sec)