是的,把order by 去掉后,速度直接8秒,这是怎么回事?
mysql> explain analyze SELECT xpost.postid, xpost.facetid, xpost.entryid, xpost.title, xpost.url, xpost.abstract, xpost.click, xpost.reply, xpost.repost, xpost.praise, xpost.collect, xpost.wordscount, xpost.siteid, xpost.domain, xpost.author, xpost.author_id, xpost.posttime, xpost.include_t, xpost.type, xpost.source, xpost.hidden, xpost.sourcetype, xpost.crisis_post, xpost.ontop, xpost.type_rank, xpost.pos_type_rank, xpost.noise_rank, xpost.device, xpost.is_origin, xpost.is_top, xpost.media_type, xpost.author_type, xpost.content_type, xpost.client_type, xpost.industry, xpost.tags, xpost.post_type, xpost.type_reason, xpost.update_time, xpost.origin_source, xpost.media_id, xpost.w_level, xpost.watch, xpost.keywordcount, xpost.location, xpost.is_comment, xpost.text, xpost.spider_time, xpost.process_time, xpost.tidb_in_time FROM xpost FORCE INDEX (idx_xpost_entryid) WHERE (xpost.entryid IN (4856577, 4855938, 4856069, 4855686, 4856079, 4857488, 4857618, 4855699, 4856087, 4855966, 4854815, 4855201, 4855714, 4855076, 4851496, 4855083, 4854830, 4856371, 4855608, 4851514, 4857916, 4852797, 4855743, 4851522, 4855748, 4855365, 4851526, 4855624, 4855626, 4856654, 4856018, 4855635, 4855764, 4855637, 4855766, 4854986, 4857305, 4855134, 4855135, 4857706, 4857454, 4855408, 4857211, 4856062) AND (1) AND xpost.hidden IN (-2, -1, 0, 2, 3, 4)) \G;
*************************** 1. row ***************************
id: Projection_4
estRows: 9978.21
actRows: 1244055
task: root
access object:
execution info: time:7.85s, loops:1216, Concurrency:5
operator info: bsppr.xpost.postid, bsppr.xpost.facetid, bsppr.xpost.entryid, bsppr.xpost.title, bsppr.xpost.url, bsppr.xpost.abstract, bsppr.xpost.click, bsppr.xpost.reply, bsppr.xpost.repost, bsppr.xpost.praise, bsppr.xpost.collect, bsppr.xpost.wordscount, bsppr.xpost.siteid, bsppr.xpost.domain, bsppr.xpost.author, bsppr.xpost.author_id, bsppr.xpost.posttime, bsppr.xpost.include_t, bsppr.xpost.type, bsppr.xpost.source, bsppr.xpost.hidden, bsppr.xpost.sourcetype, bsppr.xpost.crisis_post, bsppr.xpost.ontop, bsppr.xpost.type_rank, bsppr.xpost.pos_type_rank, bsppr.xpost.noise_rank, bsppr.xpost.device, bsppr.xpost.is_origin, bsppr.xpost.is_top, bsppr.xpost.media_type, bsppr.xpost.author_type, bsppr.xpost.content_type, bsppr.xpost.client_type, bsppr.xpost.industry, bsppr.xpost.tags, bsppr.xpost.post_type, bsppr.xpost.type_reason, bsppr.xpost.update_time, bsppr.xpost.origin_source, bsppr.xpost.media_id, bsppr.xpost.w_level, bsppr.xpost.watch, bsppr.xpost.keywordcount, bsppr.xpost.location, bsppr.xpost.is_comment, bsppr.xpost.text, bsppr.xpost.spider_time, bsppr.xpost.process_time, bsppr.xpost.tidb_in_time
memory: 13.6 MB
disk: N/A
*************************** 2. row ***************************
id: └─IndexLookUp_8
estRows: 9978.21
actRows: 1244055
task: root
access object:
execution info: time:7.85s, loops:1216, index_task: {total_time: 7.21s, fetch_handle: 126ms, build: 183.1µs, wait: 7.09s}, table_task: {total_time: 37.9s, num: 65, concurrency: 5}, next: {wait_index: 10.9ms, wait_table_lookup_build: 53.4ms, wait_table_lookup_resp: 6.33s}
operator info:
memory: 174.5 MB
disk: N/A
*************************** 3. row ***************************
id: ├─IndexRangeScan_5(Build)
estRows: 83843.43
actRows: 1244114
task: cop[tikv]
access object: table:xpost, index:idx_xpost_entryid(entryid)
execution info: time:13ms, loops:1239, cop_task: {num: 138, max: 134.1ms, min: 362µs, avg: 15ms, p95: 71.5ms, max_proc_keys: 50144, p95_proc_keys: 50144, tot_proc: 842ms, tot_wait: 80ms, rpc_num: 138, rpc_time: 2.07s, copr_cache_hit_ratio: 0.09, distsql_concurrency: 15}, tikv_task:{proc max:70ms, min:0s, avg: 6.7ms, p80:10ms, p95:26ms, iters:1742, tasks:138}, scan_detail: {total_process_keys: 1194726, total_process_keys_size: 54957396, total_keys: 1484878, get_snapshot_time: 86ms, rocksdb: {delete_skipped_count: 18, key_skipped_count: 1484732, block: {cache_hit_count: 2400, read_count: 10, read_byte: 159.9 KB, read_time: 294µs}}}
operator info: range:[4851496,4851496], [4851514,4851514], [4851522,4851522], [4851526,4851526], [4852797,4852797], [4854815,4854815], [4854830,4854830], [4854986,4854986], [4855076,4855076], [4855083,4855083], [4855134,4855134], [4855135,4855135], [4855201,4855201], [4855365,4855365], [4855408,4855408], [4855608,4855608], [4855624,4855624], [4855626,4855626], [4855635,4855635], [4855637,4855637], [4855686,4855686], [4855699,4855699], [4855714,4855714], [4855743,4855743], [4855748,4855748], [4855764,4855764], [4855766,4855766], [4855938,4855938], [4855966,4855966], [4856018,4856018], [4856062,4856062], [4856069,4856069], [4856079,4856079], [4856087,4856087], [4856371,4856371], [4856577,4856577], [4856654,4856654], [4857211,4857211], [4857305,4857305], [4857454,4857454], [4857488,4857488], [4857618,4857618], [4857706,4857706], [4857916,4857916], keep order:false
memory: N/A
disk: N/A
*************************** 4. row ***************************
id: └─Selection_7(Probe)
estRows: 9978.21
actRows: 1244055
task: cop[tikv]
access object:
execution info: time:34.5s, loops:1362, cop_task: {num: 8238, max: 1.28s, min: 669.6µs, avg: 47.2ms, p95: 215.9ms, max_proc_keys: 20480, p95_proc_keys: 630, tot_proc: 55.6s, tot_wait: 9.34s, rpc_num: 8238, rpc_time: 6m28.8s, copr_cache_hit_ratio: 0.11, distsql_concurrency: 15}, tikv_task:{proc max:724ms, min:0s, avg: 8.1ms, p80:7ms, p95:35ms, iters:15178, tasks:8238}, scan_detail: {total_process_keys: 1056051, total_process_keys_size: 721790478, total_keys: 1205112, get_snapshot_time: 8.88s, rocksdb: {delete_skipped_count: 19, key_skipped_count: 417205, block: {cache_hit_count: 11070198, read_count: 55, read_byte: 677.0 KB, read_time: 6.7ms}}}
operator info: in(bsppr.xpost.hidden, -2, -1, 0, 2, 3, 4)
memory: N/A
disk: N/A
*************************** 5. row ***************************
id: └─TableRowIDScan_6
estRows: 83843.43
actRows: 1244114
task: cop[tikv]
access object: table:xpost
execution info: tikv_task:{proc max:723ms, min:0s, avg: 8.07ms, p80:7ms, p95:35ms, iters:15178, tasks:8238}
operator info: keep order:false
memory: N/A
disk: N/A
5 rows in set (7.86 sec)