sql-1:
EXPLAIN ANALYZE
SELECT
mn.id,
mn.title,
IF(
mn.template_url IS NOT NULL,
mn.template_url,
mn.screen_url
) AS cover,
mn.send_time,
mn.create_time,
mn.media_id,
mn.content,
mn.news_type,
mn.like_num,
mn.collect_num,
mn.read_num,
mn.comment_num,
mn.mp_id
FROM
mp_news mn
WHERE
mn.is_delete = 0
AND mn.is_push = 1
AND mn.mp_id IN (
1815582786249474049,
1820745448125562882,
1823174000712032257
)
ORDER BY
mn.send_time DESC,
mn.id DESC
LIMIT
10;
执行分析计划结果如下:
{
“EXPLAIN ANALYZE\r\nSELECT\r\n mn.id,\r\n mn.title,\r\n IF(\r\n mn.template_url IS NOT NULL,\r\n mn.template_url,\r\n mn.screen_url\r\n ) AS cover,\r\n mn.send_time,\r\n mn.create_time,\r\n mn.media_id,\r\n mn.content,\r\n mn.news_type,\r\n mn.like_num,\r\n mn.collect_num,\r\n mn.read_num,\r\n mn.comment_num,\r\n mn.mp_id\r\nFROM\r\n mp_news mn\r\nWHERE\r\n mn.is_delete = 0\r\n AND mn.is_push = 1\r\n AND mn.mp_id IN (\r\n 1815582786249474049,\r\n 1820745448125562882,\r\n 1823174000712032257\r\n )\r\nORDER BY\r\n mn.send_time DESC,\r\n mn.id DESC\r\nLIMIT\r\n 10”: [
{
“id” : “Projection_7”,
“estRows” : “10.00”,
“actRows” : “10”,
“task” : “root”,
“access object” : “”,
“execution info” : “time:311.8ms, loops:2, RU:2980.925680, Concurrency:OFF”,
“operator info” : “liu_test.mp_news.id, liu_test.mp_news.title, if(not(isnull(liu_test.mp_news.template_url)), liu_test.mp_news.template_url, liu_test.mp_news.screen_url)->Column#27, liu_test.mp_news.send_time, liu_test.mp_news.create_time, liu_test.mp_news.media_id, liu_test.mp_news.content, liu_test.mp_news.news_type, liu_test.mp_news.like_num, liu_test.mp_news.collect_num, liu_test.mp_news.read_num, liu_test.mp_news.comment_num, liu_test.mp_news.mp_id”,
“memory” : “19.8 KB”,
“disk” : “N/A”
},
{
“id” : “└─Limit_12”,
“estRows” : “10.00”,
“actRows” : “10”,
“task” : “root”,
“access object” : “”,
“execution info” : “time:311.8ms, loops:2”,
“operator info” : “offset:0, count:10”,
“memory” : “N/A”,
“disk” : “N/A”
},
{
“id” : " └─IndexLookUp_25",
“estRows” : “10.00”,
“actRows” : “10”,
“task” : “root”,
“access object” : “”,
“execution info” : “time:311.8ms, loops:1, index_task: {total_time: 311.7ms, fetch_handle: 41.5ms, build: 42.2ms, wait: 228.1ms}, table_task: {total_time: 2.36s, num: 28, concurrency: 8}, next: {wait_index: 1.37ms, wait_table_lookup_build: 36.8µs, wait_table_lookup_resp: 310.3ms}”,
“operator info” : “”,
“memory” : “49.0 MB”,
“disk” : “N/A”
},
{
“id” : " ├─IndexFullScan_22(Build)“,
“estRows” : “174.31”,
“actRows” : “423168”,
“task” : “cop[tikv]”,
“access object” : “table:mn, index:idx_send_time(send_time)”,
“execution info” : “time:24.5ms, loops:390, cop_task: {num: 17, max: 28.2ms, min: 216.5µs, avg: 2.15ms, p95: 28.2ms, max_proc_keys: 50144, p95_proc_keys: 50144, tot_proc: 30ms, tot_wait: 1.48ms, copr_cache_hit_ratio: 0.65, build_task_duration: 32µs, max_distsql_concurrency: 2}, rpc_info:{Cop:{num_rpc:17, total_time:36.4ms}}, tikv_task:{proc max:49ms, min:0s, avg: 16.8ms, p80:31ms, p95:49ms, iters:477, tasks:17}, scan_detail: {total_process_keys: 53856, total_process_keys_size: 2477376, total_keys: 53862, get_snapshot_time: 1.05ms, rocksdb: {key_skipped_count: 53861, block: {cache_hit_count: 99}}}, time_detail: {total_process_time: 30ms, total_suspend_time: 66.2µs, total_wait_time: 1.48ms, total_kv_read_wall_time: 29ms, tikv_wall_time: 32.9ms}”,
“operator info” : “keep order:true, desc”,
“memory” : “N/A”,
“disk” : “N/A”
},
{
“id” : " └─Selection_24(Probe)”,
“estRows” : “10.00”,
“actRows” : “14839”,
“task” : “cop[tikv]”,
“access object” : “”,
“execution info” : “time:2.26s, loops:49, cop_task: {num: 39, max: 264.4ms, min: 0s, avg: 51.4ms, p95: 242.4ms, max_proc_keys: 20479, p95_proc_keys: 20473, tot_proc: 1.62s, tot_wait: 4.61ms, copr_cache_hit_ratio: 0.05, build_task_duration: 4.3ms, max_distsql_concurrency: 2, max_extra_concurrency: 1}, rpc_info:{Cop:{num_rpc:39, total_time:2.14s}, rpc_errors:{context canceled:4}}, tikv_task:{proc max:254ms, min:0s, avg: 53.2ms, p80:152ms, p95:232ms, iters:306, tasks:35}, scan_detail: {total_process_keys: 188513, total_process_keys_size: 154794211, total_keys: 206704, get_snapshot_time: 3.67ms, rocksdb: {key_skipped_count: 213195, block: {cache_hit_count: 388324}}}, time_detail: {total_process_time: 1.62s, total_suspend_time: 263.3ms, total_wait_time: 4.61ms, total_kv_read_wall_time: 1.82s, tikv_wall_time: 1.95s}”,
“operator info” : “eq(liu_test.mp_news.is_delete, 0), eq(liu_test.mp_news.is_push, 1), in(liu_test.mp_news.mp_id, 1815582786249474049, 1820745448125562882, 1823174000712032257)”,
“memory” : “N/A”,
“disk” : “N/A”
},
{
“id” : " └─TableRowIDScan_23",
“estRows” : “174.31”,
“actRows” : “190504”,
“task” : “cop[tikv]”,
“access object” : “table:mn”,
“execution info” : “tikv_task:{proc max:251ms, min:0s, avg: 52.5ms, p80:150ms, p95:230ms, iters:306, tasks:35}”,
“operator info” : “keep order:false”,
“memory” : “N/A”,
“disk” : “N/A”
}
]}
sql-2:
EXPLAIN ANALYZE
SELECT
mn.id,
mn.title,
IF(
mn.template_url IS NOT NULL,
mn.template_url,
mn.screen_url
) AS cover,
mn.send_time,
mn.create_time,
mn.media_id,
mn.content,
mn.news_type,
mn.like_num,
mn.collect_num,
mn.read_num,
mn.comment_num,
mn.mp_id
FROM
mp_news mn
WHERE
mn.is_delete = 0
AND mn.is_push = 1
AND mn.mp_id IN (
1815578536521687042,
1815582786249474049,
1820745448125562882,
1823174000712032257
)
ORDER BY
mn.send_time DESC,
mn.id DESC
LIMIT
10;
执行分析计划结果如下:
{
“EXPLAIN ANALYZE\r\nSELECT\r\n mn.id,\r\n mn.title,\r\n IF(\r\n mn.template_url IS NOT NULL,\r\n mn.template_url,\r\n mn.screen_url\r\n ) AS cover,\r\n mn.send_time,\r\n mn.create_time,\r\n mn.media_id,\r\n mn.content,\r\n mn.news_type,\r\n mn.like_num,\r\n mn.collect_num,\r\n mn.read_num,\r\n mn.comment_num,\r\n mn.mp_id\r\nFROM\r\n mp_news mn\r\nWHERE\r\n mn.is_delete = 0\r\n AND mn.is_push = 1\r\n AND mn.mp_id IN (\r\n 1815578536521687042,\r\n 1815582786249474049,\r\n 1820745448125562882,\r\n 1823174000712032257\r\n )\r\nORDER BY\r\n mn.send_time DESC,\r\n mn.id DESC\r\nLIMIT\r\n 10”: [
{
“id” : “Projection_7”,
“estRows” : “10.00”,
“actRows” : “10”,
“task” : “root”,
“access object” : “”,
“execution info” : “time:2.72ms, loops:2, RU:5.928749, Concurrency:OFF”,
“operator info” : “liu_test.mp_news.id, liu_test.mp_news.title, if(not(isnull(liu_test.mp_news.template_url)), liu_test.mp_news.template_url, liu_test.mp_news.screen_url)->Column#27, liu_test.mp_news.send_time, liu_test.mp_news.create_time, liu_test.mp_news.media_id, liu_test.mp_news.content, liu_test.mp_news.news_type, liu_test.mp_news.like_num, liu_test.mp_news.collect_num, liu_test.mp_news.read_num, liu_test.mp_news.comment_num, liu_test.mp_news.mp_id”,
“memory” : “13.9 KB”,
“disk” : “N/A”
},
{
“id” : “└─Limit_12”,
“estRows” : “10.00”,
“actRows” : “10”,
“task” : “root”,
“access object” : “”,
“execution info” : “time:2.7ms, loops:2”,
“operator info” : “offset:0, count:10”,
“memory” : “N/A”,
“disk” : “N/A”
},
{
“id” : " └─IndexLookUp_25",
“estRows” : “10.00”,
“actRows” : “10”,
“task” : “root”,
“access object” : “”,
“execution info” : “time:2.69ms, loops:1, index_task: {total_time: 2.17ms, fetch_handle: 2ms, build: 141.4µs, wait: 21.8µs}, table_task: {total_time: 5.75ms, num: 5, concurrency: 8}, next: {wait_index: 1.29ms, wait_table_lookup_build: 49.5µs, wait_table_lookup_resp: 1.32ms}”,
“operator info” : “”,
“memory” : “125.0 KB”,
“disk” : “N/A”
},
{
“id” : " ├─IndexFullScan_22(Build)“,
“estRows” : “29.50”,
“actRows” : “704”,
“task” : “cop[tikv]”,
“access object” : “table:mn, index:idx_send_time(send_time)”,
“execution info” : “time:2.4ms, loops:7, cop_task: {num: 3, max: 1.02ms, min: 865.3µs, avg: 926.1µs, p95: 1.02ms, max_proc_keys: 480, p95_proc_keys: 480, tot_proc: 832.2µs, tot_wait: 792.3µs, copr_cache_hit_ratio: 0.00, build_task_duration: 35.8µs, max_distsql_concurrency: 2}, rpc_info:{Cop:{num_rpc:3, total_time:2.72ms}}, tikv_task:{proc max:0s, min:0s, avg: 0s, p80:0s, p95:0s, iters:8, tasks:3}, scan_detail: {total_process_keys: 704, total_process_keys_size: 32384, total_keys: 707, get_snapshot_time: 683.3µs, rocksdb: {key_skipped_count: 706, block: {cache_hit_count: 13}}}, time_detail: {total_process_time: 832.2µs, total_wait_time: 792.3µs, tikv_wall_time: 2ms}”,
“operator info” : “keep order:true, desc”,
“memory” : “N/A”,
“disk” : “N/A”
},
{
“id” : " └─Selection_24(Probe)”,
“estRows” : “10.00”,
“actRows” : “15”,
“task” : “cop[tikv]”,
“access object” : “”,
“execution info” : “time:4.76ms, loops:6, cop_task: {num: 2, max: 1.2ms, min: 0s, avg: 598.9µs, p95: 1.2ms, max_proc_keys: 32, p95_proc_keys: 32, tot_proc: 744.2µs, tot_wait: 44.5µs, copr_cache_hit_ratio: 0.00, build_task_duration: 66.8µs, max_distsql_concurrency: 1, max_extra_concurrency: 1}, rpc_info:{Cop:{num_rpc:2, total_time:2.49ms}, rpc_errors:{context canceled:1}}, tikv_task:{time:1ms, loops:2}, scan_detail: {total_process_keys: 32, total_process_keys_size: 41559, total_keys: 34, get_snapshot_time: 21.4µs, rocksdb: {key_skipped_count: 22, block: {cache_hit_count: 73}}}, time_detail: {total_process_time: 744.2µs, total_wait_time: 44.5µs, total_kv_read_wall_time: 1ms, tikv_wall_time: 996.8µs}”,
“operator info” : “eq(liu_test.mp_news.is_delete, 0), eq(liu_test.mp_news.is_push, 1), in(liu_test.mp_news.mp_id, 1815578536521687042, 1815582786249474049, 1820745448125562882, 1823174000712032257)”,
“memory” : “N/A”,
“disk” : “N/A”
},
{
“id” : " └─TableRowIDScan_23",
“estRows” : “29.50”,
“actRows” : “32”,
“task” : “cop[tikv]”,
“access object” : “table:mn”,
“execution info” : “tikv_task:{time:1ms, loops:2}”,
“operator info” : “keep order:false”,
“memory” : “N/A”,
“disk” : “N/A”
}
]}