Skip to content

Instantly share code, notes, and snippets.

@mzhang77
Last active January 19, 2026 02:14
Show Gist options
  • Select an option

  • Save mzhang77/985a1fe563cfe54204ec2f7733a09a5c to your computer and use it in GitHub Desktop.

Select an option

Save mzhang77/985a1fe563cfe54204ec2f7733a09a5c to your computer and use it in GitHub Desktop.
mysql> show create table audit_log_events\G
*************************** 1. row ***************************
Table: audit_log_events
Create Table: CREATE TABLE `audit_log_events` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`event_uuid` varbinary(16) NOT NULL,
`created_at` timestamp(6) NOT NULL,
`user_uuid` binary(16) DEFAULT NULL,
`source_hash` binary(64) DEFAULT NULL,
`device_code` varchar(32) DEFAULT NULL,
`group_uuid` binary(16) DEFAULT NULL,
`source_id` binary(12) DEFAULT NULL,
`external_ref_id` bigint unsigned DEFAULT NULL,
`trust_score` smallint unsigned DEFAULT NULL,
`session_uuid` binary(16) NOT NULL,
`ip_address` varchar(16) DEFAULT NULL,
`user_agent` varchar(1024) DEFAULT NULL,
`ref_id_1` bigint unsigned DEFAULT NULL,
`meta_id_1` varchar(16) DEFAULT NULL,
`meta_id_2` varchar(16) DEFAULT NULL,
PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */,
UNIQUE KEY `uk_time_event` (`created_at`,`event_uuid`),
KEY `idx_created_at` (`created_at`),
KEY `idx_user_ts` (`user_uuid`,`created_at`,`event_uuid`),
KEY `idx_device_ts` (`device_code`,`created_at`,`event_uuid`),
KEY `idx_group_ts` (`group_uuid`,`created_at`,`event_uuid`),
KEY `idx_source_ts` (`source_id`,`source_hash`,`created_at`,`event_uuid`),
KEY `idx_ref_ts` (`external_ref_id`,`created_at`,`event_uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=2000001
1 row in set (0.00 sec)
mysql> EXPLAIN ANALYZE
-> SELECT /*+ USE_INDEX_MERGE(audit_log_events, idx_user_ts, idx_device_ts, idx_group_ts, idx_source_ts, idx_ref_ts) */ *
-> FROM audit_log_events
-> WHERE (
-> user_uuid = UNHEX('11111111222233334444555566667777')
-> OR device_code IN ('device_code_A_001', 'device_code_B_002')
-> OR group_uuid = UNHEX('AAAAAAAABBBBCCCCDDDDEEEEFFFF0000')
-> OR (source_id = UNHEX('1234567890AB') AND source_hash = UNHEX('ABCDEF1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF1234567890'))
-> OR external_ref_id = 88888888
-> )
-> ORDER BY created_at DESC, event_uuid DESC
-> LIMIT 200;
+----------------------------------+-----------+---------+-----------+---------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+---------+
| id | estRows | actRows | task | access object | execution info | operator info | memory | disk |
+----------------------------------+-----------+---------+-----------+---------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+---------+
| TopN_9 | 200.00 | 200 | root | | time:637.3ms, loops:2, RU:1786.32 | test.audit_log_events.created_at:desc, test.audit_log_events.event_uuid:desc, offset:0, count:200 | 449.3 KB | 0 Bytes |
| └─IndexMerge_21 | 200.00 | 3200 | root | | time:636.4ms, loops:5, index_task:{fetch_handle:10.704752ms, merge:29.249209ms}, table_task:{num:16, concurrency:5, fetch_row:2.881256293s, wait_time:36.079538ms} | type: union | 7.57 MB | N/A |
| ├─IndexRangeScan_14(Build) | 100003.00 | 100055 | cop[tikv] | table:audit_log_events, index:idx_user_ts(user_uuid, created_at, event_uuid) | time:675.4µs, loops:100, cop_task: {num: 3, max: 415.9µs, min: 263.3µs, avg: 333.5µs, p95: 415.9µs, tot_proc: 1.33µs, tot_wait: 152.6µs, copr_cache_hit_ratio: 1.00, build_task_duration: 29.2µs, max_distsql_concurrency: 1}, rpc_info:{Cop:{num_rpc:3, total_time:968.3µs}}, tikv_task:{proc max:21ms, min:7ms, avg: 14ms, p80:21ms, p95:21ms, iters:110, tasks:3}, scan_detail: {get_snapshot_time: 110.1µs, rocksdb: {block: {}}}, time_detail: {total_process_time: 1.33µs, total_wait_time: 152.6µs, tikv_wall_time: 367µs} | range:["\x11\x11\x11\x11\"\"33DDUUffww","\x11\x11\x11\x11\"\"33DDUUffww"], keep order:false | N/A | N/A |
| ├─IndexRangeScan_15(Build) | 99848.00 | 99451 | cop[tikv] | table:audit_log_events, index:idx_device_ts(device_code, created_at, event_uuid) | time:1.87ms, loops:100, cop_task: {num: 3, max: 466.2µs, min: 248µs, avg: 391.3µs, p95: 466.2µs, tot_proc: 3.83µs, tot_wait: 208.5µs, copr_cache_hit_ratio: 1.00, build_task_duration: 13.6µs, max_distsql_concurrency: 1}, rpc_info:{Cop:{num_rpc:3, total_time:1.15ms}}, tikv_task:{proc max:25ms, min:9ms, avg: 16.3ms, p80:25ms, p95:25ms, iters:110, tasks:3}, scan_detail: {get_snapshot_time: 153µs, rocksdb: {block: {}}}, time_detail: {total_process_time: 3.83µs, total_wait_time: 208.5µs, tikv_wall_time: 505µs} | range:["device_code_A_001","device_code_A_001"], ["device_code_B_002","device_code_B_002"], keep order:false | N/A | N/A |
| ├─IndexRangeScan_16(Build) | 50029.00 | 49966 | cop[tikv] | table:audit_log_events, index:idx_group_ts(group_uuid, created_at, event_uuid) | time:587.2µs, loops:51, cop_task: {num: 2, max: 415.5µs, min: 304.5µs, avg: 360µs, p95: 415.5µs, tot_proc: 2.38µs, tot_wait: 142.3µs, copr_cache_hit_ratio: 1.00, build_task_duration: 12.3µs, max_distsql_concurrency: 1}, rpc_info:{Cop:{num_rpc:2, total_time:705.7µs}}, tikv_task:{proc max:14ms, min:7ms, avg: 10.5ms, p80:14ms, p95:14ms, iters:57, tasks:2}, scan_detail: {get_snapshot_time: 101.1µs, rocksdb: {block: {}}}, time_detail: {total_process_time: 2.38µs, total_wait_time: 142.3µs, tikv_wall_time: 291.8µs} | range:["\xaa\xaa\xaa\xaa\xbb\xbb\xcc\xcc\xdd\xdd\xee\xee\xff\xff\x00\x00","\xaa\xaa\xaa\xaa\xbb\xbb\xcc\xcc\xdd\xdd\xee\xee\xff\xff\x00\x00"], keep order:false | N/A | N/A |
| ├─IndexRangeScan_17(Build) | 1.00 | 0 | cop[tikv] | table:audit_log_events, index:idx_source_ts(source_id, source_hash, created_at, event_uuid) | time:476.7µs, loops:1, cop_task: {num: 1, max: 427.6µs, proc_keys: 0, tot_proc: 66.7µs, tot_wait: 31µs, copr_cache_hit_ratio: 0.00, build_task_duration: 43.8µs, max_distsql_concurrency: 1}, rpc_info:{Cop:{num_rpc:1, total_time:411.2µs}}, tikv_task:{time:0s, loops:1}, scan_detail: {total_keys: 1, get_snapshot_time: 18.8µs, rocksdb: {block: {cache_hit_count: 4}}}, time_detail: {total_process_time: 66.7µs, total_wait_time: 31µs, tikv_wall_time: 167µs} | range:["\x124Vx\x90\xab" "\xab\xcd\xef\x124Vx\x90\xab\xcd\xef\x124Vx\x90\xab\xcd\xef\x124Vx\x90\xab\xcd\xef\x124Vx\x90","\x124Vx\x90\xab" "\xab\xcd\xef\x124Vx\x90\xab\xcd\xef\x124Vx\x90\xab\xcd\xef\x124Vx\x90\xab\xcd\xef\x124Vx\x90"], keep order:false | N/A | N/A |
| ├─IndexRangeScan_18(Build) | 49530.00 | 49652 | cop[tikv] | table:audit_log_events, index:idx_ref_ts(external_ref_id, created_at, event_uuid) | time:548.5µs, loops:51, cop_task: {num: 2, max: 323.8µs, min: 314.6µs, avg: 319.2µs, p95: 323.8µs, tot_proc: 2.58µs, tot_wait: 139.3µs, copr_cache_hit_ratio: 1.00, build_task_duration: 5.83µs, max_distsql_concurrency: 1}, rpc_info:{Cop:{num_rpc:2, total_time:597.2µs}}, tikv_task:{proc max:11ms, min:7ms, avg: 9ms, p80:11ms, p95:11ms, iters:57, tasks:2}, scan_detail: {get_snapshot_time: 100.2µs, rocksdb: {block: {}}}, time_detail: {total_process_time: 2.58µs, total_wait_time: 139.3µs, tikv_wall_time: 262.5µs} | range:[88888888,88888888], keep order:false | N/A | N/A |
| └─TopN_20(Probe) | 200.00 | 3200 | cop[tikv] | | time:2.8s, loops:32, cop_task: {num: 16, max: 204ms, min: 77.5ms, avg: 174.9ms, p95: 204ms, max_proc_keys: 20480, p95_proc_keys: 20480, tot_proc: 2.05s, tot_wait: 642ms, copr_cache_hit_ratio: 0.00, build_task_duration: 7.96ms, max_distsql_concurrency: 1}, rpc_info:{Cop:{num_rpc:16, total_time:2.8s}}, tikv_task:{proc max:192ms, min:74ms, avg: 167.8ms, p80:191ms, p95:192ms, iters:296, tasks:16}, scan_detail: {total_process_keys: 299124, total_process_keys_size: 71461939, total_keys: 310202, get_snapshot_time: 310µs, rocksdb: {key_skipped_count: 22647, block: {cache_hit_count: 382588}}}, time_detail: {total_process_time: 2.05s, total_suspend_time: 641.3ms, total_wait_time: 642ms, total_kv_read_wall_time: 2.63s, tikv_wall_time: 2.76s} | test.audit_log_events.created_at:desc, test.audit_log_events.event_uuid:desc, offset:0, count:200 | N/A | N/A |
| └─TableRowIDScan_19 | 240449.87 | 299124 | cop[tikv] | table:audit_log_events | tikv_task:{proc max:189ms, min:73ms, avg: 164.2ms, p80:187ms, p95:189ms, iters:296, tasks:16} | keep order:false | N/A | N/A |
+----------------------------------+-----------+---------+-----------+---------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+---------+
9 rows in set (0.64 sec)
mysql> EXPLAIN ANALYZE
-> SELECT * FROM (
-> SELECT U.*,
-> -- 使用 Window Function 去除因为 UNION ALL 产生的重复行
-> -- (例如某一行既命中了 user_uuid 又命中了 device_code)
-> ROW_NUMBER() OVER (PARTITION BY U.id ORDER BY U.created_at DESC, U.event_uuid DESC) AS rn
-> FROM (
-> -- Branch 1: User UUID
-> (SELECT /*+ USE_INDEX(ale idx_user_ts) */ * FROM audit_log_events ale
-> WHERE user_uuid = UNHEX('11111111222233334444555566667777')
-> ORDER BY created_at DESC, event_uuid DESC
-> LIMIT 200)
->
-> UNION ALL
->
-> -- Branch 2: Device Code
-> (SELECT /*+ USE_INDEX(ale idx_device_ts) */ * FROM audit_log_events ale
-> WHERE device_code IN ('device_code_A_001', 'device_code_B_002')
-> ORDER BY created_at DESC, event_uuid DESC
-> LIMIT 200)
->
-> UNION ALL
->
-> -- Branch 3: Group UUID
-> (SELECT /*+ USE_INDEX(ale idx_group_ts) */ * FROM audit_log_events ale
-> WHERE group_uuid = UNHEX('AAAAAAAABBBBCCCCDDDDEEEEFFFF0000')
-> ORDER BY created_at DESC, event_uuid DESC
-> LIMIT 200)
->
-> UNION ALL
->
-> -- Branch 4: Source ID + Hash
-> (SELECT /*+ USE_INDEX(ale idx_source_ts) */ * FROM audit_log_events ale
-> WHERE source_id = UNHEX('1234567890AB')
-> AND source_hash = UNHEX('ABCDEF1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF1234567890')
-> ORDER BY created_at DESC, event_uuid DESC
-> LIMIT 200)
->
-> UNION ALL
->
-> -- Branch 5: External Ref ID
-> (SELECT /*+ USE_INDEX(ale idx_ref_ts) */ * FROM audit_log_events ale
-> WHERE external_ref_id = 88888888
-> ORDER BY created_at DESC, event_uuid DESC
-> LIMIT 200)
->
-> ) AS U
-> ) Z
-> WHERE Z.rn = 1 -- 取去重后的第一条
-> ORDER BY created_at DESC, event_uuid DESC
-> LIMIT 200;
+--------------------------------------------------+----------+---------+-----------+--------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+---------+
| id | estRows | actRows | task | access object | execution info | operator info | memory | disk |
+--------------------------------------------------+----------+---------+-----------+--------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+---------+
| TopN_49 | 200.00 | 200 | root | | time:56.5ms, loops:2, RU:280.42 | Column#83:desc, Column#82:desc, offset:0, count:200 | 155.5 KB | 0 Bytes |
| └─Selection_54 | 640.80 | 800 | root | | time:56.3ms, loops:3 | eq(Column#98, 1) | 68.7 KB | N/A |
| └─Shuffle_144 | 801.00 | 800 | root | | time:55.8ms, loops:7, ShuffleConcurrency:5 | execution info: concurrency:5, data sources:[Union_56] | N/A | N/A |
| └─Window_55 | 801.00 | 800 | root | | time:278ms, loops:10 | row_number()->Column#98 over(partition by Column#81 order by Column#83 desc, Column#82 desc rows between current row and current row) | N/A | N/A |
| └─Sort_143 | 801.00 | 800 | root | | time:276.9ms, loops:10 | Column#81, Column#83:desc, Column#82:desc | 68.8 KB | 0 Bytes |
| └─ShuffleReceiver_147 | 801.00 | 800 | root | | time:276.2ms, loops:10 | | N/A | N/A |
| └─Union_56 | 801.00 | 800 | root | | time:55.1ms, loops:5 | | N/A | N/A |
| ├─IndexLookUp_74 | 200.00 | 200 | root | | time:5.61ms, loops:2, index_task: {total_time: 713.5µs, fetch_handle: 703.1µs, build: 9.5µs, wait: 875ns}, table_task: {total_time: 4.76ms, num: 1, concurrency: 5}, next: {wait_index: 761.5µs, wait_table_lookup_build: 70µs, wait_table_lookup_resp: 4.68ms} | limit embedded(offset:0, count:200) | 104.7 KB | N/A |
| │ ├─Limit_73(Build) | 200.00 | 200 | cop[tikv] | | time:697.5µs, loops:1, cop_task: {num: 1, max: 678.5µs, proc_keys: 200, tot_proc: 319.2µs, tot_wait: 104.8µs, copr_cache_hit_ratio: 0.00, build_task_duration: 10.6µs, max_distsql_concurrency: 1}, rpc_info:{Cop:{num_rpc:1, total_time:672.8µs}}, tikv_task:{time:0s, loops:3}, scan_detail: {total_process_keys: 200, total_process_keys_size: 21800, total_keys: 201, get_snapshot_time: 99.7µs, rocksdb: {key_skipped_count: 201, block: {cache_hit_count: 4}}}, time_detail: {total_process_time: 319.2µs, total_wait_time: 104.8µs, tikv_wall_time: 465.7µs} | offset:0, count:200 | N/A | N/A |
| │ │ └─IndexRangeScan_71 | 200.00 | 200 | cop[tikv] | table:ale, index:idx_user_ts(user_uuid, created_at, event_uuid) | tikv_task:{time:0s, loops:3} | range:["\x11\x11\x11\x11\"\"33DDUUffww","\x11\x11\x11\x11\"\"33DDUUffww"], keep order:true, desc | N/A | N/A |
| │ └─TableRowIDScan_72(Probe) | 200.00 | 200 | cop[tikv] | table:ale | time:4.65ms, loops:2, cop_task: {num: 1, max: 4.59ms, proc_keys: 200, tot_proc: 3.58ms, tot_wait: 34.1µs, copr_cache_hit_ratio: 0.00, build_task_duration: 17µs, max_distsql_concurrency: 1}, rpc_info:{Cop:{num_rpc:1, total_time:4.59ms}}, tikv_task:{time:3ms, loops:3}, scan_detail: {total_process_keys: 200, total_process_keys_size: 48772, total_keys: 200, get_snapshot_time: 13.4µs, rocksdb: {block: {cache_hit_count: 398}}}, time_detail: {total_process_time: 3.58ms, total_suspend_time: 12.9µs, total_wait_time: 34.1µs, total_kv_read_wall_time: 3ms, tikv_wall_time: 4.29ms} | keep order:false | N/A | N/A |
| ├─TopN_77 | 200.00 | 200 | root | | time:55ms, loops:2 | test.audit_log_events.created_at:desc, test.audit_log_events.event_uuid:desc, offset:0, count:200 | 78.6 KB | 0 Bytes |
| │ └─IndexLookUp_85 | 200.00 | 200 | root | | time:54.9ms, loops:2, index_task: {total_time: 51.6ms, fetch_handle: 51.6ms, build: 542ns, wait: 708ns}, table_task: {total_time: 3.26ms, num: 1, concurrency: 5}, next: {wait_index: 51.6ms, wait_table_lookup_build: 58.7µs, wait_table_lookup_resp: 3.2ms} | | 96.8 KB | N/A |
| │ ├─TopN_84(Build) | 200.00 | 200 | cop[tikv] | | time:51.5ms, loops:3, cop_task: {num: 1, max: 51.5ms, proc_keys: 99451, tot_proc: 51.2ms, tot_wait: 101.7µs, copr_cache_hit_ratio: 0.00, build_task_duration: 5.29µs, max_distsql_concurrency: 1}, rpc_info:{Cop:{num_rpc:1, total_time:51.5ms}}, tikv_task:{time:51ms, loops:98}, scan_detail: {total_process_keys: 99451, total_process_keys_size: 16409415, total_keys: 99453, get_snapshot_time: 70.3µs, rocksdb: {key_skipped_count: 99451, block: {cache_hit_count: 430}}}, time_detail: {total_process_time: 51.2ms, total_suspend_time: 18.9µs, total_wait_time: 101.7µs, total_kv_read_wall_time: 30ms, tikv_wall_time: 51.4ms} | test.audit_log_events.created_at:desc, test.audit_log_events.event_uuid:desc, offset:0, count:200 | N/A | N/A |
| │ │ └─IndexRangeScan_82 | 99848.00 | 99451 | cop[tikv] | table:ale, index:idx_device_ts(device_code, created_at, event_uuid) | tikv_task:{time:30ms, loops:98} | range:["device_code_A_001","device_code_A_001"], ["device_code_B_002","device_code_B_002"], keep order:false | N/A | N/A |
| │ └─TableRowIDScan_83(Probe) | 200.00 | 200 | cop[tikv] | table:ale | time:3.19ms, loops:2, cop_task: {num: 1, max: 3.14ms, proc_keys: 200, tot_proc: 2.8ms, tot_wait: 25.3µs, copr_cache_hit_ratio: 0.00, build_task_duration: 16.9µs, max_distsql_concurrency: 1}, rpc_info:{Cop:{num_rpc:1, total_time:3.14ms}}, tikv_task:{time:3ms, loops:3}, scan_detail: {total_process_keys: 200, total_process_keys_size: 45770, total_keys: 200, get_snapshot_time: 6.71µs, rocksdb: {block: {cache_hit_count: 397}}}, time_detail: {total_process_time: 2.8ms, total_suspend_time: 11µs, total_wait_time: 25.3µs, total_kv_read_wall_time: 3ms, tikv_wall_time: 2.92ms} | keep order:false | N/A | N/A |
| ├─IndexLookUp_106 | 200.00 | 200 | root | | time:5.29ms, loops:2, index_task: {total_time: 720.5µs, fetch_handle: 707.9µs, build: 12.1µs, wait: 500ns}, table_task: {total_time: 4.43ms, num: 1, concurrency: 5}, next: {wait_index: 755.7µs, wait_table_lookup_build: 65.2µs, wait_table_lookup_resp: 4.37ms} | limit embedded(offset:0, count:200) | 104.7 KB | N/A |
| │ ├─Limit_105(Build) | 200.00 | 200 | cop[tikv] | | time:701.9µs, loops:1, cop_task: {num: 1, max: 668.5µs, proc_keys: 200, tot_proc: 348.8µs, tot_wait: 81µs, copr_cache_hit_ratio: 0.00, build_task_duration: 17.3µs, max_distsql_concurrency: 1}, rpc_info:{Cop:{num_rpc:1, total_time:664.6µs}}, tikv_task:{time:0s, loops:3}, scan_detail: {total_process_keys: 200, total_process_keys_size: 21800, total_keys: 201, get_snapshot_time: 62.5µs, rocksdb: {key_skipped_count: 201, block: {cache_hit_count: 4}}}, time_detail: {total_process_time: 348.8µs, total_wait_time: 81µs, tikv_wall_time: 464.8µs} | offset:0, count:200 | N/A | N/A |
| │ │ └─IndexRangeScan_103 | 200.00 | 200 | cop[tikv] | table:ale, index:idx_group_ts(group_uuid, created_at, event_uuid) | tikv_task:{time:0s, loops:3} | range:["\xaa\xaa\xaa\xaa\xbb\xbb\xcc\xcc\xdd\xdd\xee\xee\xff\xff\x00\x00","\xaa\xaa\xaa\xaa\xbb\xbb\xcc\xcc\xdd\xdd\xee\xee\xff\xff\x00\x00"], keep order:true, desc | N/A | N/A |
| │ └─TableRowIDScan_104(Probe) | 200.00 | 200 | cop[tikv] | table:ale | time:4.34ms, loops:2, cop_task: {num: 1, max: 4.26ms, proc_keys: 200, tot_proc: 3.1ms, tot_wait: 36.8µs, copr_cache_hit_ratio: 0.00, build_task_duration: 19.7µs, max_distsql_concurrency: 1}, rpc_info:{Cop:{num_rpc:1, total_time:4.26ms}}, tikv_task:{time:3ms, loops:3}, scan_detail: {total_process_keys: 200, total_process_keys_size: 48774, total_keys: 200, get_snapshot_time: 16.2µs, rocksdb: {block: {cache_hit_count: 396}}}, time_detail: {total_process_time: 3.1ms, total_suspend_time: 12.6µs, total_wait_time: 36.8µs, total_kv_read_wall_time: 3ms, tikv_wall_time: 3.98ms} | keep order:false | N/A | N/A |
| ├─IndexLookUp_124 | 1.00 | 0 | root | | time:717.6µs, loops:1 | limit embedded(offset:0, count:200) | 342 Bytes | N/A |
| │ ├─Limit_123(Build) | 1.00 | 0 | cop[tikv] | | time:691.5µs, loops:1, cop_task: {num: 1, max: 668.6µs, proc_keys: 0, tot_proc: 252.6µs, tot_wait: 121.8µs, copr_cache_hit_ratio: 0.00, build_task_duration: 4.42µs, max_distsql_concurrency: 1}, rpc_info:{Cop:{num_rpc:1, total_time:664.4µs}}, tikv_task:{time:0s, loops:1}, scan_detail: {total_keys: 1, get_snapshot_time: 103.6µs, rocksdb: {block: {cache_hit_count: 4}}}, time_detail: {total_process_time: 252.6µs, total_wait_time: 121.8µs, tikv_wall_time: 459.6µs} | offset:0, count:200 | N/A | N/A |
| │ │ └─IndexRangeScan_121 | 1.00 | 0 | cop[tikv] | table:ale, index:idx_source_ts(source_id, source_hash, created_at, event_uuid) | tikv_task:{time:0s, loops:1} | range:["\x124Vx\x90\xab" "\xab\xcd\xef\x124Vx\x90\xab\xcd\xef\x124Vx\x90\xab\xcd\xef\x124Vx\x90\xab\xcd\xef\x124Vx\x90","\x124Vx\x90\xab" "\xab\xcd\xef\x124Vx\x90\xab\xcd\xef\x124Vx\x90\xab\xcd\xef\x124Vx\x90\xab\xcd\xef\x124Vx\x90"], keep order:true, desc | N/A | N/A |
| │ └─TableRowIDScan_122(Probe) | 1.00 | 0 | cop[tikv] | table:ale | | keep order:false | N/A | N/A |
| └─IndexLookUp_142 | 200.00 | 200 | root | | time:5.58ms, loops:2, index_task: {total_time: 698.5µs, fetch_handle: 679.6µs, build: 18.3µs, wait: 625ns}, table_task: {total_time: 4.76ms, num: 1, concurrency: 5}, next: {wait_index: 725.7µs, wait_table_lookup_build: 72µs, wait_table_lookup_resp: 4.68ms} | limit embedded(offset:0, count:200) | 104.7 KB | N/A |
| ├─Limit_141(Build) | 200.00 | 200 | cop[tikv] | | time:675.5µs, loops:1, cop_task: {num: 1, max: 647.3µs, proc_keys: 200, tot_proc: 329.1µs, tot_wait: 82.8µs, copr_cache_hit_ratio: 0.00, build_task_duration: 8.13µs, max_distsql_concurrency: 1}, rpc_info:{Cop:{num_rpc:1, total_time:642.8µs}}, tikv_task:{time:0s, loops:3}, scan_detail: {total_process_keys: 200, total_process_keys_size: 18200, total_keys: 201, get_snapshot_time: 69.7µs, rocksdb: {key_skipped_count: 201, block: {cache_hit_count: 4}}}, time_detail: {total_process_time: 329.1µs, total_wait_time: 82.8µs, tikv_wall_time: 486.8µs} | offset:0, count:200 | N/A | N/A |
| │ └─IndexRangeScan_139 | 200.00 | 200 | cop[tikv] | table:ale, index:idx_ref_ts(external_ref_id, created_at, event_uuid) | tikv_task:{time:0s, loops:3} | range:[88888888,88888888], keep order:true, desc | N/A | N/A |
| └─TableRowIDScan_140(Probe) | 200.00 | 200 | cop[tikv] | table:ale | time:4.65ms, loops:2, cop_task: {num: 1, max: 4.58ms, proc_keys: 200, tot_proc: 3.71ms, tot_wait: 28.3µs, copr_cache_hit_ratio: 0.00, build_task_duration: 19.8µs, max_distsql_concurrency: 1}, rpc_info:{Cop:{num_rpc:1, total_time:4.58ms}}, tikv_task:{time:3ms, loops:3}, scan_detail: {total_process_keys: 200, total_process_keys_size: 48800, total_keys: 200, get_snapshot_time: 7.75µs, rocksdb: {block: {cache_hit_count: 388}}}, time_detail: {total_process_time: 3.71ms, total_suspend_time: 16.7µs, total_wait_time: 28.3µs, total_kv_read_wall_time: 3ms, tikv_wall_time: 4.25ms} | keep order:false | N/A | N/A |
+--------------------------------------------------+----------+---------+-----------+--------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+---------+
28 rows in set (0.06 sec)
mysql>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment