Debian Codegraph @

mysql-test/suite/opt_trace/r/filesort_pq.result

raw
1 SET optimizer_trace_max_mem_size=1048576;
2 SET end_markers_in_json=off;
3 SET optimizer_trace="enabled=on,one_line=off";
4 #
5 # WL#1393 - Optimizing filesort with small limit
6 # WL#5834 - Add optimizer traces for sorting
7 #
8 CREATE TABLE t1(f0 int auto_increment primary key, f1 int, f2 varchar(200))
9 charset latin1;
10 INSERT INTO t1(f1, f2) VALUES
11 (0,"0"),(1,"1"),(2,"2"),(3,"3"),(4,"4"),(5,"5"),
12 (6,"6"),(7,"7"),(8,"8"),(9,"9"),(10,"10"),
13 (11,"11"),(12,"12"),(13,"13"),(14,"14"),(15,"15"),
14 (16,"16"),(17,"17"),(18,"18"),(19,"19"),(20,"20"),
15 (21,"21"),(22,"22"),(23,"23"),(24,"24"),(25,"25"),
16 (26,"26"),(27,"27"),(28,"28"),(29,"29"),(30,"30"),
17 (31,"31"),(32,"32"),(33,"33"),(34,"34"),(35,"35"),
18 (36,"36"),(37,"37"),(38,"38"),(39,"39"),(40,"40"),
19 (41,"41"),(42,"42"),(43,"43"),(44,"44"),(45,"45"),
20 (46,"46"),(47,"47"),(48,"48"),(49,"49"),(50,"50"),
21 (51,"51"),(52,"52"),(53,"53"),(54,"54"),(55,"55"),
22 (56,"56"),(57,"57"),(58,"58"),(59,"59"),(60,"60"),
23 (61,"61"),(62,"62"),(63,"63"),(64,"64"),(65,"65"),
24 (66,"66"),(67,"67"),(68,"68"),(69,"69"),(70,"70"),
25 (71,"71"),(72,"72"),(73,"73"),(74,"74"),(75,"75"),
26 (76,"76"),(77,"77"),(78,"78"),(79,"79"),(80,"80"),
27 (81,"81"),(82,"82"),(83,"83"),(84,"84"),(85,"85"),
28 (86,"86"),(87,"87"),(88,"88"),(89,"89"),(90,"90"),
29 (91,"91"),(92,"92"),(93,"93"),(94,"94"),(95,"95"),
30 (96,"96"),(97,"97"),(98,"98"),(99,"99");
31 SELECT * FROM t1 ORDER BY f1 ASC, f0 LIMIT 100;
32 f0 f1 f2
33 1 0 0
34 2 1 1
35 3 2 2
36 4 3 3
37 5 4 4
38 6 5 5
39 7 6 6
40 8 7 7
41 9 8 8
42 10 9 9
43 11 10 10
44 12 11 11
45 13 12 12
46 14 13 13
47 15 14 14
48 16 15 15
49 17 16 16
50 18 17 17
51 19 18 18
52 20 19 19
53 21 20 20
54 22 21 21
55 23 22 22
56 24 23 23
57 25 24 24
58 26 25 25
59 27 26 26
60 28 27 27
61 29 28 28
62 30 29 29
63 31 30 30
64 32 31 31
65 33 32 32
66 34 33 33
67 35 34 34
68 36 35 35
69 37 36 36
70 38 37 37
71 39 38 38
72 40 39 39
73 41 40 40
74 42 41 41
75 43 42 42
76 44 43 43
77 45 44 44
78 46 45 45
79 47 46 46
80 48 47 47
81 49 48 48
82 50 49 49
83 51 50 50
84 52 51 51
85 53 52 52
86 54 53 53
87 55 54 54
88 56 55 55
89 57 56 56
90 58 57 57
91 59 58 58
92 60 59 59
93 61 60 60
94 62 61 61
95 63 62 62
96 64 63 63
97 65 64 64
98 66 65 65
99 67 66 66
100 68 67 67
101 69 68 68
102 70 69 69
103 71 70 70
104 72 71 71
105 73 72 72
106 74 73 73
107 75 74 74
108 76 75 75
109 77 76 76
110 78 77 77
111 79 78 78
112 80 79 79
113 81 80 80
114 82 81 81
115 83 82 82
116 84 83 83
117 85 84 84
118 86 85 85
119 87 86 86
120 88 87 87
121 89 88 88
122 90 89 89
123 91 90 90
124 92 91 91
125 93 92 92
126 94 93 93
127 95 94 94
128 96 95 95
129 97 96 96
130 98 97 97
131 99 98 98
132 100 99 99
133 SELECT * FROM information_schema.OPTIMIZER_TRACE;
134 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
135 SELECT * FROM t1 ORDER BY f1 ASC, f0 LIMIT 100 {
136 "steps": [
137 {
138 "join_preparation": {
139 "select#": 1,
140 "steps": [
141 {
142 "expanded_query": "/* select#1 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` order by `t1`.`f1`,`t1`.`f0` limit 100"
143 }
144 ]
145 }
146 },
147 {
148 "join_optimization": {
149 "select#": 1,
150 "steps": [
151 {
152 "substitute_generated_columns": {
153 }
154 },
155 {
156 "table_dependencies": [
157 {
158 "table": "`t1`",
159 "row_may_be_null": false,
160 "map_bit": 0,
161 "depends_on_map_bits": [
162 ]
163 }
164 ]
165 },
166 {
167 "rows_estimation": [
168 {
169 "table": "`t1`",
170 "table_scan": {
171 "rows": 100,
172 "cost": 0.62207
173 }
174 }
175 ]
176 },
177 {
178 "considered_execution_plans": [
179 {
180 "plan_prefix": [
181 ],
182 "table": "`t1`",
183 "best_access_path": {
184 "considered_access_paths": [
185 {
186 "rows_to_scan": 100,
187 "access_type": "scan",
188 "resulting_rows": 100,
189 "cost": 10.6221,
190 "chosen": true,
191 "use_tmp_table": true
192 }
193 ]
194 },
195 "condition_filtering_pct": 100,
196 "rows_for_plan": 100,
197 "cost_for_plan": 10.6221,
198 "sort_cost": 100,
199 "new_cost_for_plan": 110.622,
200 "chosen": true
201 }
202 ]
203 },
204 {
205 "attaching_conditions_to_tables": {
206 "original_condition": null,
207 "attached_conditions_computation": [
208 ],
209 "attached_conditions_summary": [
210 {
211 "table": "`t1`",
212 "attached": null
213 }
214 ]
215 }
216 },
217 {
218 "optimizing_distinct_group_by_order_by": {
219 "simplifying_order_by": {
220 "original_clause": "`t1`.`f1`,`t1`.`f0`",
221 "items": [
222 {
223 "item": "`t1`.`f1`"
224 },
225 {
226 "item": "`t1`.`f0`"
227 }
228 ],
229 "resulting_clause_is_simple": true,
230 "resulting_clause": "`t1`.`f1`,`t1`.`f0`"
231 }
232 }
233 },
234 {
235 "finalizing_table_conditions": [
236 ]
237 },
238 {
239 "refine_plan": [
240 {
241 "table": "`t1`"
242 }
243 ]
244 },
245 {
246 "considering_tmp_tables": [
247 {
248 "adding_sort_to_table": "t1"
249 }
250 ]
251 }
252 ]
253 }
254 },
255 {
256 "join_execution": {
257 "select#": 1,
258 "steps": [
259 {
260 "sorting_table": "t1",
261 "filesort_information": [
262 {
263 "direction": "asc",
264 "expression": "`t1`.`f1`"
265 },
266 {
267 "direction": "asc",
268 "expression": "`t1`.`f0`"
269 }
270 ],
271 "filesort_priority_queue_optimization": {
272 "limit": 100,
273 "chosen": false,
274 "cause": "sort_is_cheaper"
275 },
276 "filesort_execution": [
277 ],
278 "filesort_summary": {
279 "memory_available": 262144,
280 "key_size": 17,
281 "row_size": 231,
282 "max_rows_per_buffer": 100,
283 "num_rows_estimate": 100,
284 "num_rows_found": 100,
285 "num_initial_chunks_spilled_to_disk": 0,
286 "peak_memory_used": "NNN",
287 "sort_algorithm": "std::sort",
288 "sort_mode": "<fixed_sort_key, packed_additional_fields>"
289 }
290 }
291 ]
292 }
293 }
294 ]
295 } 0 0
296 SELECT * FROM t1 ORDER BY f1 ASC, f0 LIMIT 30;
297 f0 f1 f2
298 1 0 0
299 2 1 1
300 3 2 2
301 4 3 3
302 5 4 4
303 6 5 5
304 7 6 6
305 8 7 7
306 9 8 8
307 10 9 9
308 11 10 10
309 12 11 11
310 13 12 12
311 14 13 13
312 15 14 14
313 16 15 15
314 17 16 16
315 18 17 17
316 19 18 18
317 20 19 19
318 21 20 20
319 22 21 21
320 23 22 22
321 24 23 23
322 25 24 24
323 26 25 25
324 27 26 26
325 28 27 27
326 29 28 28
327 30 29 29
328 SELECT * FROM information_schema.OPTIMIZER_TRACE;
329 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
330 SELECT * FROM t1 ORDER BY f1 ASC, f0 LIMIT 30 {
331 "steps": [
332 {
333 "join_preparation": {
334 "select#": 1,
335 "steps": [
336 {
337 "expanded_query": "/* select#1 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` order by `t1`.`f1`,`t1`.`f0` limit 30"
338 }
339 ]
340 }
341 },
342 {
343 "join_optimization": {
344 "select#": 1,
345 "steps": [
346 {
347 "substitute_generated_columns": {
348 }
349 },
350 {
351 "table_dependencies": [
352 {
353 "table": "`t1`",
354 "row_may_be_null": false,
355 "map_bit": 0,
356 "depends_on_map_bits": [
357 ]
358 }
359 ]
360 },
361 {
362 "rows_estimation": [
363 {
364 "table": "`t1`",
365 "table_scan": {
366 "rows": 100,
367 "cost": 0.62207
368 }
369 }
370 ]
371 },
372 {
373 "considered_execution_plans": [
374 {
375 "plan_prefix": [
376 ],
377 "table": "`t1`",
378 "best_access_path": {
379 "considered_access_paths": [
380 {
381 "rows_to_scan": 100,
382 "access_type": "scan",
383 "resulting_rows": 100,
384 "cost": 10.6221,
385 "chosen": true
386 }
387 ]
388 },
389 "condition_filtering_pct": 100,
390 "rows_for_plan": 100,
391 "cost_for_plan": 10.6221,
392 "chosen": true
393 }
394 ]
395 },
396 {
397 "attaching_conditions_to_tables": {
398 "original_condition": null,
399 "attached_conditions_computation": [
400 ],
401 "attached_conditions_summary": [
402 {
403 "table": "`t1`",
404 "attached": null
405 }
406 ]
407 }
408 },
409 {
410 "optimizing_distinct_group_by_order_by": {
411 "simplifying_order_by": {
412 "original_clause": "`t1`.`f1`,`t1`.`f0`",
413 "items": [
414 {
415 "item": "`t1`.`f1`"
416 },
417 {
418 "item": "`t1`.`f0`"
419 }
420 ],
421 "resulting_clause_is_simple": true,
422 "resulting_clause": "`t1`.`f1`,`t1`.`f0`"
423 }
424 }
425 },
426 {
427 "finalizing_table_conditions": [
428 ]
429 },
430 {
431 "refine_plan": [
432 {
433 "table": "`t1`"
434 }
435 ]
436 },
437 {
438 "considering_tmp_tables": [
439 {
440 "adding_sort_to_table": "t1"
441 }
442 ]
443 }
444 ]
445 }
446 },
447 {
448 "join_execution": {
449 "select#": 1,
450 "steps": [
451 {
452 "sorting_table": "t1",
453 "filesort_information": [
454 {
455 "direction": "asc",
456 "expression": "`t1`.`f1`"
457 },
458 {
459 "direction": "asc",
460 "expression": "`t1`.`f0`"
461 }
462 ],
463 "filesort_priority_queue_optimization": {
464 "limit": 30,
465 "chosen": true
466 },
467 "filesort_execution": [
468 ],
469 "filesort_summary": {
470 "memory_available": 262144,
471 "key_size": 17,
472 "row_size": 227,
473 "max_rows_per_buffer": 31,
474 "num_rows_estimate": 100,
475 "num_rows_found": 100,
476 "num_initial_chunks_spilled_to_disk": 0,
477 "peak_memory_used": "NNN",
478 "sort_algorithm": "std::sort",
479 "unpacked_addon_fields": "using_priority_queue",
480 "sort_mode": "<fixed_sort_key, additional_fields>"
481 }
482 }
483 ]
484 }
485 }
486 ]
487 } 0 0
488 SELECT * FROM t1 ORDER BY f1 ASC, f0 LIMIT 0;
489 f0 f1 f2
490 SELECT * FROM information_schema.OPTIMIZER_TRACE;
491 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
492 SELECT * FROM t1 ORDER BY f1 ASC, f0 LIMIT 0 {
493 "steps": [
494 {
495 "join_preparation": {
496 "select#": 1,
497 "steps": [
498 {
499 "expanded_query": "/* select#1 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` order by `t1`.`f1`,`t1`.`f0` limit 0"
500 }
501 ]
502 }
503 },
504 {
505 "join_optimization": {
506 "select#": 1,
507 "steps": [
508 ],
509 "empty_result": {
510 "cause": "Zero limit"
511 }
512 }
513 },
514 {
515 "join_execution": {
516 "select#": 1,
517 "steps": [
518 ]
519 }
520 }
521 ]
522 } 0 0
523 SELECT * FROM t1 ORDER BY f2 DESC, f0 LIMIT 30;
524 f0 f1 f2
525 100 99 99
526 99 98 98
527 98 97 97
528 97 96 96
529 96 95 95
530 95 94 94
531 94 93 93
532 93 92 92
533 92 91 91
534 91 90 90
535 10 9 9
536 90 89 89
537 89 88 88
538 88 87 87
539 87 86 86
540 86 85 85
541 85 84 84
542 84 83 83
543 83 82 82
544 82 81 81
545 81 80 80
546 9 8 8
547 80 79 79
548 79 78 78
549 78 77 77
550 77 76 76
551 76 75 75
552 75 74 74
553 74 73 73
554 73 72 72
555 SELECT * FROM information_schema.OPTIMIZER_TRACE;
556 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
557 SELECT * FROM t1 ORDER BY f2 DESC, f0 LIMIT 30 {
558 "steps": [
559 {
560 "join_preparation": {
561 "select#": 1,
562 "steps": [
563 {
564 "expanded_query": "/* select#1 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` order by `t1`.`f2` desc,`t1`.`f0` limit 30"
565 }
566 ]
567 }
568 },
569 {
570 "join_optimization": {
571 "select#": 1,
572 "steps": [
573 {
574 "substitute_generated_columns": {
575 }
576 },
577 {
578 "table_dependencies": [
579 {
580 "table": "`t1`",
581 "row_may_be_null": false,
582 "map_bit": 0,
583 "depends_on_map_bits": [
584 ]
585 }
586 ]
587 },
588 {
589 "rows_estimation": [
590 {
591 "table": "`t1`",
592 "table_scan": {
593 "rows": 100,
594 "cost": 0.62207
595 }
596 }
597 ]
598 },
599 {
600 "considered_execution_plans": [
601 {
602 "plan_prefix": [
603 ],
604 "table": "`t1`",
605 "best_access_path": {
606 "considered_access_paths": [
607 {
608 "rows_to_scan": 100,
609 "access_type": "scan",
610 "resulting_rows": 100,
611 "cost": 10.6221,
612 "chosen": true
613 }
614 ]
615 },
616 "condition_filtering_pct": 100,
617 "rows_for_plan": 100,
618 "cost_for_plan": 10.6221,
619 "chosen": true
620 }
621 ]
622 },
623 {
624 "attaching_conditions_to_tables": {
625 "original_condition": null,
626 "attached_conditions_computation": [
627 ],
628 "attached_conditions_summary": [
629 {
630 "table": "`t1`",
631 "attached": null
632 }
633 ]
634 }
635 },
636 {
637 "optimizing_distinct_group_by_order_by": {
638 "simplifying_order_by": {
639 "original_clause": "`t1`.`f2` desc,`t1`.`f0`",
640 "items": [
641 {
642 "item": "`t1`.`f2`"
643 },
644 {
645 "item": "`t1`.`f0`"
646 }
647 ],
648 "resulting_clause_is_simple": true,
649 "resulting_clause": "`t1`.`f2` desc,`t1`.`f0`"
650 }
651 }
652 },
653 {
654 "finalizing_table_conditions": [
655 ]
656 },
657 {
658 "refine_plan": [
659 {
660 "table": "`t1`"
661 }
662 ]
663 },
664 {
665 "considering_tmp_tables": [
666 {
667 "adding_sort_to_table": "t1"
668 }
669 ]
670 }
671 ]
672 }
673 },
674 {
675 "join_execution": {
676 "select#": 1,
677 "steps": [
678 {
679 "sorting_table": "t1",
680 "filesort_information": [
681 {
682 "direction": "desc",
683 "expression": "`t1`.`f2`"
684 },
685 {
686 "direction": "asc",
687 "expression": "`t1`.`f0`"
688 }
689 ],
690 "filesort_priority_queue_optimization": {
691 "limit": 30,
692 "chosen": true
693 },
694 "filesort_execution": [
695 ],
696 "filesort_summary": {
697 "memory_available": 262144,
698 "key_size": 209,
699 "row_size": 419,
700 "max_rows_per_buffer": 31,
701 "num_rows_estimate": 100,
702 "num_rows_found": 100,
703 "num_initial_chunks_spilled_to_disk": 0,
704 "peak_memory_used": "NNN",
705 "sort_algorithm": "std::sort",
706 "unpacked_addon_fields": "using_priority_queue",
707 "sort_mode": "<fixed_sort_key, additional_fields>"
708 }
709 }
710 ]
711 }
712 }
713 ]
714 } 0 0
715 SELECT * FROM t1 ORDER BY f2 DESC, f0 LIMIT 0;
716 f0 f1 f2
717 SELECT * FROM information_schema.OPTIMIZER_TRACE;
718 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
719 SELECT * FROM t1 ORDER BY f2 DESC, f0 LIMIT 0 {
720 "steps": [
721 {
722 "join_preparation": {
723 "select#": 1,
724 "steps": [
725 {
726 "expanded_query": "/* select#1 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` order by `t1`.`f2` desc,`t1`.`f0` limit 0"
727 }
728 ]
729 }
730 },
731 {
732 "join_optimization": {
733 "select#": 1,
734 "steps": [
735 ],
736 "empty_result": {
737 "cause": "Zero limit"
738 }
739 }
740 },
741 {
742 "join_execution": {
743 "select#": 1,
744 "steps": [
745 ]
746 }
747 }
748 ]
749 } 0 0
750 SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 20;
751 f0 f1 f2
752 12 11 11
753 13 12 12
754 14 13 13
755 15 14 14
756 16 15 15
757 17 16 16
758 18 17 17
759 19 18 18
760 20 19 19
761 21 20 20
762 22 21 21
763 23 22 22
764 24 23 23
765 25 24 24
766 26 25 25
767 27 26 26
768 28 27 27
769 29 28 28
770 30 29 29
771 31 30 30
772 SELECT * FROM information_schema.OPTIMIZER_TRACE;
773 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
774 SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 20 {
775 "steps": [
776 {
777 "join_preparation": {
778 "select#": 1,
779 "steps": [
780 {
781 "expanded_query": "/* select#1 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` where (`t1`.`f1` > 10) order by `t1`.`f2`,`t1`.`f0` limit 20"
782 }
783 ]
784 }
785 },
786 {
787 "join_optimization": {
788 "select#": 1,
789 "steps": [
790 {
791 "condition_processing": {
792 "condition": "WHERE",
793 "original_condition": "(`t1`.`f1` > 10)",
794 "steps": [
795 {
796 "transformation": "equality_propagation",
797 "resulting_condition": "(`t1`.`f1` > 10)"
798 },
799 {
800 "transformation": "constant_propagation",
801 "resulting_condition": "(`t1`.`f1` > 10)"
802 },
803 {
804 "transformation": "trivial_condition_removal",
805 "resulting_condition": "(`t1`.`f1` > 10)"
806 }
807 ]
808 }
809 },
810 {
811 "substitute_generated_columns": {
812 }
813 },
814 {
815 "table_dependencies": [
816 {
817 "table": "`t1`",
818 "row_may_be_null": false,
819 "map_bit": 0,
820 "depends_on_map_bits": [
821 ]
822 }
823 ]
824 },
825 {
826 "ref_optimizer_key_uses": [
827 ]
828 },
829 {
830 "rows_estimation": [
831 {
832 "table": "`t1`",
833 "table_scan": {
834 "rows": 100,
835 "cost": 0.62207
836 }
837 }
838 ]
839 },
840 {
841 "considered_execution_plans": [
842 {
843 "plan_prefix": [
844 ],
845 "table": "`t1`",
846 "best_access_path": {
847 "considered_access_paths": [
848 {
849 "rows_to_scan": 100,
850 "filtering_effect": [
851 ],
852 "final_filtering_effect": 0.3333,
853 "access_type": "scan",
854 "resulting_rows": 33.33,
855 "cost": 10.6221,
856 "chosen": true
857 }
858 ]
859 },
860 "condition_filtering_pct": 100,
861 "rows_for_plan": 33.33,
862 "cost_for_plan": 10.6221,
863 "chosen": true
864 }
865 ]
866 },
867 {
868 "attaching_conditions_to_tables": {
869 "original_condition": "(`t1`.`f1` > 10)",
870 "attached_conditions_computation": [
871 ],
872 "attached_conditions_summary": [
873 {
874 "table": "`t1`",
875 "attached": "(`t1`.`f1` > 10)"
876 }
877 ]
878 }
879 },
880 {
881 "optimizing_distinct_group_by_order_by": {
882 "simplifying_order_by": {
883 "original_clause": "`t1`.`f2`,`t1`.`f0`",
884 "items": [
885 {
886 "item": "`t1`.`f2`"
887 },
888 {
889 "item": "`t1`.`f0`"
890 }
891 ],
892 "resulting_clause_is_simple": true,
893 "resulting_clause": "`t1`.`f2`,`t1`.`f0`"
894 }
895 }
896 },
897 {
898 "finalizing_table_conditions": [
899 {
900 "table": "`t1`",
901 "original_table_condition": "(`t1`.`f1` > 10)",
902 "final_table_condition ": "(`t1`.`f1` > 10)"
903 }
904 ]
905 },
906 {
907 "refine_plan": [
908 {
909 "table": "`t1`"
910 }
911 ]
912 },
913 {
914 "considering_tmp_tables": [
915 {
916 "adding_sort_to_table": "t1"
917 }
918 ]
919 }
920 ]
921 }
922 },
923 {
924 "join_execution": {
925 "select#": 1,
926 "steps": [
927 {
928 "sorting_table": "t1",
929 "filesort_information": [
930 {
931 "direction": "asc",
932 "expression": "`t1`.`f2`"
933 },
934 {
935 "direction": "asc",
936 "expression": "`t1`.`f0`"
937 }
938 ],
939 "filesort_priority_queue_optimization": {
940 "limit": 20,
941 "chosen": true
942 },
943 "filesort_execution": [
944 ],
945 "filesort_summary": {
946 "memory_available": 262144,
947 "key_size": 209,
948 "row_size": 419,
949 "max_rows_per_buffer": 21,
950 "num_rows_estimate": 100,
951 "num_rows_found": 89,
952 "num_initial_chunks_spilled_to_disk": 0,
953 "peak_memory_used": "NNN",
954 "sort_algorithm": "std::sort",
955 "unpacked_addon_fields": "using_priority_queue",
956 "sort_mode": "<fixed_sort_key, additional_fields>"
957 }
958 }
959 ]
960 }
961 }
962 ]
963 } 0 0
964 SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 0;
965 f0 f1 f2
966 SELECT * FROM information_schema.OPTIMIZER_TRACE;
967 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
968 SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 0 {
969 "steps": [
970 {
971 "join_preparation": {
972 "select#": 1,
973 "steps": [
974 {
975 "expanded_query": "/* select#1 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` where (`t1`.`f1` > 10) order by `t1`.`f2`,`t1`.`f0` limit 0"
976 }
977 ]
978 }
979 },
980 {
981 "join_optimization": {
982 "select#": 1,
983 "steps": [
984 ],
985 "empty_result": {
986 "cause": "Zero limit"
987 }
988 }
989 },
990 {
991 "join_execution": {
992 "select#": 1,
993 "steps": [
994 ]
995 }
996 }
997 ]
998 } 0 0
999 SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 10 OFFSET 10;
1000 f0 f1 f2
1001 22 21 21
1002 23 22 22
1003 24 23 23
1004 25 24 24
1005 26 25 25
1006 27 26 26
1007 28 27 27
1008 29 28 28
1009 30 29 29
1010 31 30 30
1011 SELECT * FROM information_schema.OPTIMIZER_TRACE;
1012 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
1013 SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 10 OFFSET 10 {
1014 "steps": [
1015 {
1016 "join_preparation": {
1017 "select#": 1,
1018 "steps": [
1019 {
1020 "expanded_query": "/* select#1 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` where (`t1`.`f1` > 10) order by `t1`.`f2`,`t1`.`f0` limit 10,10"
1021 }
1022 ]
1023 }
1024 },
1025 {
1026 "join_optimization": {
1027 "select#": 1,
1028 "steps": [
1029 {
1030 "condition_processing": {
1031 "condition": "WHERE",
1032 "original_condition": "(`t1`.`f1` > 10)",
1033 "steps": [
1034 {
1035 "transformation": "equality_propagation",
1036 "resulting_condition": "(`t1`.`f1` > 10)"
1037 },
1038 {
1039 "transformation": "constant_propagation",
1040 "resulting_condition": "(`t1`.`f1` > 10)"
1041 },
1042 {
1043 "transformation": "trivial_condition_removal",
1044 "resulting_condition": "(`t1`.`f1` > 10)"
1045 }
1046 ]
1047 }
1048 },
1049 {
1050 "substitute_generated_columns": {
1051 }
1052 },
1053 {
1054 "table_dependencies": [
1055 {
1056 "table": "`t1`",
1057 "row_may_be_null": false,
1058 "map_bit": 0,
1059 "depends_on_map_bits": [
1060 ]
1061 }
1062 ]
1063 },
1064 {
1065 "ref_optimizer_key_uses": [
1066 ]
1067 },
1068 {
1069 "rows_estimation": [
1070 {
1071 "table": "`t1`",
1072 "table_scan": {
1073 "rows": 100,
1074 "cost": 0.62207
1075 }
1076 }
1077 ]
1078 },
1079 {
1080 "considered_execution_plans": [
1081 {
1082 "plan_prefix": [
1083 ],
1084 "table": "`t1`",
1085 "best_access_path": {
1086 "considered_access_paths": [
1087 {
1088 "rows_to_scan": 100,
1089 "filtering_effect": [
1090 ],
1091 "final_filtering_effect": 0.3333,
1092 "access_type": "scan",
1093 "resulting_rows": 33.33,
1094 "cost": 10.6221,
1095 "chosen": true
1096 }
1097 ]
1098 },
1099 "condition_filtering_pct": 100,
1100 "rows_for_plan": 33.33,
1101 "cost_for_plan": 10.6221,
1102 "chosen": true
1103 }
1104 ]
1105 },
1106 {
1107 "attaching_conditions_to_tables": {
1108 "original_condition": "(`t1`.`f1` > 10)",
1109 "attached_conditions_computation": [
1110 ],
1111 "attached_conditions_summary": [
1112 {
1113 "table": "`t1`",
1114 "attached": "(`t1`.`f1` > 10)"
1115 }
1116 ]
1117 }
1118 },
1119 {
1120 "optimizing_distinct_group_by_order_by": {
1121 "simplifying_order_by": {
1122 "original_clause": "`t1`.`f2`,`t1`.`f0`",
1123 "items": [
1124 {
1125 "item": "`t1`.`f2`"
1126 },
1127 {
1128 "item": "`t1`.`f0`"
1129 }
1130 ],
1131 "resulting_clause_is_simple": true,
1132 "resulting_clause": "`t1`.`f2`,`t1`.`f0`"
1133 }
1134 }
1135 },
1136 {
1137 "finalizing_table_conditions": [
1138 {
1139 "table": "`t1`",
1140 "original_table_condition": "(`t1`.`f1` > 10)",
1141 "final_table_condition ": "(`t1`.`f1` > 10)"
1142 }
1143 ]
1144 },
1145 {
1146 "refine_plan": [
1147 {
1148 "table": "`t1`"
1149 }
1150 ]
1151 },
1152 {
1153 "considering_tmp_tables": [
1154 {
1155 "adding_sort_to_table": "t1"
1156 }
1157 ]
1158 }
1159 ]
1160 }
1161 },
1162 {
1163 "join_execution": {
1164 "select#": 1,
1165 "steps": [
1166 {
1167 "sorting_table": "t1",
1168 "filesort_information": [
1169 {
1170 "direction": "asc",
1171 "expression": "`t1`.`f2`"
1172 },
1173 {
1174 "direction": "asc",
1175 "expression": "`t1`.`f0`"
1176 }
1177 ],
1178 "filesort_priority_queue_optimization": {
1179 "limit": 20,
1180 "chosen": true
1181 },
1182 "filesort_execution": [
1183 ],
1184 "filesort_summary": {
1185 "memory_available": 262144,
1186 "key_size": 209,
1187 "row_size": 419,
1188 "max_rows_per_buffer": 21,
1189 "num_rows_estimate": 100,
1190 "num_rows_found": 89,
1191 "num_initial_chunks_spilled_to_disk": 0,
1192 "peak_memory_used": "NNN",
1193 "sort_algorithm": "std::sort",
1194 "unpacked_addon_fields": "using_priority_queue",
1195 "sort_mode": "<fixed_sort_key, additional_fields>"
1196 }
1197 }
1198 ]
1199 }
1200 }
1201 ]
1202 } 0 0
1203 SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 0 OFFSET 10;
1204 f0 f1 f2
1205 SELECT * FROM information_schema.OPTIMIZER_TRACE;
1206 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
1207 SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 0 OFFSET 10 {
1208 "steps": [
1209 {
1210 "join_preparation": {
1211 "select#": 1,
1212 "steps": [
1213 {
1214 "expanded_query": "/* select#1 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` where (`t1`.`f1` > 10) order by `t1`.`f2`,`t1`.`f0` limit 10,0"
1215 }
1216 ]
1217 }
1218 },
1219 {
1220 "join_optimization": {
1221 "select#": 1,
1222 "steps": [
1223 {
1224 "condition_processing": {
1225 "condition": "WHERE",
1226 "original_condition": "(`t1`.`f1` > 10)",
1227 "steps": [
1228 {
1229 "transformation": "equality_propagation",
1230 "resulting_condition": "(`t1`.`f1` > 10)"
1231 },
1232 {
1233 "transformation": "constant_propagation",
1234 "resulting_condition": "(`t1`.`f1` > 10)"
1235 },
1236 {
1237 "transformation": "trivial_condition_removal",
1238 "resulting_condition": "(`t1`.`f1` > 10)"
1239 }
1240 ]
1241 }
1242 },
1243 {
1244 "substitute_generated_columns": {
1245 }
1246 },
1247 {
1248 "table_dependencies": [
1249 {
1250 "table": "`t1`",
1251 "row_may_be_null": false,
1252 "map_bit": 0,
1253 "depends_on_map_bits": [
1254 ]
1255 }
1256 ]
1257 },
1258 {
1259 "ref_optimizer_key_uses": [
1260 ]
1261 },
1262 {
1263 "rows_estimation": [
1264 {
1265 "table": "`t1`",
1266 "table_scan": {
1267 "rows": 100,
1268 "cost": 0.62207
1269 }
1270 }
1271 ]
1272 },
1273 {
1274 "considered_execution_plans": [
1275 {
1276 "plan_prefix": [
1277 ],
1278 "table": "`t1`",
1279 "best_access_path": {
1280 "considered_access_paths": [
1281 {
1282 "rows_to_scan": 100,
1283 "filtering_effect": [
1284 ],
1285 "final_filtering_effect": 0.3333,
1286 "access_type": "scan",
1287 "resulting_rows": 33.33,
1288 "cost": 10.6221,
1289 "chosen": true
1290 }
1291 ]
1292 },
1293 "condition_filtering_pct": 100,
1294 "rows_for_plan": 33.33,
1295 "cost_for_plan": 10.6221,
1296 "chosen": true
1297 }
1298 ]
1299 },
1300 {
1301 "attaching_conditions_to_tables": {
1302 "original_condition": "(`t1`.`f1` > 10)",
1303 "attached_conditions_computation": [
1304 ],
1305 "attached_conditions_summary": [
1306 {
1307 "table": "`t1`",
1308 "attached": "(`t1`.`f1` > 10)"
1309 }
1310 ]
1311 }
1312 },
1313 {
1314 "optimizing_distinct_group_by_order_by": {
1315 "simplifying_order_by": {
1316 "original_clause": "`t1`.`f2`,`t1`.`f0`",
1317 "items": [
1318 {
1319 "item": "`t1`.`f2`"
1320 },
1321 {
1322 "item": "`t1`.`f0`"
1323 }
1324 ],
1325 "resulting_clause_is_simple": true,
1326 "resulting_clause": "`t1`.`f2`,`t1`.`f0`"
1327 }
1328 }
1329 },
1330 {
1331 "finalizing_table_conditions": [
1332 {
1333 "table": "`t1`",
1334 "original_table_condition": "(`t1`.`f1` > 10)",
1335 "final_table_condition ": "(`t1`.`f1` > 10)"
1336 }
1337 ]
1338 },
1339 {
1340 "refine_plan": [
1341 {
1342 "table": "`t1`"
1343 }
1344 ]
1345 },
1346 {
1347 "considering_tmp_tables": [
1348 {
1349 "adding_sort_to_table": "t1"
1350 }
1351 ]
1352 }
1353 ]
1354 }
1355 },
1356 {
1357 "join_execution": {
1358 "select#": 1,
1359 "steps": [
1360 {
1361 "sorting_table": "t1",
1362 "filesort_information": [
1363 {
1364 "direction": "asc",
1365 "expression": "`t1`.`f2`"
1366 },
1367 {
1368 "direction": "asc",
1369 "expression": "`t1`.`f0`"
1370 }
1371 ],
1372 "filesort_priority_queue_optimization": {
1373 "limit": 10,
1374 "chosen": true
1375 },
1376 "filesort_execution": [
1377 ],
1378 "filesort_summary": {
1379 "memory_available": 262144,
1380 "key_size": 209,
1381 "row_size": 419,
1382 "max_rows_per_buffer": 11,
1383 "num_rows_estimate": 100,
1384 "num_rows_found": 89,
1385 "num_initial_chunks_spilled_to_disk": 0,
1386 "peak_memory_used": "NNN",
1387 "sort_algorithm": "std::sort",
1388 "unpacked_addon_fields": "using_priority_queue",
1389 "sort_mode": "<fixed_sort_key, additional_fields>"
1390 }
1391 }
1392 ]
1393 }
1394 }
1395 ]
1396 } 0 0
1397 SELECT CONCAT("hello ", f2) AS foo FROM t1 ORDER BY foo LIMIT 2;
1398 foo
1399 hello 0
1400 hello 1
1401 SELECT * FROM information_schema.OPTIMIZER_TRACE;
1402 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
1403 SELECT CONCAT("hello ", f2) AS foo FROM t1 ORDER BY foo LIMIT 2 {
1404 "steps": [
1405 {
1406 "join_preparation": {
1407 "select#": 1,
1408 "steps": [
1409 {
1410 "expanded_query": "/* select#1 */ select concat('hello ',`t1`.`f2`) AS `foo` from `t1` order by `foo` limit 2"
1411 }
1412 ]
1413 }
1414 },
1415 {
1416 "join_optimization": {
1417 "select#": 1,
1418 "steps": [
1419 {
1420 "substitute_generated_columns": {
1421 }
1422 },
1423 {
1424 "table_dependencies": [
1425 {
1426 "table": "`t1`",
1427 "row_may_be_null": false,
1428 "map_bit": 0,
1429 "depends_on_map_bits": [
1430 ]
1431 }
1432 ]
1433 },
1434 {
1435 "rows_estimation": [
1436 {
1437 "table": "`t1`",
1438 "table_scan": {
1439 "rows": 100,
1440 "cost": 0.62207
1441 }
1442 }
1443 ]
1444 },
1445 {
1446 "considered_execution_plans": [
1447 {
1448 "plan_prefix": [
1449 ],
1450 "table": "`t1`",
1451 "best_access_path": {
1452 "considered_access_paths": [
1453 {
1454 "rows_to_scan": 100,
1455 "access_type": "scan",
1456 "resulting_rows": 100,
1457 "cost": 10.6221,
1458 "chosen": true
1459 }
1460 ]
1461 },
1462 "condition_filtering_pct": 100,
1463 "rows_for_plan": 100,
1464 "cost_for_plan": 10.6221,
1465 "chosen": true
1466 }
1467 ]
1468 },
1469 {
1470 "attaching_conditions_to_tables": {
1471 "original_condition": null,
1472 "attached_conditions_computation": [
1473 ],
1474 "attached_conditions_summary": [
1475 {
1476 "table": "`t1`",
1477 "attached": null
1478 }
1479 ]
1480 }
1481 },
1482 {
1483 "optimizing_distinct_group_by_order_by": {
1484 "simplifying_order_by": {
1485 "original_clause": "`foo`",
1486 "items": [
1487 {
1488 "item": "concat('hello ',`t1`.`f2`)"
1489 }
1490 ],
1491 "resulting_clause_is_simple": true,
1492 "resulting_clause": "`foo`"
1493 }
1494 }
1495 },
1496 {
1497 "finalizing_table_conditions": [
1498 ]
1499 },
1500 {
1501 "refine_plan": [
1502 {
1503 "table": "`t1`"
1504 }
1505 ]
1506 },
1507 {
1508 "considering_tmp_tables": [
1509 {
1510 "adding_sort_to_table": "t1"
1511 }
1512 ]
1513 }
1514 ]
1515 }
1516 },
1517 {
1518 "join_execution": {
1519 "select#": 1,
1520 "steps": [
1521 {
1522 "sorting_table": "t1",
1523 "filesort_information": [
1524 {
1525 "direction": "asc",
1526 "expression": "concat('hello ',`t1`.`f2`)"
1527 }
1528 ],
1529 "filesort_priority_queue_optimization": {
1530 "limit": 2,
1531 "chosen": true
1532 },
1533 "filesort_execution": [
1534 ],
1535 "filesort_summary": {
1536 "memory_available": 262144,
1537 "key_size": 207,
1538 "row_size": 409,
1539 "max_rows_per_buffer": 3,
1540 "num_rows_estimate": 100,
1541 "num_rows_found": 100,
1542 "num_initial_chunks_spilled_to_disk": 0,
1543 "peak_memory_used": "NNN",
1544 "sort_algorithm": "std::sort",
1545 "unpacked_addon_fields": "using_priority_queue",
1546 "sort_mode": "<fixed_sort_key, additional_fields>"
1547 }
1548 }
1549 ]
1550 }
1551 }
1552 ]
1553 } 0 0
1554 SELECT * from t1 ORDER BY rand(2) LIMIT 2;
1555 SELECT * FROM information_schema.OPTIMIZER_TRACE;
1556 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
1557 SELECT * from t1 ORDER BY rand(2) LIMIT 2 {
1558 "steps": [
1559 {
1560 "join_preparation": {
1561 "select#": 1,
1562 "steps": [
1563 {
1564 "expanded_query": "/* select#1 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` order by rand(2) limit 2"
1565 }
1566 ]
1567 }
1568 },
1569 {
1570 "join_optimization": {
1571 "select#": 1,
1572 "steps": [
1573 {
1574 "substitute_generated_columns": {
1575 }
1576 },
1577 {
1578 "table_dependencies": [
1579 {
1580 "table": "`t1`",
1581 "row_may_be_null": false,
1582 "map_bit": 0,
1583 "depends_on_map_bits": [
1584 ]
1585 }
1586 ]
1587 },
1588 {
1589 "rows_estimation": [
1590 {
1591 "table": "`t1`",
1592 "table_scan": {
1593 "rows": 100,
1594 "cost": 0.62207
1595 }
1596 }
1597 ]
1598 },
1599 {
1600 "considered_execution_plans": [
1601 {
1602 "plan_prefix": [
1603 ],
1604 "table": "`t1`",
1605 "best_access_path": {
1606 "considered_access_paths": [
1607 {
1608 "rows_to_scan": 100,
1609 "access_type": "scan",
1610 "resulting_rows": 100,
1611 "cost": 10.6221,
1612 "chosen": true
1613 }
1614 ]
1615 },
1616 "condition_filtering_pct": 100,
1617 "rows_for_plan": 100,
1618 "cost_for_plan": 10.6221,
1619 "chosen": true
1620 }
1621 ]
1622 },
1623 {
1624 "attaching_conditions_to_tables": {
1625 "original_condition": null,
1626 "attached_conditions_computation": [
1627 ],
1628 "attached_conditions_summary": [
1629 {
1630 "table": "`t1`",
1631 "attached": null
1632 }
1633 ]
1634 }
1635 },
1636 {
1637 "optimizing_distinct_group_by_order_by": {
1638 "simplifying_order_by": {
1639 "original_clause": "rand(2)",
1640 "items": [
1641 {
1642 "item": "rand(2)"
1643 }
1644 ],
1645 "resulting_clause_is_simple": false,
1646 "resulting_clause": "rand(2)"
1647 }
1648 }
1649 },
1650 {
1651 "finalizing_table_conditions": [
1652 ]
1653 },
1654 {
1655 "refine_plan": [
1656 {
1657 "table": "`t1`"
1658 }
1659 ]
1660 },
1661 {
1662 "considering_tmp_tables": [
1663 {
1664 "adding_tmp_table_in_plan_at_position": 1,
1665 "write_method": "write_all_rows"
1666 },
1667 {
1668 "adding_sort_to_table": ""
1669 }
1670 ]
1671 }
1672 ]
1673 }
1674 },
1675 {
1676 "join_execution": {
1677 "select#": 1,
1678 "steps": [
1679 {
1680 "sorting_table": "<temporary>",
1681 "filesort_information": [
1682 {
1683 "direction": "asc",
1684 "expression": "`rand(2)`"
1685 }
1686 ],
1687 "filesort_priority_queue_optimization": {
1688 "limit": 2,
1689 "chosen": true
1690 },
1691 "filesort_execution": [
1692 ],
1693 "filesort_summary": {
1694 "memory_available": 262144,
1695 "key_size": 8,
1696 "row_size": 226,
1697 "max_rows_per_buffer": 3,
1698 "num_rows_estimate": 100,
1699 "num_rows_found": 100,
1700 "num_initial_chunks_spilled_to_disk": 0,
1701 "peak_memory_used": "NNN",
1702 "sort_algorithm": "std::sort",
1703 "unpacked_addon_fields": "using_priority_queue",
1704 "sort_mode": "<fixed_sort_key, additional_fields>"
1705 }
1706 }
1707 ]
1708 }
1709 }
1710 ]
1711 } 0 0
1712 set sort_buffer_size= 32768;
1713 SELECT * FROM t1 ORDER BY f1 ASC, f0 LIMIT 30;
1714 f0 f1 f2
1715 1 0 0
1716 2 1 1
1717 3 2 2
1718 4 3 3
1719 5 4 4
1720 6 5 5
1721 7 6 6
1722 8 7 7
1723 9 8 8
1724 10 9 9
1725 11 10 10
1726 12 11 11
1727 13 12 12
1728 14 13 13
1729 15 14 14
1730 16 15 15
1731 17 16 16
1732 18 17 17
1733 19 18 18
1734 20 19 19
1735 21 20 20
1736 22 21 21
1737 23 22 22
1738 24 23 23
1739 25 24 24
1740 26 25 25
1741 27 26 26
1742 28 27 27
1743 29 28 28
1744 30 29 29
1745 SELECT * FROM information_schema.OPTIMIZER_TRACE;
1746 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
1747 SELECT * FROM t1 ORDER BY f1 ASC, f0 LIMIT 30 {
1748 "steps": [
1749 {
1750 "join_preparation": {
1751 "select#": 1,
1752 "steps": [
1753 {
1754 "expanded_query": "/* select#1 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` order by `t1`.`f1`,`t1`.`f0` limit 30"
1755 }
1756 ]
1757 }
1758 },
1759 {
1760 "join_optimization": {
1761 "select#": 1,
1762 "steps": [
1763 {
1764 "substitute_generated_columns": {
1765 }
1766 },
1767 {
1768 "table_dependencies": [
1769 {
1770 "table": "`t1`",
1771 "row_may_be_null": false,
1772 "map_bit": 0,
1773 "depends_on_map_bits": [
1774 ]
1775 }
1776 ]
1777 },
1778 {
1779 "rows_estimation": [
1780 {
1781 "table": "`t1`",
1782 "table_scan": {
1783 "rows": 100,
1784 "cost": 0.62207
1785 }
1786 }
1787 ]
1788 },
1789 {
1790 "considered_execution_plans": [
1791 {
1792 "plan_prefix": [
1793 ],
1794 "table": "`t1`",
1795 "best_access_path": {
1796 "considered_access_paths": [
1797 {
1798 "rows_to_scan": 100,
1799 "access_type": "scan",
1800 "resulting_rows": 100,
1801 "cost": 10.6221,
1802 "chosen": true
1803 }
1804 ]
1805 },
1806 "condition_filtering_pct": 100,
1807 "rows_for_plan": 100,
1808 "cost_for_plan": 10.6221,
1809 "chosen": true
1810 }
1811 ]
1812 },
1813 {
1814 "attaching_conditions_to_tables": {
1815 "original_condition": null,
1816 "attached_conditions_computation": [
1817 ],
1818 "attached_conditions_summary": [
1819 {
1820 "table": "`t1`",
1821 "attached": null
1822 }
1823 ]
1824 }
1825 },
1826 {
1827 "optimizing_distinct_group_by_order_by": {
1828 "simplifying_order_by": {
1829 "original_clause": "`t1`.`f1`,`t1`.`f0`",
1830 "items": [
1831 {
1832 "item": "`t1`.`f1`"
1833 },
1834 {
1835 "item": "`t1`.`f0`"
1836 }
1837 ],
1838 "resulting_clause_is_simple": true,
1839 "resulting_clause": "`t1`.`f1`,`t1`.`f0`"
1840 }
1841 }
1842 },
1843 {
1844 "finalizing_table_conditions": [
1845 ]
1846 },
1847 {
1848 "refine_plan": [
1849 {
1850 "table": "`t1`"
1851 }
1852 ]
1853 },
1854 {
1855 "considering_tmp_tables": [
1856 {
1857 "adding_sort_to_table": "t1"
1858 }
1859 ]
1860 }
1861 ]
1862 }
1863 },
1864 {
1865 "join_execution": {
1866 "select#": 1,
1867 "steps": [
1868 {
1869 "sorting_table": "t1",
1870 "filesort_information": [
1871 {
1872 "direction": "asc",
1873 "expression": "`t1`.`f1`"
1874 },
1875 {
1876 "direction": "asc",
1877 "expression": "`t1`.`f0`"
1878 }
1879 ],
1880 "filesort_priority_queue_optimization": {
1881 "limit": 30,
1882 "chosen": true
1883 },
1884 "filesort_execution": [
1885 ],
1886 "filesort_summary": {
1887 "memory_available": 32768,
1888 "key_size": 17,
1889 "row_size": 227,
1890 "max_rows_per_buffer": 31,
1891 "num_rows_estimate": 100,
1892 "num_rows_found": 100,
1893 "num_initial_chunks_spilled_to_disk": 0,
1894 "peak_memory_used": "NNN",
1895 "sort_algorithm": "std::sort",
1896 "unpacked_addon_fields": "using_priority_queue",
1897 "sort_mode": "<fixed_sort_key, additional_fields>"
1898 }
1899 }
1900 ]
1901 }
1902 }
1903 ]
1904 } 0 0
1905 SELECT * FROM t1 ORDER BY f1 ASC, f0 LIMIT 0;
1906 f0 f1 f2
1907 SELECT * FROM information_schema.OPTIMIZER_TRACE;
1908 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
1909 SELECT * FROM t1 ORDER BY f1 ASC, f0 LIMIT 0 {
1910 "steps": [
1911 {
1912 "join_preparation": {
1913 "select#": 1,
1914 "steps": [
1915 {
1916 "expanded_query": "/* select#1 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` order by `t1`.`f1`,`t1`.`f0` limit 0"
1917 }
1918 ]
1919 }
1920 },
1921 {
1922 "join_optimization": {
1923 "select#": 1,
1924 "steps": [
1925 ],
1926 "empty_result": {
1927 "cause": "Zero limit"
1928 }
1929 }
1930 },
1931 {
1932 "join_execution": {
1933 "select#": 1,
1934 "steps": [
1935 ]
1936 }
1937 }
1938 ]
1939 } 0 0
1940 SELECT * FROM t1 ORDER BY f2 DESC, f0 LIMIT 30;
1941 f0 f1 f2
1942 100 99 99
1943 99 98 98
1944 98 97 97
1945 97 96 96
1946 96 95 95
1947 95 94 94
1948 94 93 93
1949 93 92 92
1950 92 91 91
1951 91 90 90
1952 10 9 9
1953 90 89 89
1954 89 88 88
1955 88 87 87
1956 87 86 86
1957 86 85 85
1958 85 84 84
1959 84 83 83
1960 83 82 82
1961 82 81 81
1962 81 80 80
1963 9 8 8
1964 80 79 79
1965 79 78 78
1966 78 77 77
1967 77 76 76
1968 76 75 75
1969 75 74 74
1970 74 73 73
1971 73 72 72
1972 SELECT * FROM information_schema.OPTIMIZER_TRACE;
1973 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
1974 SELECT * FROM t1 ORDER BY f2 DESC, f0 LIMIT 30 {
1975 "steps": [
1976 {
1977 "join_preparation": {
1978 "select#": 1,
1979 "steps": [
1980 {
1981 "expanded_query": "/* select#1 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` order by `t1`.`f2` desc,`t1`.`f0` limit 30"
1982 }
1983 ]
1984 }
1985 },
1986 {
1987 "join_optimization": {
1988 "select#": 1,
1989 "steps": [
1990 {
1991 "substitute_generated_columns": {
1992 }
1993 },
1994 {
1995 "table_dependencies": [
1996 {
1997 "table": "`t1`",
1998 "row_may_be_null": false,
1999 "map_bit": 0,
2000 "depends_on_map_bits": [
2001 ]
2002 }
2003 ]
2004 },
2005 {
2006 "rows_estimation": [
2007 {
2008 "table": "`t1`",
2009 "table_scan": {
2010 "rows": 100,
2011 "cost": 0.62207
2012 }
2013 }
2014 ]
2015 },
2016 {
2017 "considered_execution_plans": [
2018 {
2019 "plan_prefix": [
2020 ],
2021 "table": "`t1`",
2022 "best_access_path": {
2023 "considered_access_paths": [
2024 {
2025 "rows_to_scan": 100,
2026 "access_type": "scan",
2027 "resulting_rows": 100,
2028 "cost": 10.6221,
2029 "chosen": true
2030 }
2031 ]
2032 },
2033 "condition_filtering_pct": 100,
2034 "rows_for_plan": 100,
2035 "cost_for_plan": 10.6221,
2036 "chosen": true
2037 }
2038 ]
2039 },
2040 {
2041 "attaching_conditions_to_tables": {
2042 "original_condition": null,
2043 "attached_conditions_computation": [
2044 ],
2045 "attached_conditions_summary": [
2046 {
2047 "table": "`t1`",
2048 "attached": null
2049 }
2050 ]
2051 }
2052 },
2053 {
2054 "optimizing_distinct_group_by_order_by": {
2055 "simplifying_order_by": {
2056 "original_clause": "`t1`.`f2` desc,`t1`.`f0`",
2057 "items": [
2058 {
2059 "item": "`t1`.`f2`"
2060 },
2061 {
2062 "item": "`t1`.`f0`"
2063 }
2064 ],
2065 "resulting_clause_is_simple": true,
2066 "resulting_clause": "`t1`.`f2` desc,`t1`.`f0`"
2067 }
2068 }
2069 },
2070 {
2071 "finalizing_table_conditions": [
2072 ]
2073 },
2074 {
2075 "refine_plan": [
2076 {
2077 "table": "`t1`"
2078 }
2079 ]
2080 },
2081 {
2082 "considering_tmp_tables": [
2083 {
2084 "adding_sort_to_table": "t1"
2085 }
2086 ]
2087 }
2088 ]
2089 }
2090 },
2091 {
2092 "join_execution": {
2093 "select#": 1,
2094 "steps": [
2095 {
2096 "sorting_table": "t1",
2097 "filesort_information": [
2098 {
2099 "direction": "desc",
2100 "expression": "`t1`.`f2`"
2101 },
2102 {
2103 "direction": "asc",
2104 "expression": "`t1`.`f0`"
2105 }
2106 ],
2107 "filesort_priority_queue_optimization": {
2108 "limit": 30,
2109 "chosen": true
2110 },
2111 "filesort_execution": [
2112 ],
2113 "filesort_summary": {
2114 "memory_available": 32768,
2115 "key_size": 209,
2116 "row_size": 419,
2117 "max_rows_per_buffer": 31,
2118 "num_rows_estimate": 100,
2119 "num_rows_found": 100,
2120 "num_initial_chunks_spilled_to_disk": 0,
2121 "peak_memory_used": "NNN",
2122 "sort_algorithm": "std::sort",
2123 "unpacked_addon_fields": "using_priority_queue",
2124 "sort_mode": "<fixed_sort_key, additional_fields>"
2125 }
2126 }
2127 ]
2128 }
2129 }
2130 ]
2131 } 0 0
2132 SELECT * FROM t1 ORDER BY f2 DESC, f0 LIMIT 0;
2133 f0 f1 f2
2134 SELECT * FROM information_schema.OPTIMIZER_TRACE;
2135 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
2136 SELECT * FROM t1 ORDER BY f2 DESC, f0 LIMIT 0 {
2137 "steps": [
2138 {
2139 "join_preparation": {
2140 "select#": 1,
2141 "steps": [
2142 {
2143 "expanded_query": "/* select#1 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` order by `t1`.`f2` desc,`t1`.`f0` limit 0"
2144 }
2145 ]
2146 }
2147 },
2148 {
2149 "join_optimization": {
2150 "select#": 1,
2151 "steps": [
2152 ],
2153 "empty_result": {
2154 "cause": "Zero limit"
2155 }
2156 }
2157 },
2158 {
2159 "join_execution": {
2160 "select#": 1,
2161 "steps": [
2162 ]
2163 }
2164 }
2165 ]
2166 } 0 0
2167 SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 20;
2168 f0 f1 f2
2169 12 11 11
2170 13 12 12
2171 14 13 13
2172 15 14 14
2173 16 15 15
2174 17 16 16
2175 18 17 17
2176 19 18 18
2177 20 19 19
2178 21 20 20
2179 22 21 21
2180 23 22 22
2181 24 23 23
2182 25 24 24
2183 26 25 25
2184 27 26 26
2185 28 27 27
2186 29 28 28
2187 30 29 29
2188 31 30 30
2189 SELECT * FROM information_schema.OPTIMIZER_TRACE;
2190 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
2191 SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 20 {
2192 "steps": [
2193 {
2194 "join_preparation": {
2195 "select#": 1,
2196 "steps": [
2197 {
2198 "expanded_query": "/* select#1 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` where (`t1`.`f1` > 10) order by `t1`.`f2`,`t1`.`f0` limit 20"
2199 }
2200 ]
2201 }
2202 },
2203 {
2204 "join_optimization": {
2205 "select#": 1,
2206 "steps": [
2207 {
2208 "condition_processing": {
2209 "condition": "WHERE",
2210 "original_condition": "(`t1`.`f1` > 10)",
2211 "steps": [
2212 {
2213 "transformation": "equality_propagation",
2214 "resulting_condition": "(`t1`.`f1` > 10)"
2215 },
2216 {
2217 "transformation": "constant_propagation",
2218 "resulting_condition": "(`t1`.`f1` > 10)"
2219 },
2220 {
2221 "transformation": "trivial_condition_removal",
2222 "resulting_condition": "(`t1`.`f1` > 10)"
2223 }
2224 ]
2225 }
2226 },
2227 {
2228 "substitute_generated_columns": {
2229 }
2230 },
2231 {
2232 "table_dependencies": [
2233 {
2234 "table": "`t1`",
2235 "row_may_be_null": false,
2236 "map_bit": 0,
2237 "depends_on_map_bits": [
2238 ]
2239 }
2240 ]
2241 },
2242 {
2243 "ref_optimizer_key_uses": [
2244 ]
2245 },
2246 {
2247 "rows_estimation": [
2248 {
2249 "table": "`t1`",
2250 "table_scan": {
2251 "rows": 100,
2252 "cost": 0.62207
2253 }
2254 }
2255 ]
2256 },
2257 {
2258 "considered_execution_plans": [
2259 {
2260 "plan_prefix": [
2261 ],
2262 "table": "`t1`",
2263 "best_access_path": {
2264 "considered_access_paths": [
2265 {
2266 "rows_to_scan": 100,
2267 "filtering_effect": [
2268 ],
2269 "final_filtering_effect": 0.3333,
2270 "access_type": "scan",
2271 "resulting_rows": 33.33,
2272 "cost": 10.6221,
2273 "chosen": true
2274 }
2275 ]
2276 },
2277 "condition_filtering_pct": 100,
2278 "rows_for_plan": 33.33,
2279 "cost_for_plan": 10.6221,
2280 "chosen": true
2281 }
2282 ]
2283 },
2284 {
2285 "attaching_conditions_to_tables": {
2286 "original_condition": "(`t1`.`f1` > 10)",
2287 "attached_conditions_computation": [
2288 ],
2289 "attached_conditions_summary": [
2290 {
2291 "table": "`t1`",
2292 "attached": "(`t1`.`f1` > 10)"
2293 }
2294 ]
2295 }
2296 },
2297 {
2298 "optimizing_distinct_group_by_order_by": {
2299 "simplifying_order_by": {
2300 "original_clause": "`t1`.`f2`,`t1`.`f0`",
2301 "items": [
2302 {
2303 "item": "`t1`.`f2`"
2304 },
2305 {
2306 "item": "`t1`.`f0`"
2307 }
2308 ],
2309 "resulting_clause_is_simple": true,
2310 "resulting_clause": "`t1`.`f2`,`t1`.`f0`"
2311 }
2312 }
2313 },
2314 {
2315 "finalizing_table_conditions": [
2316 {
2317 "table": "`t1`",
2318 "original_table_condition": "(`t1`.`f1` > 10)",
2319 "final_table_condition ": "(`t1`.`f1` > 10)"
2320 }
2321 ]
2322 },
2323 {
2324 "refine_plan": [
2325 {
2326 "table": "`t1`"
2327 }
2328 ]
2329 },
2330 {
2331 "considering_tmp_tables": [
2332 {
2333 "adding_sort_to_table": "t1"
2334 }
2335 ]
2336 }
2337 ]
2338 }
2339 },
2340 {
2341 "join_execution": {
2342 "select#": 1,
2343 "steps": [
2344 {
2345 "sorting_table": "t1",
2346 "filesort_information": [
2347 {
2348 "direction": "asc",
2349 "expression": "`t1`.`f2`"
2350 },
2351 {
2352 "direction": "asc",
2353 "expression": "`t1`.`f0`"
2354 }
2355 ],
2356 "filesort_priority_queue_optimization": {
2357 "limit": 20,
2358 "chosen": true
2359 },
2360 "filesort_execution": [
2361 ],
2362 "filesort_summary": {
2363 "memory_available": 32768,
2364 "key_size": 209,
2365 "row_size": 419,
2366 "max_rows_per_buffer": 21,
2367 "num_rows_estimate": 100,
2368 "num_rows_found": 89,
2369 "num_initial_chunks_spilled_to_disk": 0,
2370 "peak_memory_used": "NNN",
2371 "sort_algorithm": "std::sort",
2372 "unpacked_addon_fields": "using_priority_queue",
2373 "sort_mode": "<fixed_sort_key, additional_fields>"
2374 }
2375 }
2376 ]
2377 }
2378 }
2379 ]
2380 } 0 0
2381 SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 0;
2382 f0 f1 f2
2383 SELECT * FROM information_schema.OPTIMIZER_TRACE;
2384 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
2385 SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 0 {
2386 "steps": [
2387 {
2388 "join_preparation": {
2389 "select#": 1,
2390 "steps": [
2391 {
2392 "expanded_query": "/* select#1 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` where (`t1`.`f1` > 10) order by `t1`.`f2`,`t1`.`f0` limit 0"
2393 }
2394 ]
2395 }
2396 },
2397 {
2398 "join_optimization": {
2399 "select#": 1,
2400 "steps": [
2401 ],
2402 "empty_result": {
2403 "cause": "Zero limit"
2404 }
2405 }
2406 },
2407 {
2408 "join_execution": {
2409 "select#": 1,
2410 "steps": [
2411 ]
2412 }
2413 }
2414 ]
2415 } 0 0
2416 SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 10 OFFSET 10;
2417 f0 f1 f2
2418 22 21 21
2419 23 22 22
2420 24 23 23
2421 25 24 24
2422 26 25 25
2423 27 26 26
2424 28 27 27
2425 29 28 28
2426 30 29 29
2427 31 30 30
2428 SELECT * FROM information_schema.OPTIMIZER_TRACE;
2429 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
2430 SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 10 OFFSET 10 {
2431 "steps": [
2432 {
2433 "join_preparation": {
2434 "select#": 1,
2435 "steps": [
2436 {
2437 "expanded_query": "/* select#1 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` where (`t1`.`f1` > 10) order by `t1`.`f2`,`t1`.`f0` limit 10,10"
2438 }
2439 ]
2440 }
2441 },
2442 {
2443 "join_optimization": {
2444 "select#": 1,
2445 "steps": [
2446 {
2447 "condition_processing": {
2448 "condition": "WHERE",
2449 "original_condition": "(`t1`.`f1` > 10)",
2450 "steps": [
2451 {
2452 "transformation": "equality_propagation",
2453 "resulting_condition": "(`t1`.`f1` > 10)"
2454 },
2455 {
2456 "transformation": "constant_propagation",
2457 "resulting_condition": "(`t1`.`f1` > 10)"
2458 },
2459 {
2460 "transformation": "trivial_condition_removal",
2461 "resulting_condition": "(`t1`.`f1` > 10)"
2462 }
2463 ]
2464 }
2465 },
2466 {
2467 "substitute_generated_columns": {
2468 }
2469 },
2470 {
2471 "table_dependencies": [
2472 {
2473 "table": "`t1`",
2474 "row_may_be_null": false,
2475 "map_bit": 0,
2476 "depends_on_map_bits": [
2477 ]
2478 }
2479 ]
2480 },
2481 {
2482 "ref_optimizer_key_uses": [
2483 ]
2484 },
2485 {
2486 "rows_estimation": [
2487 {
2488 "table": "`t1`",
2489 "table_scan": {
2490 "rows": 100,
2491 "cost": 0.62207
2492 }
2493 }
2494 ]
2495 },
2496 {
2497 "considered_execution_plans": [
2498 {
2499 "plan_prefix": [
2500 ],
2501 "table": "`t1`",
2502 "best_access_path": {
2503 "considered_access_paths": [
2504 {
2505 "rows_to_scan": 100,
2506 "filtering_effect": [
2507 ],
2508 "final_filtering_effect": 0.3333,
2509 "access_type": "scan",
2510 "resulting_rows": 33.33,
2511 "cost": 10.6221,
2512 "chosen": true
2513 }
2514 ]
2515 },
2516 "condition_filtering_pct": 100,
2517 "rows_for_plan": 33.33,
2518 "cost_for_plan": 10.6221,
2519 "chosen": true
2520 }
2521 ]
2522 },
2523 {
2524 "attaching_conditions_to_tables": {
2525 "original_condition": "(`t1`.`f1` > 10)",
2526 "attached_conditions_computation": [
2527 ],
2528 "attached_conditions_summary": [
2529 {
2530 "table": "`t1`",
2531 "attached": "(`t1`.`f1` > 10)"
2532 }
2533 ]
2534 }
2535 },
2536 {
2537 "optimizing_distinct_group_by_order_by": {
2538 "simplifying_order_by": {
2539 "original_clause": "`t1`.`f2`,`t1`.`f0`",
2540 "items": [
2541 {
2542 "item": "`t1`.`f2`"
2543 },
2544 {
2545 "item": "`t1`.`f0`"
2546 }
2547 ],
2548 "resulting_clause_is_simple": true,
2549 "resulting_clause": "`t1`.`f2`,`t1`.`f0`"
2550 }
2551 }
2552 },
2553 {
2554 "finalizing_table_conditions": [
2555 {
2556 "table": "`t1`",
2557 "original_table_condition": "(`t1`.`f1` > 10)",
2558 "final_table_condition ": "(`t1`.`f1` > 10)"
2559 }
2560 ]
2561 },
2562 {
2563 "refine_plan": [
2564 {
2565 "table": "`t1`"
2566 }
2567 ]
2568 },
2569 {
2570 "considering_tmp_tables": [
2571 {
2572 "adding_sort_to_table": "t1"
2573 }
2574 ]
2575 }
2576 ]
2577 }
2578 },
2579 {
2580 "join_execution": {
2581 "select#": 1,
2582 "steps": [
2583 {
2584 "sorting_table": "t1",
2585 "filesort_information": [
2586 {
2587 "direction": "asc",
2588 "expression": "`t1`.`f2`"
2589 },
2590 {
2591 "direction": "asc",
2592 "expression": "`t1`.`f0`"
2593 }
2594 ],
2595 "filesort_priority_queue_optimization": {
2596 "limit": 20,
2597 "chosen": true
2598 },
2599 "filesort_execution": [
2600 ],
2601 "filesort_summary": {
2602 "memory_available": 32768,
2603 "key_size": 209,
2604 "row_size": 419,
2605 "max_rows_per_buffer": 21,
2606 "num_rows_estimate": 100,
2607 "num_rows_found": 89,
2608 "num_initial_chunks_spilled_to_disk": 0,
2609 "peak_memory_used": "NNN",
2610 "sort_algorithm": "std::sort",
2611 "unpacked_addon_fields": "using_priority_queue",
2612 "sort_mode": "<fixed_sort_key, additional_fields>"
2613 }
2614 }
2615 ]
2616 }
2617 }
2618 ]
2619 } 0 0
2620 SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 0 OFFSET 10;
2621 f0 f1 f2
2622 SELECT * FROM information_schema.OPTIMIZER_TRACE;
2623 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
2624 SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 0 OFFSET 10 {
2625 "steps": [
2626 {
2627 "join_preparation": {
2628 "select#": 1,
2629 "steps": [
2630 {
2631 "expanded_query": "/* select#1 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` where (`t1`.`f1` > 10) order by `t1`.`f2`,`t1`.`f0` limit 10,0"
2632 }
2633 ]
2634 }
2635 },
2636 {
2637 "join_optimization": {
2638 "select#": 1,
2639 "steps": [
2640 {
2641 "condition_processing": {
2642 "condition": "WHERE",
2643 "original_condition": "(`t1`.`f1` > 10)",
2644 "steps": [
2645 {
2646 "transformation": "equality_propagation",
2647 "resulting_condition": "(`t1`.`f1` > 10)"
2648 },
2649 {
2650 "transformation": "constant_propagation",
2651 "resulting_condition": "(`t1`.`f1` > 10)"
2652 },
2653 {
2654 "transformation": "trivial_condition_removal",
2655 "resulting_condition": "(`t1`.`f1` > 10)"
2656 }
2657 ]
2658 }
2659 },
2660 {
2661 "substitute_generated_columns": {
2662 }
2663 },
2664 {
2665 "table_dependencies": [
2666 {
2667 "table": "`t1`",
2668 "row_may_be_null": false,
2669 "map_bit": 0,
2670 "depends_on_map_bits": [
2671 ]
2672 }
2673 ]
2674 },
2675 {
2676 "ref_optimizer_key_uses": [
2677 ]
2678 },
2679 {
2680 "rows_estimation": [
2681 {
2682 "table": "`t1`",
2683 "table_scan": {
2684 "rows": 100,
2685 "cost": 0.62207
2686 }
2687 }
2688 ]
2689 },
2690 {
2691 "considered_execution_plans": [
2692 {
2693 "plan_prefix": [
2694 ],
2695 "table": "`t1`",
2696 "best_access_path": {
2697 "considered_access_paths": [
2698 {
2699 "rows_to_scan": 100,
2700 "filtering_effect": [
2701 ],
2702 "final_filtering_effect": 0.3333,
2703 "access_type": "scan",
2704 "resulting_rows": 33.33,
2705 "cost": 10.6221,
2706 "chosen": true
2707 }
2708 ]
2709 },
2710 "condition_filtering_pct": 100,
2711 "rows_for_plan": 33.33,
2712 "cost_for_plan": 10.6221,
2713 "chosen": true
2714 }
2715 ]
2716 },
2717 {
2718 "attaching_conditions_to_tables": {
2719 "original_condition": "(`t1`.`f1` > 10)",
2720 "attached_conditions_computation": [
2721 ],
2722 "attached_conditions_summary": [
2723 {
2724 "table": "`t1`",
2725 "attached": "(`t1`.`f1` > 10)"
2726 }
2727 ]
2728 }
2729 },
2730 {
2731 "optimizing_distinct_group_by_order_by": {
2732 "simplifying_order_by": {
2733 "original_clause": "`t1`.`f2`,`t1`.`f0`",
2734 "items": [
2735 {
2736 "item": "`t1`.`f2`"
2737 },
2738 {
2739 "item": "`t1`.`f0`"
2740 }
2741 ],
2742 "resulting_clause_is_simple": true,
2743 "resulting_clause": "`t1`.`f2`,`t1`.`f0`"
2744 }
2745 }
2746 },
2747 {
2748 "finalizing_table_conditions": [
2749 {
2750 "table": "`t1`",
2751 "original_table_condition": "(`t1`.`f1` > 10)",
2752 "final_table_condition ": "(`t1`.`f1` > 10)"
2753 }
2754 ]
2755 },
2756 {
2757 "refine_plan": [
2758 {
2759 "table": "`t1`"
2760 }
2761 ]
2762 },
2763 {
2764 "considering_tmp_tables": [
2765 {
2766 "adding_sort_to_table": "t1"
2767 }
2768 ]
2769 }
2770 ]
2771 }
2772 },
2773 {
2774 "join_execution": {
2775 "select#": 1,
2776 "steps": [
2777 {
2778 "sorting_table": "t1",
2779 "filesort_information": [
2780 {
2781 "direction": "asc",
2782 "expression": "`t1`.`f2`"
2783 },
2784 {
2785 "direction": "asc",
2786 "expression": "`t1`.`f0`"
2787 }
2788 ],
2789 "filesort_priority_queue_optimization": {
2790 "limit": 10,
2791 "chosen": true
2792 },
2793 "filesort_execution": [
2794 ],
2795 "filesort_summary": {
2796 "memory_available": 32768,
2797 "key_size": 209,
2798 "row_size": 419,
2799 "max_rows_per_buffer": 11,
2800 "num_rows_estimate": 100,
2801 "num_rows_found": 89,
2802 "num_initial_chunks_spilled_to_disk": 0,
2803 "peak_memory_used": "NNN",
2804 "sort_algorithm": "std::sort",
2805 "unpacked_addon_fields": "using_priority_queue",
2806 "sort_mode": "<fixed_sort_key, additional_fields>"
2807 }
2808 }
2809 ]
2810 }
2811 }
2812 ]
2813 } 0 0
2814 set sort_buffer_size= 32768;
2815 set optimizer_trace_limit=1;
2816 set optimizer_trace_offset=-2;
2817 SELECT SQL_CALC_FOUND_ROWS * FROM t1
2818 ORDER BY f1, f0 LIMIT 30;
2819 f0 f1 f2
2820 1 0 0
2821 2 1 1
2822 3 2 2
2823 4 3 3
2824 5 4 4
2825 6 5 5
2826 7 6 6
2827 8 7 7
2828 9 8 8
2829 10 9 9
2830 11 10 10
2831 12 11 11
2832 13 12 12
2833 14 13 13
2834 15 14 14
2835 16 15 15
2836 17 16 16
2837 18 17 17
2838 19 18 18
2839 20 19 19
2840 21 20 20
2841 22 21 21
2842 23 22 22
2843 24 23 23
2844 25 24 24
2845 26 25 25
2846 27 26 26
2847 28 27 27
2848 29 28 28
2849 30 29 29
2850 Warnings:
2851 Warning 1287 SQL_CALC_FOUND_ROWS is deprecated and will be removed in a future release. Consider using two separate queries instead.
2852 SELECT FOUND_ROWS();
2853 FOUND_ROWS()
2854 100
2855 Warnings:
2856 Warning 1287 FOUND_ROWS() is deprecated and will be removed in a future release. Consider using COUNT(*) instead.
2857 SELECT * FROM information_schema.OPTIMIZER_TRACE;
2858 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
2859 SELECT SQL_CALC_FOUND_ROWS * FROM t1
2860 ORDER BY f1, f0 LIMIT 30 {
2861 "steps": [
2862 {
2863 "join_preparation": {
2864 "select#": 1,
2865 "steps": [
2866 {
2867 "expanded_query": "/* select#1 */ select sql_calc_found_rows `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` order by `t1`.`f1`,`t1`.`f0` limit 30"
2868 }
2869 ]
2870 }
2871 },
2872 {
2873 "join_optimization": {
2874 "select#": 1,
2875 "steps": [
2876 {
2877 "substitute_generated_columns": {
2878 }
2879 },
2880 {
2881 "table_dependencies": [
2882 {
2883 "table": "`t1`",
2884 "row_may_be_null": false,
2885 "map_bit": 0,
2886 "depends_on_map_bits": [
2887 ]
2888 }
2889 ]
2890 },
2891 {
2892 "rows_estimation": [
2893 {
2894 "table": "`t1`",
2895 "table_scan": {
2896 "rows": 100,
2897 "cost": 0.62207
2898 }
2899 }
2900 ]
2901 },
2902 {
2903 "considered_execution_plans": [
2904 {
2905 "plan_prefix": [
2906 ],
2907 "table": "`t1`",
2908 "best_access_path": {
2909 "considered_access_paths": [
2910 {
2911 "rows_to_scan": 100,
2912 "access_type": "scan",
2913 "resulting_rows": 100,
2914 "cost": 10.6221,
2915 "chosen": true
2916 }
2917 ]
2918 },
2919 "condition_filtering_pct": 100,
2920 "rows_for_plan": 100,
2921 "cost_for_plan": 10.6221,
2922 "chosen": true
2923 }
2924 ]
2925 },
2926 {
2927 "attaching_conditions_to_tables": {
2928 "original_condition": null,
2929 "attached_conditions_computation": [
2930 ],
2931 "attached_conditions_summary": [
2932 {
2933 "table": "`t1`",
2934 "attached": null
2935 }
2936 ]
2937 }
2938 },
2939 {
2940 "optimizing_distinct_group_by_order_by": {
2941 "simplifying_order_by": {
2942 "original_clause": "`t1`.`f1`,`t1`.`f0`",
2943 "items": [
2944 {
2945 "item": "`t1`.`f1`"
2946 },
2947 {
2948 "item": "`t1`.`f0`"
2949 }
2950 ],
2951 "resulting_clause_is_simple": true,
2952 "resulting_clause": "`t1`.`f1`,`t1`.`f0`"
2953 }
2954 }
2955 },
2956 {
2957 "finalizing_table_conditions": [
2958 ]
2959 },
2960 {
2961 "refine_plan": [
2962 {
2963 "table": "`t1`"
2964 }
2965 ]
2966 },
2967 {
2968 "considering_tmp_tables": [
2969 {
2970 "adding_sort_to_table": "t1"
2971 }
2972 ]
2973 }
2974 ]
2975 }
2976 },
2977 {
2978 "join_execution": {
2979 "select#": 1,
2980 "steps": [
2981 {
2982 "sorting_table": "t1",
2983 "filesort_information": [
2984 {
2985 "direction": "asc",
2986 "expression": "`t1`.`f1`"
2987 },
2988 {
2989 "direction": "asc",
2990 "expression": "`t1`.`f0`"
2991 }
2992 ],
2993 "filesort_priority_queue_optimization": {
2994 "usable": false,
2995 "cause": "not applicable (no LIMIT)"
2996 },
2997 "filesort_execution": [
2998 ],
2999 "filesort_summary": {
3000 "memory_available": 32768,
3001 "key_size": 17,
3002 "row_size": 231,
3003 "max_rows_per_buffer": 100,
3004 "num_rows_estimate": 100,
3005 "num_rows_found": 100,
3006 "num_initial_chunks_spilled_to_disk": 0,
3007 "peak_memory_used": "NNN",
3008 "sort_algorithm": "std::sort",
3009 "sort_mode": "<fixed_sort_key, packed_additional_fields>"
3010 }
3011 }
3012 ]
3013 }
3014 }
3015 ]
3016 } 0 0
3017 SELECT SQL_CALC_FOUND_ROWS * FROM t1
3018 ORDER BY f1, f0 LIMIT 0;
3019 f0 f1 f2
3020 Warnings:
3021 Warning 1287 SQL_CALC_FOUND_ROWS is deprecated and will be removed in a future release. Consider using two separate queries instead.
3022 SELECT FOUND_ROWS();
3023 FOUND_ROWS()
3024 100
3025 Warnings:
3026 Warning 1287 FOUND_ROWS() is deprecated and will be removed in a future release. Consider using COUNT(*) instead.
3027 SELECT * FROM information_schema.OPTIMIZER_TRACE;
3028 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
3029 SELECT SQL_CALC_FOUND_ROWS * FROM t1
3030 ORDER BY f1, f0 LIMIT 0 {
3031 "steps": [
3032 {
3033 "join_preparation": {
3034 "select#": 1,
3035 "steps": [
3036 {
3037 "expanded_query": "/* select#1 */ select sql_calc_found_rows `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` order by `t1`.`f1`,`t1`.`f0` limit 0"
3038 }
3039 ]
3040 }
3041 },
3042 {
3043 "join_optimization": {
3044 "select#": 1,
3045 "steps": [
3046 {
3047 "substitute_generated_columns": {
3048 }
3049 },
3050 {
3051 "table_dependencies": [
3052 {
3053 "table": "`t1`",
3054 "row_may_be_null": false,
3055 "map_bit": 0,
3056 "depends_on_map_bits": [
3057 ]
3058 }
3059 ]
3060 },
3061 {
3062 "rows_estimation": [
3063 {
3064 "table": "`t1`",
3065 "table_scan": {
3066 "rows": 100,
3067 "cost": 0.62207
3068 }
3069 }
3070 ]
3071 },
3072 {
3073 "considered_execution_plans": [
3074 {
3075 "plan_prefix": [
3076 ],
3077 "table": "`t1`",
3078 "best_access_path": {
3079 "considered_access_paths": [
3080 {
3081 "rows_to_scan": 100,
3082 "access_type": "scan",
3083 "resulting_rows": 100,
3084 "cost": 10.6221,
3085 "chosen": true
3086 }
3087 ]
3088 },
3089 "condition_filtering_pct": 100,
3090 "rows_for_plan": 100,
3091 "cost_for_plan": 10.6221,
3092 "chosen": true
3093 }
3094 ]
3095 },
3096 {
3097 "attaching_conditions_to_tables": {
3098 "original_condition": null,
3099 "attached_conditions_computation": [
3100 ],
3101 "attached_conditions_summary": [
3102 {
3103 "table": "`t1`",
3104 "attached": null
3105 }
3106 ]
3107 }
3108 },
3109 {
3110 "optimizing_distinct_group_by_order_by": {
3111 "simplifying_order_by": {
3112 "original_clause": "`t1`.`f1`,`t1`.`f0`",
3113 "items": [
3114 {
3115 "item": "`t1`.`f1`"
3116 },
3117 {
3118 "item": "`t1`.`f0`"
3119 }
3120 ],
3121 "resulting_clause_is_simple": true,
3122 "resulting_clause": "`t1`.`f1`,`t1`.`f0`"
3123 }
3124 }
3125 },
3126 {
3127 "finalizing_table_conditions": [
3128 ]
3129 },
3130 {
3131 "refine_plan": [
3132 {
3133 "table": "`t1`"
3134 }
3135 ]
3136 },
3137 {
3138 "considering_tmp_tables": [
3139 {
3140 "adding_sort_to_table": "t1"
3141 }
3142 ]
3143 }
3144 ]
3145 }
3146 },
3147 {
3148 "join_execution": {
3149 "select#": 1,
3150 "steps": [
3151 {
3152 "sorting_table": "t1",
3153 "filesort_information": [
3154 {
3155 "direction": "asc",
3156 "expression": "`t1`.`f1`"
3157 },
3158 {
3159 "direction": "asc",
3160 "expression": "`t1`.`f0`"
3161 }
3162 ],
3163 "filesort_priority_queue_optimization": {
3164 "usable": false,
3165 "cause": "not applicable (no LIMIT)"
3166 },
3167 "filesort_execution": [
3168 ],
3169 "filesort_summary": {
3170 "memory_available": 32768,
3171 "key_size": 17,
3172 "row_size": 231,
3173 "max_rows_per_buffer": 100,
3174 "num_rows_estimate": 100,
3175 "num_rows_found": 100,
3176 "num_initial_chunks_spilled_to_disk": 0,
3177 "peak_memory_used": "NNN",
3178 "sort_algorithm": "std::sort",
3179 "sort_mode": "<fixed_sort_key, packed_additional_fields>"
3180 }
3181 }
3182 ]
3183 }
3184 }
3185 ]
3186 } 0 0
3187 SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE f1>10
3188 ORDER BY f2, f0 LIMIT 20;
3189 f0 f1 f2
3190 12 11 11
3191 13 12 12
3192 14 13 13
3193 15 14 14
3194 16 15 15
3195 17 16 16
3196 18 17 17
3197 19 18 18
3198 20 19 19
3199 21 20 20
3200 22 21 21
3201 23 22 22
3202 24 23 23
3203 25 24 24
3204 26 25 25
3205 27 26 26
3206 28 27 27
3207 29 28 28
3208 30 29 29
3209 31 30 30
3210 Warnings:
3211 Warning 1287 SQL_CALC_FOUND_ROWS is deprecated and will be removed in a future release. Consider using two separate queries instead.
3212 SELECT FOUND_ROWS();
3213 FOUND_ROWS()
3214 89
3215 Warnings:
3216 Warning 1287 FOUND_ROWS() is deprecated and will be removed in a future release. Consider using COUNT(*) instead.
3217 SELECT * FROM information_schema.OPTIMIZER_TRACE;
3218 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
3219 SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE f1>10
3220 ORDER BY f2, f0 LIMIT 20 {
3221 "steps": [
3222 {
3223 "join_preparation": {
3224 "select#": 1,
3225 "steps": [
3226 {
3227 "expanded_query": "/* select#1 */ select sql_calc_found_rows `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` where (`t1`.`f1` > 10) order by `t1`.`f2`,`t1`.`f0` limit 20"
3228 }
3229 ]
3230 }
3231 },
3232 {
3233 "join_optimization": {
3234 "select#": 1,
3235 "steps": [
3236 {
3237 "condition_processing": {
3238 "condition": "WHERE",
3239 "original_condition": "(`t1`.`f1` > 10)",
3240 "steps": [
3241 {
3242 "transformation": "equality_propagation",
3243 "resulting_condition": "(`t1`.`f1` > 10)"
3244 },
3245 {
3246 "transformation": "constant_propagation",
3247 "resulting_condition": "(`t1`.`f1` > 10)"
3248 },
3249 {
3250 "transformation": "trivial_condition_removal",
3251 "resulting_condition": "(`t1`.`f1` > 10)"
3252 }
3253 ]
3254 }
3255 },
3256 {
3257 "substitute_generated_columns": {
3258 }
3259 },
3260 {
3261 "table_dependencies": [
3262 {
3263 "table": "`t1`",
3264 "row_may_be_null": false,
3265 "map_bit": 0,
3266 "depends_on_map_bits": [
3267 ]
3268 }
3269 ]
3270 },
3271 {
3272 "ref_optimizer_key_uses": [
3273 ]
3274 },
3275 {
3276 "rows_estimation": [
3277 {
3278 "table": "`t1`",
3279 "table_scan": {
3280 "rows": 100,
3281 "cost": 0.62207
3282 }
3283 }
3284 ]
3285 },
3286 {
3287 "considered_execution_plans": [
3288 {
3289 "plan_prefix": [
3290 ],
3291 "table": "`t1`",
3292 "best_access_path": {
3293 "considered_access_paths": [
3294 {
3295 "rows_to_scan": 100,
3296 "filtering_effect": [
3297 ],
3298 "final_filtering_effect": 0.3333,
3299 "access_type": "scan",
3300 "resulting_rows": 33.33,
3301 "cost": 10.6221,
3302 "chosen": true
3303 }
3304 ]
3305 },
3306 "condition_filtering_pct": 100,
3307 "rows_for_plan": 33.33,
3308 "cost_for_plan": 10.6221,
3309 "chosen": true
3310 }
3311 ]
3312 },
3313 {
3314 "attaching_conditions_to_tables": {
3315 "original_condition": "(`t1`.`f1` > 10)",
3316 "attached_conditions_computation": [
3317 ],
3318 "attached_conditions_summary": [
3319 {
3320 "table": "`t1`",
3321 "attached": "(`t1`.`f1` > 10)"
3322 }
3323 ]
3324 }
3325 },
3326 {
3327 "optimizing_distinct_group_by_order_by": {
3328 "simplifying_order_by": {
3329 "original_clause": "`t1`.`f2`,`t1`.`f0`",
3330 "items": [
3331 {
3332 "item": "`t1`.`f2`"
3333 },
3334 {
3335 "item": "`t1`.`f0`"
3336 }
3337 ],
3338 "resulting_clause_is_simple": true,
3339 "resulting_clause": "`t1`.`f2`,`t1`.`f0`"
3340 }
3341 }
3342 },
3343 {
3344 "finalizing_table_conditions": [
3345 {
3346 "table": "`t1`",
3347 "original_table_condition": "(`t1`.`f1` > 10)",
3348 "final_table_condition ": "(`t1`.`f1` > 10)"
3349 }
3350 ]
3351 },
3352 {
3353 "refine_plan": [
3354 {
3355 "table": "`t1`"
3356 }
3357 ]
3358 },
3359 {
3360 "considering_tmp_tables": [
3361 {
3362 "adding_sort_to_table": "t1"
3363 }
3364 ]
3365 }
3366 ]
3367 }
3368 },
3369 {
3370 "join_execution": {
3371 "select#": 1,
3372 "steps": [
3373 {
3374 "sorting_table": "t1",
3375 "filesort_information": [
3376 {
3377 "direction": "asc",
3378 "expression": "`t1`.`f2`"
3379 },
3380 {
3381 "direction": "asc",
3382 "expression": "`t1`.`f0`"
3383 }
3384 ],
3385 "filesort_priority_queue_optimization": {
3386 "usable": false,
3387 "cause": "not applicable (no LIMIT)"
3388 },
3389 "filesort_execution": [
3390 ],
3391 "filesort_summary": {
3392 "memory_available": 32768,
3393 "key_size": 209,
3394 "row_size": 423,
3395 "max_rows_per_buffer": 76,
3396 "num_rows_estimate": 100,
3397 "num_rows_found": 89,
3398 "num_initial_chunks_spilled_to_disk": 0,
3399 "peak_memory_used": "NNN",
3400 "sort_algorithm": "std::sort",
3401 "sort_mode": "<fixed_sort_key, packed_additional_fields>"
3402 }
3403 }
3404 ]
3405 }
3406 }
3407 ]
3408 } 0 0
3409 SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE f1>10
3410 ORDER BY f2, f0 LIMIT 0;
3411 f0 f1 f2
3412 Warnings:
3413 Warning 1287 SQL_CALC_FOUND_ROWS is deprecated and will be removed in a future release. Consider using two separate queries instead.
3414 SELECT FOUND_ROWS();
3415 FOUND_ROWS()
3416 89
3417 Warnings:
3418 Warning 1287 FOUND_ROWS() is deprecated and will be removed in a future release. Consider using COUNT(*) instead.
3419 SELECT * FROM information_schema.OPTIMIZER_TRACE;
3420 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
3421 SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE f1>10
3422 ORDER BY f2, f0 LIMIT 0 {
3423 "steps": [
3424 {
3425 "join_preparation": {
3426 "select#": 1,
3427 "steps": [
3428 {
3429 "expanded_query": "/* select#1 */ select sql_calc_found_rows `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` where (`t1`.`f1` > 10) order by `t1`.`f2`,`t1`.`f0` limit 0"
3430 }
3431 ]
3432 }
3433 },
3434 {
3435 "join_optimization": {
3436 "select#": 1,
3437 "steps": [
3438 {
3439 "condition_processing": {
3440 "condition": "WHERE",
3441 "original_condition": "(`t1`.`f1` > 10)",
3442 "steps": [
3443 {
3444 "transformation": "equality_propagation",
3445 "resulting_condition": "(`t1`.`f1` > 10)"
3446 },
3447 {
3448 "transformation": "constant_propagation",
3449 "resulting_condition": "(`t1`.`f1` > 10)"
3450 },
3451 {
3452 "transformation": "trivial_condition_removal",
3453 "resulting_condition": "(`t1`.`f1` > 10)"
3454 }
3455 ]
3456 }
3457 },
3458 {
3459 "substitute_generated_columns": {
3460 }
3461 },
3462 {
3463 "table_dependencies": [
3464 {
3465 "table": "`t1`",
3466 "row_may_be_null": false,
3467 "map_bit": 0,
3468 "depends_on_map_bits": [
3469 ]
3470 }
3471 ]
3472 },
3473 {
3474 "ref_optimizer_key_uses": [
3475 ]
3476 },
3477 {
3478 "rows_estimation": [
3479 {
3480 "table": "`t1`",
3481 "table_scan": {
3482 "rows": 100,
3483 "cost": 0.62207
3484 }
3485 }
3486 ]
3487 },
3488 {
3489 "considered_execution_plans": [
3490 {
3491 "plan_prefix": [
3492 ],
3493 "table": "`t1`",
3494 "best_access_path": {
3495 "considered_access_paths": [
3496 {
3497 "rows_to_scan": 100,
3498 "filtering_effect": [
3499 ],
3500 "final_filtering_effect": 0.3333,
3501 "access_type": "scan",
3502 "resulting_rows": 33.33,
3503 "cost": 10.6221,
3504 "chosen": true
3505 }
3506 ]
3507 },
3508 "condition_filtering_pct": 100,
3509 "rows_for_plan": 33.33,
3510 "cost_for_plan": 10.6221,
3511 "chosen": true
3512 }
3513 ]
3514 },
3515 {
3516 "attaching_conditions_to_tables": {
3517 "original_condition": "(`t1`.`f1` > 10)",
3518 "attached_conditions_computation": [
3519 ],
3520 "attached_conditions_summary": [
3521 {
3522 "table": "`t1`",
3523 "attached": "(`t1`.`f1` > 10)"
3524 }
3525 ]
3526 }
3527 },
3528 {
3529 "optimizing_distinct_group_by_order_by": {
3530 "simplifying_order_by": {
3531 "original_clause": "`t1`.`f2`,`t1`.`f0`",
3532 "items": [
3533 {
3534 "item": "`t1`.`f2`"
3535 },
3536 {
3537 "item": "`t1`.`f0`"
3538 }
3539 ],
3540 "resulting_clause_is_simple": true,
3541 "resulting_clause": "`t1`.`f2`,`t1`.`f0`"
3542 }
3543 }
3544 },
3545 {
3546 "finalizing_table_conditions": [
3547 {
3548 "table": "`t1`",
3549 "original_table_condition": "(`t1`.`f1` > 10)",
3550 "final_table_condition ": "(`t1`.`f1` > 10)"
3551 }
3552 ]
3553 },
3554 {
3555 "refine_plan": [
3556 {
3557 "table": "`t1`"
3558 }
3559 ]
3560 },
3561 {
3562 "considering_tmp_tables": [
3563 {
3564 "adding_sort_to_table": "t1"
3565 }
3566 ]
3567 }
3568 ]
3569 }
3570 },
3571 {
3572 "join_execution": {
3573 "select#": 1,
3574 "steps": [
3575 {
3576 "sorting_table": "t1",
3577 "filesort_information": [
3578 {
3579 "direction": "asc",
3580 "expression": "`t1`.`f2`"
3581 },
3582 {
3583 "direction": "asc",
3584 "expression": "`t1`.`f0`"
3585 }
3586 ],
3587 "filesort_priority_queue_optimization": {
3588 "usable": false,
3589 "cause": "not applicable (no LIMIT)"
3590 },
3591 "filesort_execution": [
3592 ],
3593 "filesort_summary": {
3594 "memory_available": 32768,
3595 "key_size": 209,
3596 "row_size": 423,
3597 "max_rows_per_buffer": 76,
3598 "num_rows_estimate": 100,
3599 "num_rows_found": 89,
3600 "num_initial_chunks_spilled_to_disk": 0,
3601 "peak_memory_used": "NNN",
3602 "sort_algorithm": "std::sort",
3603 "sort_mode": "<fixed_sort_key, packed_additional_fields>"
3604 }
3605 }
3606 ]
3607 }
3608 }
3609 ]
3610 } 0 0
3611 SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE f1>10
3612 ORDER BY f2, f0 LIMIT 10 OFFSET 10;
3613 f0 f1 f2
3614 22 21 21
3615 23 22 22
3616 24 23 23
3617 25 24 24
3618 26 25 25
3619 27 26 26
3620 28 27 27
3621 29 28 28
3622 30 29 29
3623 31 30 30
3624 Warnings:
3625 Warning 1287 SQL_CALC_FOUND_ROWS is deprecated and will be removed in a future release. Consider using two separate queries instead.
3626 SELECT FOUND_ROWS();
3627 FOUND_ROWS()
3628 89
3629 Warnings:
3630 Warning 1287 FOUND_ROWS() is deprecated and will be removed in a future release. Consider using COUNT(*) instead.
3631 SELECT * FROM information_schema.OPTIMIZER_TRACE;
3632 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
3633 SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE f1>10
3634 ORDER BY f2, f0 LIMIT 10 OFFSET 10 {
3635 "steps": [
3636 {
3637 "join_preparation": {
3638 "select#": 1,
3639 "steps": [
3640 {
3641 "expanded_query": "/* select#1 */ select sql_calc_found_rows `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` where (`t1`.`f1` > 10) order by `t1`.`f2`,`t1`.`f0` limit 10,10"
3642 }
3643 ]
3644 }
3645 },
3646 {
3647 "join_optimization": {
3648 "select#": 1,
3649 "steps": [
3650 {
3651 "condition_processing": {
3652 "condition": "WHERE",
3653 "original_condition": "(`t1`.`f1` > 10)",
3654 "steps": [
3655 {
3656 "transformation": "equality_propagation",
3657 "resulting_condition": "(`t1`.`f1` > 10)"
3658 },
3659 {
3660 "transformation": "constant_propagation",
3661 "resulting_condition": "(`t1`.`f1` > 10)"
3662 },
3663 {
3664 "transformation": "trivial_condition_removal",
3665 "resulting_condition": "(`t1`.`f1` > 10)"
3666 }
3667 ]
3668 }
3669 },
3670 {
3671 "substitute_generated_columns": {
3672 }
3673 },
3674 {
3675 "table_dependencies": [
3676 {
3677 "table": "`t1`",
3678 "row_may_be_null": false,
3679 "map_bit": 0,
3680 "depends_on_map_bits": [
3681 ]
3682 }
3683 ]
3684 },
3685 {
3686 "ref_optimizer_key_uses": [
3687 ]
3688 },
3689 {
3690 "rows_estimation": [
3691 {
3692 "table": "`t1`",
3693 "table_scan": {
3694 "rows": 100,
3695 "cost": 0.62207
3696 }
3697 }
3698 ]
3699 },
3700 {
3701 "considered_execution_plans": [
3702 {
3703 "plan_prefix": [
3704 ],
3705 "table": "`t1`",
3706 "best_access_path": {
3707 "considered_access_paths": [
3708 {
3709 "rows_to_scan": 100,
3710 "filtering_effect": [
3711 ],
3712 "final_filtering_effect": 0.3333,
3713 "access_type": "scan",
3714 "resulting_rows": 33.33,
3715 "cost": 10.6221,
3716 "chosen": true
3717 }
3718 ]
3719 },
3720 "condition_filtering_pct": 100,
3721 "rows_for_plan": 33.33,
3722 "cost_for_plan": 10.6221,
3723 "chosen": true
3724 }
3725 ]
3726 },
3727 {
3728 "attaching_conditions_to_tables": {
3729 "original_condition": "(`t1`.`f1` > 10)",
3730 "attached_conditions_computation": [
3731 ],
3732 "attached_conditions_summary": [
3733 {
3734 "table": "`t1`",
3735 "attached": "(`t1`.`f1` > 10)"
3736 }
3737 ]
3738 }
3739 },
3740 {
3741 "optimizing_distinct_group_by_order_by": {
3742 "simplifying_order_by": {
3743 "original_clause": "`t1`.`f2`,`t1`.`f0`",
3744 "items": [
3745 {
3746 "item": "`t1`.`f2`"
3747 },
3748 {
3749 "item": "`t1`.`f0`"
3750 }
3751 ],
3752 "resulting_clause_is_simple": true,
3753 "resulting_clause": "`t1`.`f2`,`t1`.`f0`"
3754 }
3755 }
3756 },
3757 {
3758 "finalizing_table_conditions": [
3759 {
3760 "table": "`t1`",
3761 "original_table_condition": "(`t1`.`f1` > 10)",
3762 "final_table_condition ": "(`t1`.`f1` > 10)"
3763 }
3764 ]
3765 },
3766 {
3767 "refine_plan": [
3768 {
3769 "table": "`t1`"
3770 }
3771 ]
3772 },
3773 {
3774 "considering_tmp_tables": [
3775 {
3776 "adding_sort_to_table": "t1"
3777 }
3778 ]
3779 }
3780 ]
3781 }
3782 },
3783 {
3784 "join_execution": {
3785 "select#": 1,
3786 "steps": [
3787 {
3788 "sorting_table": "t1",
3789 "filesort_information": [
3790 {
3791 "direction": "asc",
3792 "expression": "`t1`.`f2`"
3793 },
3794 {
3795 "direction": "asc",
3796 "expression": "`t1`.`f0`"
3797 }
3798 ],
3799 "filesort_priority_queue_optimization": {
3800 "usable": false,
3801 "cause": "not applicable (no LIMIT)"
3802 },
3803 "filesort_execution": [
3804 ],
3805 "filesort_summary": {
3806 "memory_available": 32768,
3807 "key_size": 209,
3808 "row_size": 423,
3809 "max_rows_per_buffer": 76,
3810 "num_rows_estimate": 100,
3811 "num_rows_found": 89,
3812 "num_initial_chunks_spilled_to_disk": 0,
3813 "peak_memory_used": "NNN",
3814 "sort_algorithm": "std::sort",
3815 "sort_mode": "<fixed_sort_key, packed_additional_fields>"
3816 }
3817 }
3818 ]
3819 }
3820 }
3821 ]
3822 } 0 0
3823 SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE f1>10
3824 ORDER BY f2, f0 LIMIT 0 OFFSET 10;
3825 f0 f1 f2
3826 Warnings:
3827 Warning 1287 SQL_CALC_FOUND_ROWS is deprecated and will be removed in a future release. Consider using two separate queries instead.
3828 SELECT FOUND_ROWS();
3829 FOUND_ROWS()
3830 89
3831 Warnings:
3832 Warning 1287 FOUND_ROWS() is deprecated and will be removed in a future release. Consider using COUNT(*) instead.
3833 SELECT * FROM information_schema.OPTIMIZER_TRACE;
3834 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
3835 SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE f1>10
3836 ORDER BY f2, f0 LIMIT 0 OFFSET 10 {
3837 "steps": [
3838 {
3839 "join_preparation": {
3840 "select#": 1,
3841 "steps": [
3842 {
3843 "expanded_query": "/* select#1 */ select sql_calc_found_rows `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` where (`t1`.`f1` > 10) order by `t1`.`f2`,`t1`.`f0` limit 10,0"
3844 }
3845 ]
3846 }
3847 },
3848 {
3849 "join_optimization": {
3850 "select#": 1,
3851 "steps": [
3852 {
3853 "condition_processing": {
3854 "condition": "WHERE",
3855 "original_condition": "(`t1`.`f1` > 10)",
3856 "steps": [
3857 {
3858 "transformation": "equality_propagation",
3859 "resulting_condition": "(`t1`.`f1` > 10)"
3860 },
3861 {
3862 "transformation": "constant_propagation",
3863 "resulting_condition": "(`t1`.`f1` > 10)"
3864 },
3865 {
3866 "transformation": "trivial_condition_removal",
3867 "resulting_condition": "(`t1`.`f1` > 10)"
3868 }
3869 ]
3870 }
3871 },
3872 {
3873 "substitute_generated_columns": {
3874 }
3875 },
3876 {
3877 "table_dependencies": [
3878 {
3879 "table": "`t1`",
3880 "row_may_be_null": false,
3881 "map_bit": 0,
3882 "depends_on_map_bits": [
3883 ]
3884 }
3885 ]
3886 },
3887 {
3888 "ref_optimizer_key_uses": [
3889 ]
3890 },
3891 {
3892 "rows_estimation": [
3893 {
3894 "table": "`t1`",
3895 "table_scan": {
3896 "rows": 100,
3897 "cost": 0.62207
3898 }
3899 }
3900 ]
3901 },
3902 {
3903 "considered_execution_plans": [
3904 {
3905 "plan_prefix": [
3906 ],
3907 "table": "`t1`",
3908 "best_access_path": {
3909 "considered_access_paths": [
3910 {
3911 "rows_to_scan": 100,
3912 "filtering_effect": [
3913 ],
3914 "final_filtering_effect": 0.3333,
3915 "access_type": "scan",
3916 "resulting_rows": 33.33,
3917 "cost": 10.6221,
3918 "chosen": true
3919 }
3920 ]
3921 },
3922 "condition_filtering_pct": 100,
3923 "rows_for_plan": 33.33,
3924 "cost_for_plan": 10.6221,
3925 "chosen": true
3926 }
3927 ]
3928 },
3929 {
3930 "attaching_conditions_to_tables": {
3931 "original_condition": "(`t1`.`f1` > 10)",
3932 "attached_conditions_computation": [
3933 ],
3934 "attached_conditions_summary": [
3935 {
3936 "table": "`t1`",
3937 "attached": "(`t1`.`f1` > 10)"
3938 }
3939 ]
3940 }
3941 },
3942 {
3943 "optimizing_distinct_group_by_order_by": {
3944 "simplifying_order_by": {
3945 "original_clause": "`t1`.`f2`,`t1`.`f0`",
3946 "items": [
3947 {
3948 "item": "`t1`.`f2`"
3949 },
3950 {
3951 "item": "`t1`.`f0`"
3952 }
3953 ],
3954 "resulting_clause_is_simple": true,
3955 "resulting_clause": "`t1`.`f2`,`t1`.`f0`"
3956 }
3957 }
3958 },
3959 {
3960 "finalizing_table_conditions": [
3961 {
3962 "table": "`t1`",
3963 "original_table_condition": "(`t1`.`f1` > 10)",
3964 "final_table_condition ": "(`t1`.`f1` > 10)"
3965 }
3966 ]
3967 },
3968 {
3969 "refine_plan": [
3970 {
3971 "table": "`t1`"
3972 }
3973 ]
3974 },
3975 {
3976 "considering_tmp_tables": [
3977 {
3978 "adding_sort_to_table": "t1"
3979 }
3980 ]
3981 }
3982 ]
3983 }
3984 },
3985 {
3986 "join_execution": {
3987 "select#": 1,
3988 "steps": [
3989 {
3990 "sorting_table": "t1",
3991 "filesort_information": [
3992 {
3993 "direction": "asc",
3994 "expression": "`t1`.`f2`"
3995 },
3996 {
3997 "direction": "asc",
3998 "expression": "`t1`.`f0`"
3999 }
4000 ],
4001 "filesort_priority_queue_optimization": {
4002 "usable": false,
4003 "cause": "not applicable (no LIMIT)"
4004 },
4005 "filesort_execution": [
4006 ],
4007 "filesort_summary": {
4008 "memory_available": 32768,
4009 "key_size": 209,
4010 "row_size": 423,
4011 "max_rows_per_buffer": 76,
4012 "num_rows_estimate": 100,
4013 "num_rows_found": 89,
4014 "num_initial_chunks_spilled_to_disk": 0,
4015 "peak_memory_used": "NNN",
4016 "sort_algorithm": "std::sort",
4017 "sort_mode": "<fixed_sort_key, packed_additional_fields>"
4018 }
4019 }
4020 ]
4021 }
4022 }
4023 ]
4024 } 0 0
4025 set sort_buffer_size= 327680;
4026 set optimizer_trace_limit=1;
4027 set optimizer_trace_offset=-1;
4028 CREATE TEMPORARY TABLE tmp (f1 int, f2 varchar(20)) charset latin1;
4029 INSERT INTO tmp SELECT f1, f2 FROM t1;
4030 INSERT INTO t1(f1, f2) SELECT * FROM tmp;
4031 INSERT INTO tmp SELECT f1, f2 FROM t1;
4032 INSERT INTO t1(f1, f2) SELECT * FROM tmp;
4033 SELECT * FROM t1 JOIN tmp on t1.f2=tmp.f2
4034 ORDER BY tmp.f1, f0 LIMIT 30;
4035 f0 f1 f2 f1 f2
4036 1 0 0 0 0
4037 1 0 0 0 0
4038 1 0 0 0 0
4039 101 0 0 0 0
4040 101 0 0 0 0
4041 101 0 0 0 0
4042 201 0 0 0 0
4043 201 0 0 0 0
4044 201 0 0 0 0
4045 301 0 0 0 0
4046 301 0 0 0 0
4047 301 0 0 0 0
4048 401 0 0 0 0
4049 401 0 0 0 0
4050 401 0 0 0 0
4051 2 1 1 1 1
4052 2 1 1 1 1
4053 2 1 1 1 1
4054 102 1 1 1 1
4055 102 1 1 1 1
4056 102 1 1 1 1
4057 202 1 1 1 1
4058 202 1 1 1 1
4059 202 1 1 1 1
4060 302 1 1 1 1
4061 302 1 1 1 1
4062 302 1 1 1 1
4063 402 1 1 1 1
4064 402 1 1 1 1
4065 402 1 1 1 1
4066 SELECT * FROM information_schema.OPTIMIZER_TRACE;
4067 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
4068 SELECT * FROM t1 JOIN tmp on t1.f2=tmp.f2
4069 ORDER BY tmp.f1, f0 LIMIT 30 {
4070 "steps": [
4071 {
4072 "join_preparation": {
4073 "select#": 1,
4074 "steps": [
4075 {
4076 "expanded_query": "/* select#1 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2`,`tmp`.`f1` AS `f1`,`tmp`.`f2` AS `f2` from (`t1` join `tmp` on((`t1`.`f2` = `tmp`.`f2`))) order by `tmp`.`f1`,`t1`.`f0` limit 30"
4077 },
4078 {
4079 "transformations_to_nested_joins": {
4080 "transformations": [
4081 "JOIN_condition_to_WHERE",
4082 "parenthesis_removal"
4083 ],
4084 "expanded_query": "/* select#1 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2`,`tmp`.`f1` AS `f1`,`tmp`.`f2` AS `f2` from `t1` join `tmp` where (`t1`.`f2` = `tmp`.`f2`) order by `tmp`.`f1`,`t1`.`f0` limit 30"
4085 }
4086 }
4087 ]
4088 }
4089 },
4090 {
4091 "join_optimization": {
4092 "select#": 1,
4093 "steps": [
4094 {
4095 "condition_processing": {
4096 "condition": "WHERE",
4097 "original_condition": "(`t1`.`f2` = `tmp`.`f2`)",
4098 "steps": [
4099 {
4100 "transformation": "equality_propagation",
4101 "resulting_condition": "(`t1`.`f2` = `tmp`.`f2`)"
4102 },
4103 {
4104 "transformation": "constant_propagation",
4105 "resulting_condition": "(`t1`.`f2` = `tmp`.`f2`)"
4106 },
4107 {
4108 "transformation": "trivial_condition_removal",
4109 "resulting_condition": "(`t1`.`f2` = `tmp`.`f2`)"
4110 }
4111 ]
4112 }
4113 },
4114 {
4115 "substitute_generated_columns": {
4116 }
4117 },
4118 {
4119 "table_dependencies": [
4120 {
4121 "table": "`t1`",
4122 "row_may_be_null": false,
4123 "map_bit": 0,
4124 "depends_on_map_bits": [
4125 ]
4126 },
4127 {
4128 "table": "`tmp`",
4129 "row_may_be_null": false,
4130 "map_bit": 1,
4131 "depends_on_map_bits": [
4132 ]
4133 }
4134 ]
4135 },
4136 {
4137 "ref_optimizer_key_uses": [
4138 ]
4139 },
4140 {
4141 "rows_estimation": [
4142 {
4143 "table": "`t1`",
4144 "table_scan": {
4145 "rows": 500,
4146 "cost": 1.11035
4147 }
4148 },
4149 {
4150 "table": "`tmp`",
4151 "table_scan": {
4152 "rows": 300,
4153 "cost": 0.866211
4154 }
4155 }
4156 ]
4157 },
4158 {
4159 "considered_execution_plans": [
4160 {
4161 "plan_prefix": [
4162 ],
4163 "table": "`tmp`",
4164 "best_access_path": {
4165 "considered_access_paths": [
4166 {
4167 "rows_to_scan": 300,
4168 "filtering_effect": [
4169 ],
4170 "final_filtering_effect": 1,
4171 "access_type": "scan",
4172 "resulting_rows": 300,
4173 "cost": 30.8662,
4174 "chosen": true
4175 }
4176 ]
4177 },
4178 "condition_filtering_pct": 100,
4179 "rows_for_plan": 300,
4180 "cost_for_plan": 30.8662,
4181 "rest_of_plan": [
4182 {
4183 "plan_prefix": [
4184 "`tmp`"
4185 ],
4186 "table": "`t1`",
4187 "best_access_path": {
4188 "considered_access_paths": [
4189 {
4190 "rows_to_scan": 500,
4191 "filtering_effect": [
4192 ],
4193 "final_filtering_effect": 1,
4194 "access_type": "scan",
4195 "using_join_cache": true,
4196 "buffers_needed": 1,
4197 "resulting_rows": 500,
4198 "cost": 15001.1,
4199 "chosen": true
4200 }
4201 ]
4202 },
4203 "condition_filtering_pct": 10,
4204 "rows_for_plan": 15000,
4205 "cost_for_plan": 15032,
4206 "chosen": true
4207 }
4208 ]
4209 },
4210 {
4211 "plan_prefix": [
4212 ],
4213 "table": "`t1`",
4214 "best_access_path": {
4215 "considered_access_paths": [
4216 {
4217 "rows_to_scan": 500,
4218 "filtering_effect": [
4219 ],
4220 "final_filtering_effect": 1,
4221 "access_type": "scan",
4222 "resulting_rows": 500,
4223 "cost": 51.1104,
4224 "chosen": true
4225 }
4226 ]
4227 },
4228 "condition_filtering_pct": 100,
4229 "rows_for_plan": 500,
4230 "cost_for_plan": 51.1104,
4231 "pruned_by_heuristic": true
4232 }
4233 ]
4234 },
4235 {
4236 "attaching_conditions_to_tables": {
4237 "original_condition": "(`t1`.`f2` = `tmp`.`f2`)",
4238 "attached_conditions_computation": [
4239 ],
4240 "attached_conditions_summary": [
4241 {
4242 "table": "`tmp`",
4243 "attached": null
4244 },
4245 {
4246 "table": "`t1`",
4247 "attached": "(`t1`.`f2` = `tmp`.`f2`)"
4248 }
4249 ]
4250 }
4251 },
4252 {
4253 "optimizing_distinct_group_by_order_by": {
4254 "simplifying_order_by": {
4255 "original_clause": "`tmp`.`f1`,`t1`.`f0`",
4256 "items": [
4257 {
4258 "item": "`tmp`.`f1`"
4259 },
4260 {
4261 "item": "`t1`.`f0`"
4262 }
4263 ],
4264 "resulting_clause_is_simple": false,
4265 "resulting_clause": "`tmp`.`f1`,`t1`.`f0`"
4266 }
4267 }
4268 },
4269 {
4270 "finalizing_table_conditions": [
4271 {
4272 "table": "`t1`",
4273 "original_table_condition": "(`t1`.`f2` = `tmp`.`f2`)",
4274 "final_table_condition ": "(`t1`.`f2` = `tmp`.`f2`)"
4275 }
4276 ]
4277 },
4278 {
4279 "refine_plan": [
4280 {
4281 "table": "`tmp`"
4282 },
4283 {
4284 "table": "`t1`"
4285 }
4286 ]
4287 },
4288 {
4289 "considering_tmp_tables": [
4290 {
4291 "adding_tmp_table_in_plan_at_position": 2,
4292 "write_method": "write_all_rows"
4293 },
4294 {
4295 "adding_sort_to_table": ""
4296 }
4297 ]
4298 }
4299 ]
4300 }
4301 },
4302 {
4303 "join_execution": {
4304 "select#": 1,
4305 "steps": [
4306 {
4307 "sorting_table": "<temporary>",
4308 "filesort_information": [
4309 {
4310 "direction": "asc",
4311 "expression": "`tmp`.`f1`"
4312 },
4313 {
4314 "direction": "asc",
4315 "expression": "`t1`.`f0`"
4316 }
4317 ],
4318 "filesort_priority_queue_optimization": {
4319 "limit": 30,
4320 "chosen": true
4321 },
4322 "filesort_execution": [
4323 ],
4324 "filesort_summary": {
4325 "memory_available": 327680,
4326 "key_size": 17,
4327 "row_size": 252,
4328 "max_rows_per_buffer": 31,
4329 "num_rows_estimate": 15000,
4330 "num_rows_found": 1500,
4331 "num_initial_chunks_spilled_to_disk": 0,
4332 "peak_memory_used": "NNN",
4333 "sort_algorithm": "std::sort",
4334 "unpacked_addon_fields": "using_priority_queue",
4335 "sort_mode": "<fixed_sort_key, additional_fields>"
4336 }
4337 }
4338 ]
4339 }
4340 }
4341 ]
4342 } 0 0
4343 SELECT * FROM t1 JOIN tmp on t1.f2=tmp.f2
4344 ORDER BY tmp.f1, f0 LIMIT 30 OFFSET 30;
4345 f0 f1 f2 f1 f2
4346 3 2 2 2 2
4347 3 2 2 2 2
4348 3 2 2 2 2
4349 103 2 2 2 2
4350 103 2 2 2 2
4351 103 2 2 2 2
4352 203 2 2 2 2
4353 203 2 2 2 2
4354 203 2 2 2 2
4355 303 2 2 2 2
4356 303 2 2 2 2
4357 303 2 2 2 2
4358 403 2 2 2 2
4359 403 2 2 2 2
4360 403 2 2 2 2
4361 4 3 3 3 3
4362 4 3 3 3 3
4363 4 3 3 3 3
4364 104 3 3 3 3
4365 104 3 3 3 3
4366 104 3 3 3 3
4367 204 3 3 3 3
4368 204 3 3 3 3
4369 204 3 3 3 3
4370 304 3 3 3 3
4371 304 3 3 3 3
4372 304 3 3 3 3
4373 404 3 3 3 3
4374 404 3 3 3 3
4375 404 3 3 3 3
4376 SELECT * FROM information_schema.OPTIMIZER_TRACE;
4377 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
4378 SELECT * FROM t1 JOIN tmp on t1.f2=tmp.f2
4379 ORDER BY tmp.f1, f0 LIMIT 30 OFFSET 30 {
4380 "steps": [
4381 {
4382 "join_preparation": {
4383 "select#": 1,
4384 "steps": [
4385 {
4386 "expanded_query": "/* select#1 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2`,`tmp`.`f1` AS `f1`,`tmp`.`f2` AS `f2` from (`t1` join `tmp` on((`t1`.`f2` = `tmp`.`f2`))) order by `tmp`.`f1`,`t1`.`f0` limit 30,30"
4387 },
4388 {
4389 "transformations_to_nested_joins": {
4390 "transformations": [
4391 "JOIN_condition_to_WHERE",
4392 "parenthesis_removal"
4393 ],
4394 "expanded_query": "/* select#1 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2`,`tmp`.`f1` AS `f1`,`tmp`.`f2` AS `f2` from `t1` join `tmp` where (`t1`.`f2` = `tmp`.`f2`) order by `tmp`.`f1`,`t1`.`f0` limit 30,30"
4395 }
4396 }
4397 ]
4398 }
4399 },
4400 {
4401 "join_optimization": {
4402 "select#": 1,
4403 "steps": [
4404 {
4405 "condition_processing": {
4406 "condition": "WHERE",
4407 "original_condition": "(`t1`.`f2` = `tmp`.`f2`)",
4408 "steps": [
4409 {
4410 "transformation": "equality_propagation",
4411 "resulting_condition": "(`t1`.`f2` = `tmp`.`f2`)"
4412 },
4413 {
4414 "transformation": "constant_propagation",
4415 "resulting_condition": "(`t1`.`f2` = `tmp`.`f2`)"
4416 },
4417 {
4418 "transformation": "trivial_condition_removal",
4419 "resulting_condition": "(`t1`.`f2` = `tmp`.`f2`)"
4420 }
4421 ]
4422 }
4423 },
4424 {
4425 "substitute_generated_columns": {
4426 }
4427 },
4428 {
4429 "table_dependencies": [
4430 {
4431 "table": "`t1`",
4432 "row_may_be_null": false,
4433 "map_bit": 0,
4434 "depends_on_map_bits": [
4435 ]
4436 },
4437 {
4438 "table": "`tmp`",
4439 "row_may_be_null": false,
4440 "map_bit": 1,
4441 "depends_on_map_bits": [
4442 ]
4443 }
4444 ]
4445 },
4446 {
4447 "ref_optimizer_key_uses": [
4448 ]
4449 },
4450 {
4451 "rows_estimation": [
4452 {
4453 "table": "`t1`",
4454 "table_scan": {
4455 "rows": 500,
4456 "cost": 1.11035
4457 }
4458 },
4459 {
4460 "table": "`tmp`",
4461 "table_scan": {
4462 "rows": 300,
4463 "cost": 0.866211
4464 }
4465 }
4466 ]
4467 },
4468 {
4469 "considered_execution_plans": [
4470 {
4471 "plan_prefix": [
4472 ],
4473 "table": "`tmp`",
4474 "best_access_path": {
4475 "considered_access_paths": [
4476 {
4477 "rows_to_scan": 300,
4478 "filtering_effect": [
4479 ],
4480 "final_filtering_effect": 1,
4481 "access_type": "scan",
4482 "resulting_rows": 300,
4483 "cost": 30.8662,
4484 "chosen": true
4485 }
4486 ]
4487 },
4488 "condition_filtering_pct": 100,
4489 "rows_for_plan": 300,
4490 "cost_for_plan": 30.8662,
4491 "rest_of_plan": [
4492 {
4493 "plan_prefix": [
4494 "`tmp`"
4495 ],
4496 "table": "`t1`",
4497 "best_access_path": {
4498 "considered_access_paths": [
4499 {
4500 "rows_to_scan": 500,
4501 "filtering_effect": [
4502 ],
4503 "final_filtering_effect": 1,
4504 "access_type": "scan",
4505 "using_join_cache": true,
4506 "buffers_needed": 1,
4507 "resulting_rows": 500,
4508 "cost": 15001.1,
4509 "chosen": true
4510 }
4511 ]
4512 },
4513 "condition_filtering_pct": 10,
4514 "rows_for_plan": 15000,
4515 "cost_for_plan": 15032,
4516 "chosen": true
4517 }
4518 ]
4519 },
4520 {
4521 "plan_prefix": [
4522 ],
4523 "table": "`t1`",
4524 "best_access_path": {
4525 "considered_access_paths": [
4526 {
4527 "rows_to_scan": 500,
4528 "filtering_effect": [
4529 ],
4530 "final_filtering_effect": 1,
4531 "access_type": "scan",
4532 "resulting_rows": 500,
4533 "cost": 51.1104,
4534 "chosen": true
4535 }
4536 ]
4537 },
4538 "condition_filtering_pct": 100,
4539 "rows_for_plan": 500,
4540 "cost_for_plan": 51.1104,
4541 "pruned_by_heuristic": true
4542 }
4543 ]
4544 },
4545 {
4546 "attaching_conditions_to_tables": {
4547 "original_condition": "(`t1`.`f2` = `tmp`.`f2`)",
4548 "attached_conditions_computation": [
4549 ],
4550 "attached_conditions_summary": [
4551 {
4552 "table": "`tmp`",
4553 "attached": null
4554 },
4555 {
4556 "table": "`t1`",
4557 "attached": "(`t1`.`f2` = `tmp`.`f2`)"
4558 }
4559 ]
4560 }
4561 },
4562 {
4563 "optimizing_distinct_group_by_order_by": {
4564 "simplifying_order_by": {
4565 "original_clause": "`tmp`.`f1`,`t1`.`f0`",
4566 "items": [
4567 {
4568 "item": "`tmp`.`f1`"
4569 },
4570 {
4571 "item": "`t1`.`f0`"
4572 }
4573 ],
4574 "resulting_clause_is_simple": false,
4575 "resulting_clause": "`tmp`.`f1`,`t1`.`f0`"
4576 }
4577 }
4578 },
4579 {
4580 "finalizing_table_conditions": [
4581 {
4582 "table": "`t1`",
4583 "original_table_condition": "(`t1`.`f2` = `tmp`.`f2`)",
4584 "final_table_condition ": "(`t1`.`f2` = `tmp`.`f2`)"
4585 }
4586 ]
4587 },
4588 {
4589 "refine_plan": [
4590 {
4591 "table": "`tmp`"
4592 },
4593 {
4594 "table": "`t1`"
4595 }
4596 ]
4597 },
4598 {
4599 "considering_tmp_tables": [
4600 {
4601 "adding_tmp_table_in_plan_at_position": 2,
4602 "write_method": "write_all_rows"
4603 },
4604 {
4605 "adding_sort_to_table": ""
4606 }
4607 ]
4608 }
4609 ]
4610 }
4611 },
4612 {
4613 "join_execution": {
4614 "select#": 1,
4615 "steps": [
4616 {
4617 "sorting_table": "<temporary>",
4618 "filesort_information": [
4619 {
4620 "direction": "asc",
4621 "expression": "`tmp`.`f1`"
4622 },
4623 {
4624 "direction": "asc",
4625 "expression": "`t1`.`f0`"
4626 }
4627 ],
4628 "filesort_priority_queue_optimization": {
4629 "limit": 60,
4630 "chosen": true
4631 },
4632 "filesort_execution": [
4633 ],
4634 "filesort_summary": {
4635 "memory_available": 327680,
4636 "key_size": 17,
4637 "row_size": 252,
4638 "max_rows_per_buffer": 61,
4639 "num_rows_estimate": 15000,
4640 "num_rows_found": 1500,
4641 "num_initial_chunks_spilled_to_disk": 0,
4642 "peak_memory_used": "NNN",
4643 "sort_algorithm": "std::sort",
4644 "unpacked_addon_fields": "using_priority_queue",
4645 "sort_mode": "<fixed_sort_key, additional_fields>"
4646 }
4647 }
4648 ]
4649 }
4650 }
4651 ]
4652 } 0 0
4653 set optimizer_trace_limit=2;
4654 set optimizer_trace_offset=-2;
4655 SELECT SQL_CALC_FOUND_ROWS * FROM t1 JOIN tmp on t1.f2=tmp.f2
4656 ORDER BY tmp.f1, f0 LIMIT 30 OFFSET 30;
4657 f0 f1 f2 f1 f2
4658 3 2 2 2 2
4659 3 2 2 2 2
4660 3 2 2 2 2
4661 103 2 2 2 2
4662 103 2 2 2 2
4663 103 2 2 2 2
4664 203 2 2 2 2
4665 203 2 2 2 2
4666 203 2 2 2 2
4667 303 2 2 2 2
4668 303 2 2 2 2
4669 303 2 2 2 2
4670 403 2 2 2 2
4671 403 2 2 2 2
4672 403 2 2 2 2
4673 4 3 3 3 3
4674 4 3 3 3 3
4675 4 3 3 3 3
4676 104 3 3 3 3
4677 104 3 3 3 3
4678 104 3 3 3 3
4679 204 3 3 3 3
4680 204 3 3 3 3
4681 204 3 3 3 3
4682 304 3 3 3 3
4683 304 3 3 3 3
4684 304 3 3 3 3
4685 404 3 3 3 3
4686 404 3 3 3 3
4687 404 3 3 3 3
4688 Warnings:
4689 Warning 1287 SQL_CALC_FOUND_ROWS is deprecated and will be removed in a future release. Consider using two separate queries instead.
4690 SELECT FOUND_ROWS();
4691 FOUND_ROWS()
4692 1500
4693 Warnings:
4694 Warning 1287 FOUND_ROWS() is deprecated and will be removed in a future release. Consider using COUNT(*) instead.
4695 SELECT * FROM information_schema.OPTIMIZER_TRACE;
4696 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
4697 SELECT SQL_CALC_FOUND_ROWS * FROM t1 JOIN tmp on t1.f2=tmp.f2
4698 ORDER BY tmp.f1, f0 LIMIT 30 OFFSET 30 {
4699 "steps": [
4700 {
4701 "join_preparation": {
4702 "select#": 1,
4703 "steps": [
4704 {
4705 "expanded_query": "/* select#1 */ select sql_calc_found_rows `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2`,`tmp`.`f1` AS `f1`,`tmp`.`f2` AS `f2` from (`t1` join `tmp` on((`t1`.`f2` = `tmp`.`f2`))) order by `tmp`.`f1`,`t1`.`f0` limit 30,30"
4706 },
4707 {
4708 "transformations_to_nested_joins": {
4709 "transformations": [
4710 "JOIN_condition_to_WHERE",
4711 "parenthesis_removal"
4712 ],
4713 "expanded_query": "/* select#1 */ select sql_calc_found_rows `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2`,`tmp`.`f1` AS `f1`,`tmp`.`f2` AS `f2` from `t1` join `tmp` where (`t1`.`f2` = `tmp`.`f2`) order by `tmp`.`f1`,`t1`.`f0` limit 30,30"
4714 }
4715 }
4716 ]
4717 }
4718 },
4719 {
4720 "join_optimization": {
4721 "select#": 1,
4722 "steps": [
4723 {
4724 "condition_processing": {
4725 "condition": "WHERE",
4726 "original_condition": "(`t1`.`f2` = `tmp`.`f2`)",
4727 "steps": [
4728 {
4729 "transformation": "equality_propagation",
4730 "resulting_condition": "(`t1`.`f2` = `tmp`.`f2`)"
4731 },
4732 {
4733 "transformation": "constant_propagation",
4734 "resulting_condition": "(`t1`.`f2` = `tmp`.`f2`)"
4735 },
4736 {
4737 "transformation": "trivial_condition_removal",
4738 "resulting_condition": "(`t1`.`f2` = `tmp`.`f2`)"
4739 }
4740 ]
4741 }
4742 },
4743 {
4744 "substitute_generated_columns": {
4745 }
4746 },
4747 {
4748 "table_dependencies": [
4749 {
4750 "table": "`t1`",
4751 "row_may_be_null": false,
4752 "map_bit": 0,
4753 "depends_on_map_bits": [
4754 ]
4755 },
4756 {
4757 "table": "`tmp`",
4758 "row_may_be_null": false,
4759 "map_bit": 1,
4760 "depends_on_map_bits": [
4761 ]
4762 }
4763 ]
4764 },
4765 {
4766 "ref_optimizer_key_uses": [
4767 ]
4768 },
4769 {
4770 "rows_estimation": [
4771 {
4772 "table": "`t1`",
4773 "table_scan": {
4774 "rows": 500,
4775 "cost": 1.11035
4776 }
4777 },
4778 {
4779 "table": "`tmp`",
4780 "table_scan": {
4781 "rows": 300,
4782 "cost": 0.866211
4783 }
4784 }
4785 ]
4786 },
4787 {
4788 "considered_execution_plans": [
4789 {
4790 "plan_prefix": [
4791 ],
4792 "table": "`tmp`",
4793 "best_access_path": {
4794 "considered_access_paths": [
4795 {
4796 "rows_to_scan": 300,
4797 "filtering_effect": [
4798 ],
4799 "final_filtering_effect": 1,
4800 "access_type": "scan",
4801 "resulting_rows": 300,
4802 "cost": 30.8662,
4803 "chosen": true
4804 }
4805 ]
4806 },
4807 "condition_filtering_pct": 100,
4808 "rows_for_plan": 300,
4809 "cost_for_plan": 30.8662,
4810 "rest_of_plan": [
4811 {
4812 "plan_prefix": [
4813 "`tmp`"
4814 ],
4815 "table": "`t1`",
4816 "best_access_path": {
4817 "considered_access_paths": [
4818 {
4819 "rows_to_scan": 500,
4820 "filtering_effect": [
4821 ],
4822 "final_filtering_effect": 1,
4823 "access_type": "scan",
4824 "using_join_cache": true,
4825 "buffers_needed": 1,
4826 "resulting_rows": 500,
4827 "cost": 15001.1,
4828 "chosen": true
4829 }
4830 ]
4831 },
4832 "condition_filtering_pct": 10,
4833 "rows_for_plan": 15000,
4834 "cost_for_plan": 15032,
4835 "chosen": true
4836 }
4837 ]
4838 },
4839 {
4840 "plan_prefix": [
4841 ],
4842 "table": "`t1`",
4843 "best_access_path": {
4844 "considered_access_paths": [
4845 {
4846 "rows_to_scan": 500,
4847 "filtering_effect": [
4848 ],
4849 "final_filtering_effect": 1,
4850 "access_type": "scan",
4851 "resulting_rows": 500,
4852 "cost": 51.1104,
4853 "chosen": true
4854 }
4855 ]
4856 },
4857 "condition_filtering_pct": 100,
4858 "rows_for_plan": 500,
4859 "cost_for_plan": 51.1104,
4860 "pruned_by_heuristic": true
4861 }
4862 ]
4863 },
4864 {
4865 "attaching_conditions_to_tables": {
4866 "original_condition": "(`t1`.`f2` = `tmp`.`f2`)",
4867 "attached_conditions_computation": [
4868 ],
4869 "attached_conditions_summary": [
4870 {
4871 "table": "`tmp`",
4872 "attached": null
4873 },
4874 {
4875 "table": "`t1`",
4876 "attached": "(`t1`.`f2` = `tmp`.`f2`)"
4877 }
4878 ]
4879 }
4880 },
4881 {
4882 "optimizing_distinct_group_by_order_by": {
4883 "simplifying_order_by": {
4884 "original_clause": "`tmp`.`f1`,`t1`.`f0`",
4885 "items": [
4886 {
4887 "item": "`tmp`.`f1`"
4888 },
4889 {
4890 "item": "`t1`.`f0`"
4891 }
4892 ],
4893 "resulting_clause_is_simple": false,
4894 "resulting_clause": "`tmp`.`f1`,`t1`.`f0`"
4895 }
4896 }
4897 },
4898 {
4899 "finalizing_table_conditions": [
4900 {
4901 "table": "`t1`",
4902 "original_table_condition": "(`t1`.`f2` = `tmp`.`f2`)",
4903 "final_table_condition ": "(`t1`.`f2` = `tmp`.`f2`)"
4904 }
4905 ]
4906 },
4907 {
4908 "refine_plan": [
4909 {
4910 "table": "`tmp`"
4911 },
4912 {
4913 "table": "`t1`"
4914 }
4915 ]
4916 },
4917 {
4918 "considering_tmp_tables": [
4919 {
4920 "adding_tmp_table_in_plan_at_position": 2,
4921 "write_method": "write_all_rows"
4922 },
4923 {
4924 "adding_sort_to_table": ""
4925 }
4926 ]
4927 }
4928 ]
4929 }
4930 },
4931 {
4932 "join_execution": {
4933 "select#": 1,
4934 "steps": [
4935 {
4936 "sorting_table": "<temporary>",
4937 "filesort_information": [
4938 {
4939 "direction": "asc",
4940 "expression": "`tmp`.`f1`"
4941 },
4942 {
4943 "direction": "asc",
4944 "expression": "`t1`.`f0`"
4945 }
4946 ],
4947 "filesort_priority_queue_optimization": {
4948 "usable": false,
4949 "cause": "not applicable (no LIMIT)"
4950 },
4951 "filesort_execution": [
4952 ],
4953 "filesort_summary": {
4954 "memory_available": 327680,
4955 "key_size": 17,
4956 "row_size": 256,
4957 "max_rows_per_buffer": 1241,
4958 "num_rows_estimate": 15000,
4959 "num_rows_found": 1500,
4960 "num_initial_chunks_spilled_to_disk": 0,
4961 "peak_memory_used": "NNN",
4962 "sort_algorithm": "std::stable_sort",
4963 "sort_mode": "<fixed_sort_key, packed_additional_fields>"
4964 }
4965 }
4966 ]
4967 }
4968 }
4969 ]
4970 } 0 0
4971 SELECT FOUND_ROWS() {
4972 "steps": [
4973 {
4974 "join_preparation": {
4975 "select#": 1,
4976 "steps": [
4977 {
4978 "expanded_query": "/* select#1 */ select found_rows() AS `FOUND_ROWS()`"
4979 }
4980 ]
4981 }
4982 },
4983 {
4984 "join_optimization": {
4985 "select#": 1,
4986 "steps": [
4987 ]
4988 }
4989 },
4990 {
4991 "join_execution": {
4992 "select#": 1,
4993 "steps": [
4994 ]
4995 }
4996 }
4997 ]
4998 } 0 0
4999 SELECT SQL_CALC_FOUND_ROWS * FROM t1 JOIN tmp on t1.f2=tmp.f2
5000 WHERE t1.f2>20
5001 ORDER BY tmp.f1, f0 LIMIT 30 OFFSET 30;
5002 f0 f1 f2 f1 f2
5003 24 23 23 23 23
5004 24 23 23 23 23
5005 24 23 23 23 23
5006 124 23 23 23 23
5007 124 23 23 23 23
5008 124 23 23 23 23
5009 224 23 23 23 23
5010 224 23 23 23 23
5011 224 23 23 23 23
5012 324 23 23 23 23
5013 324 23 23 23 23
5014 324 23 23 23 23
5015 424 23 23 23 23
5016 424 23 23 23 23
5017 424 23 23 23 23
5018 25 24 24 24 24
5019 25 24 24 24 24
5020 25 24 24 24 24
5021 125 24 24 24 24
5022 125 24 24 24 24
5023 125 24 24 24 24
5024 225 24 24 24 24
5025 225 24 24 24 24
5026 225 24 24 24 24
5027 325 24 24 24 24
5028 325 24 24 24 24
5029 325 24 24 24 24
5030 425 24 24 24 24
5031 425 24 24 24 24
5032 425 24 24 24 24
5033 Warnings:
5034 Warning 1287 SQL_CALC_FOUND_ROWS is deprecated and will be removed in a future release. Consider using two separate queries instead.
5035 SELECT FOUND_ROWS();
5036 FOUND_ROWS()
5037 1185
5038 Warnings:
5039 Warning 1287 FOUND_ROWS() is deprecated and will be removed in a future release. Consider using COUNT(*) instead.
5040 SELECT * FROM information_schema.OPTIMIZER_TRACE;
5041 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
5042 SELECT SQL_CALC_FOUND_ROWS * FROM t1 JOIN tmp on t1.f2=tmp.f2
5043 WHERE t1.f2>20
5044 ORDER BY tmp.f1, f0 LIMIT 30 OFFSET 30 {
5045 "steps": [
5046 {
5047 "join_preparation": {
5048 "select#": 1,
5049 "steps": [
5050 {
5051 "expanded_query": "/* select#1 */ select sql_calc_found_rows `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2`,`tmp`.`f1` AS `f1`,`tmp`.`f2` AS `f2` from (`t1` join `tmp` on((`t1`.`f2` = `tmp`.`f2`))) where (`t1`.`f2` > 20) order by `tmp`.`f1`,`t1`.`f0` limit 30,30"
5052 },
5053 {
5054 "transformations_to_nested_joins": {
5055 "transformations": [
5056 "JOIN_condition_to_WHERE",
5057 "parenthesis_removal"
5058 ],
5059 "expanded_query": "/* select#1 */ select sql_calc_found_rows `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2`,`tmp`.`f1` AS `f1`,`tmp`.`f2` AS `f2` from `t1` join `tmp` where ((`t1`.`f2` > 20) and (`t1`.`f2` = `tmp`.`f2`)) order by `tmp`.`f1`,`t1`.`f0` limit 30,30"
5060 }
5061 }
5062 ]
5063 }
5064 },
5065 {
5066 "join_optimization": {
5067 "select#": 1,
5068 "steps": [
5069 {
5070 "condition_processing": {
5071 "condition": "WHERE",
5072 "original_condition": "((`t1`.`f2` > 20) and (`t1`.`f2` = `tmp`.`f2`))",
5073 "steps": [
5074 {
5075 "transformation": "equality_propagation",
5076 "resulting_condition": "((`t1`.`f2` > 20) and (`t1`.`f2` = `tmp`.`f2`))"
5077 },
5078 {
5079 "transformation": "constant_propagation",
5080 "resulting_condition": "((`t1`.`f2` > 20) and (`t1`.`f2` = `tmp`.`f2`))"
5081 },
5082 {
5083 "transformation": "trivial_condition_removal",
5084 "resulting_condition": "((`t1`.`f2` > 20) and (`t1`.`f2` = `tmp`.`f2`))"
5085 }
5086 ]
5087 }
5088 },
5089 {
5090 "substitute_generated_columns": {
5091 }
5092 },
5093 {
5094 "table_dependencies": [
5095 {
5096 "table": "`t1`",
5097 "row_may_be_null": false,
5098 "map_bit": 0,
5099 "depends_on_map_bits": [
5100 ]
5101 },
5102 {
5103 "table": "`tmp`",
5104 "row_may_be_null": false,
5105 "map_bit": 1,
5106 "depends_on_map_bits": [
5107 ]
5108 }
5109 ]
5110 },
5111 {
5112 "ref_optimizer_key_uses": [
5113 ]
5114 },
5115 {
5116 "rows_estimation": [
5117 {
5118 "table": "`t1`",
5119 "table_scan": {
5120 "rows": 500,
5121 "cost": 1.11035
5122 }
5123 },
5124 {
5125 "table": "`tmp`",
5126 "table_scan": {
5127 "rows": 300,
5128 "cost": 0.866211
5129 }
5130 }
5131 ]
5132 },
5133 {
5134 "considered_execution_plans": [
5135 {
5136 "plan_prefix": [
5137 ],
5138 "table": "`tmp`",
5139 "best_access_path": {
5140 "considered_access_paths": [
5141 {
5142 "rows_to_scan": 300,
5143 "filtering_effect": [
5144 ],
5145 "final_filtering_effect": 1,
5146 "access_type": "scan",
5147 "resulting_rows": 300,
5148 "cost": 30.8662,
5149 "chosen": true
5150 }
5151 ]
5152 },
5153 "condition_filtering_pct": 100,
5154 "rows_for_plan": 300,
5155 "cost_for_plan": 30.8662,
5156 "rest_of_plan": [
5157 {
5158 "plan_prefix": [
5159 "`tmp`"
5160 ],
5161 "table": "`t1`",
5162 "best_access_path": {
5163 "considered_access_paths": [
5164 {
5165 "rows_to_scan": 500,
5166 "filtering_effect": [
5167 ],
5168 "final_filtering_effect": 0.3333,
5169 "access_type": "scan",
5170 "using_join_cache": true,
5171 "buffers_needed": 1,
5172 "resulting_rows": 166.65,
5173 "cost": 5034.97,
5174 "chosen": true
5175 }
5176 ]
5177 },
5178 "condition_filtering_pct": 10,
5179 "rows_for_plan": 4999.5,
5180 "cost_for_plan": 5065.84,
5181 "chosen": true
5182 }
5183 ]
5184 },
5185 {
5186 "plan_prefix": [
5187 ],
5188 "table": "`t1`",
5189 "best_access_path": {
5190 "considered_access_paths": [
5191 {
5192 "rows_to_scan": 500,
5193 "filtering_effect": [
5194 ],
5195 "final_filtering_effect": 0.3333,
5196 "access_type": "scan",
5197 "resulting_rows": 166.65,
5198 "cost": 51.1104,
5199 "chosen": true
5200 }
5201 ]
5202 },
5203 "condition_filtering_pct": 100,
5204 "rows_for_plan": 166.65,
5205 "cost_for_plan": 51.1104,
5206 "rest_of_plan": [
5207 {
5208 "plan_prefix": [
5209 "`t1`"
5210 ],
5211 "table": "`tmp`",
5212 "best_access_path": {
5213 "considered_access_paths": [
5214 {
5215 "rows_to_scan": 300,
5216 "filtering_effect": [
5217 ],
5218 "final_filtering_effect": 1,
5219 "access_type": "scan",
5220 "using_join_cache": true,
5221 "buffers_needed": 1,
5222 "resulting_rows": 300,
5223 "cost": 5000.48,
5224 "chosen": true
5225 }
5226 ]
5227 },
5228 "condition_filtering_pct": 10,
5229 "rows_for_plan": 4999.5,
5230 "cost_for_plan": 5051.59,
5231 "chosen": true
5232 }
5233 ]
5234 }
5235 ]
5236 },
5237 {
5238 "attaching_conditions_to_tables": {
5239 "original_condition": "((`t1`.`f2` > 20) and (`t1`.`f2` = `tmp`.`f2`))",
5240 "attached_conditions_computation": [
5241 ],
5242 "attached_conditions_summary": [
5243 {
5244 "table": "`t1`",
5245 "attached": "(`t1`.`f2` > 20)"
5246 },
5247 {
5248 "table": "`tmp`",
5249 "attached": "(`t1`.`f2` = `tmp`.`f2`)"
5250 }
5251 ]
5252 }
5253 },
5254 {
5255 "optimizing_distinct_group_by_order_by": {
5256 "simplifying_order_by": {
5257 "original_clause": "`tmp`.`f1`,`t1`.`f0`",
5258 "items": [
5259 {
5260 "item": "`tmp`.`f1`"
5261 },
5262 {
5263 "item": "`t1`.`f0`"
5264 }
5265 ],
5266 "resulting_clause_is_simple": false,
5267 "resulting_clause": "`tmp`.`f1`,`t1`.`f0`"
5268 }
5269 }
5270 },
5271 {
5272 "finalizing_table_conditions": [
5273 {
5274 "table": "`t1`",
5275 "original_table_condition": "(`t1`.`f2` > 20)",
5276 "final_table_condition ": "(`t1`.`f2` > 20)"
5277 },
5278 {
5279 "table": "`tmp`",
5280 "original_table_condition": "(`t1`.`f2` = `tmp`.`f2`)",
5281 "final_table_condition ": "(`t1`.`f2` = `tmp`.`f2`)"
5282 }
5283 ]
5284 },
5285 {
5286 "refine_plan": [
5287 {
5288 "table": "`t1`"
5289 },
5290 {
5291 "table": "`tmp`"
5292 }
5293 ]
5294 },
5295 {
5296 "considering_tmp_tables": [
5297 {
5298 "adding_tmp_table_in_plan_at_position": 2,
5299 "write_method": "write_all_rows"
5300 },
5301 {
5302 "adding_sort_to_table": ""
5303 }
5304 ]
5305 }
5306 ]
5307 }
5308 },
5309 {
5310 "join_execution": {
5311 "select#": 1,
5312 "steps": [
5313 {
5314 "sorting_table": "<temporary>",
5315 "filesort_information": [
5316 {
5317 "direction": "asc",
5318 "expression": "`tmp`.`f1`"
5319 },
5320 {
5321 "direction": "asc",
5322 "expression": "`t1`.`f0`"
5323 }
5324 ],
5325 "filesort_priority_queue_optimization": {
5326 "usable": false,
5327 "cause": "not applicable (no LIMIT)"
5328 },
5329 "filesort_execution": [
5330 ],
5331 "filesort_summary": {
5332 "memory_available": 327680,
5333 "key_size": 17,
5334 "row_size": 256,
5335 "max_rows_per_buffer": 1241,
5336 "num_rows_estimate": 4999,
5337 "num_rows_found": 1185,
5338 "num_initial_chunks_spilled_to_disk": 0,
5339 "peak_memory_used": "NNN",
5340 "sort_algorithm": "std::stable_sort",
5341 "sort_mode": "<fixed_sort_key, packed_additional_fields>"
5342 }
5343 }
5344 ]
5345 }
5346 }
5347 ]
5348 } 0 0
5349 SELECT FOUND_ROWS() {
5350 "steps": [
5351 {
5352 "join_preparation": {
5353 "select#": 1,
5354 "steps": [
5355 {
5356 "expanded_query": "/* select#1 */ select found_rows() AS `FOUND_ROWS()`"
5357 }
5358 ]
5359 }
5360 },
5361 {
5362 "join_optimization": {
5363 "select#": 1,
5364 "steps": [
5365 ]
5366 }
5367 },
5368 {
5369 "join_execution": {
5370 "select#": 1,
5371 "steps": [
5372 ]
5373 }
5374 }
5375 ]
5376 } 0 0
5377 DROP TABLE tmp;
5378 set optimizer_trace_limit=1;
5379 set optimizer_trace_offset=-1;
5380 CREATE VIEW v1 as SELECT * FROM t1 ORDER BY f1, f0 LIMIT 30;
5381 SELECT * FROM v1;
5382 f0 f1 f2
5383 1 0 0
5384 101 0 0
5385 201 0 0
5386 301 0 0
5387 401 0 0
5388 2 1 1
5389 102 1 1
5390 202 1 1
5391 302 1 1
5392 402 1 1
5393 3 2 2
5394 103 2 2
5395 203 2 2
5396 303 2 2
5397 403 2 2
5398 4 3 3
5399 104 3 3
5400 204 3 3
5401 304 3 3
5402 404 3 3
5403 5 4 4
5404 105 4 4
5405 205 4 4
5406 305 4 4
5407 405 4 4
5408 6 5 5
5409 106 5 5
5410 206 5 5
5411 306 5 5
5412 406 5 5
5413 SELECT * FROM information_schema.OPTIMIZER_TRACE;
5414 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
5415 SELECT * FROM v1 {
5416 "steps": [
5417 {
5418 "join_preparation": {
5419 "select#": 1,
5420 "steps": [
5421 {
5422 "join_preparation": {
5423 "select#": 2,
5424 "steps": [
5425 {
5426 "expanded_query": "/* select#2 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` order by `t1`.`f1`,`t1`.`f0` limit 30"
5427 }
5428 ]
5429 }
5430 },
5431 {
5432 "view": {
5433 "table": "`v1`",
5434 "select#": 2,
5435 "materialized": true
5436 }
5437 },
5438 {
5439 "expanded_query": "/* select#1 */ select `v1`.`f0` AS `f0`,`v1`.`f1` AS `f1`,`v1`.`f2` AS `f2` from `v1`"
5440 }
5441 ]
5442 }
5443 },
5444 {
5445 "join_optimization": {
5446 "select#": 1,
5447 "steps": [
5448 {
5449 "join_optimization": {
5450 "select#": 2,
5451 "steps": [
5452 {
5453 "substitute_generated_columns": {
5454 }
5455 },
5456 {
5457 "table_dependencies": [
5458 {
5459 "table": "`t1`",
5460 "row_may_be_null": false,
5461 "map_bit": 0,
5462 "depends_on_map_bits": [
5463 ]
5464 }
5465 ]
5466 },
5467 {
5468 "rows_estimation": [
5469 {
5470 "table": "`t1`",
5471 "table_scan": {
5472 "rows": 500,
5473 "cost": 1.11035
5474 }
5475 }
5476 ]
5477 },
5478 {
5479 "considered_execution_plans": [
5480 {
5481 "plan_prefix": [
5482 ],
5483 "table": "`t1`",
5484 "best_access_path": {
5485 "considered_access_paths": [
5486 {
5487 "rows_to_scan": 500,
5488 "access_type": "scan",
5489 "resulting_rows": 500,
5490 "cost": 51.1104,
5491 "chosen": true
5492 }
5493 ]
5494 },
5495 "condition_filtering_pct": 100,
5496 "rows_for_plan": 500,
5497 "cost_for_plan": 51.1104,
5498 "chosen": true
5499 }
5500 ]
5501 },
5502 {
5503 "attaching_conditions_to_tables": {
5504 "original_condition": null,
5505 "attached_conditions_computation": [
5506 ],
5507 "attached_conditions_summary": [
5508 {
5509 "table": "`t1`",
5510 "attached": null
5511 }
5512 ]
5513 }
5514 },
5515 {
5516 "optimizing_distinct_group_by_order_by": {
5517 "simplifying_order_by": {
5518 "original_clause": "`t1`.`f1`,`t1`.`f0`",
5519 "items": [
5520 {
5521 "item": "`t1`.`f1`"
5522 },
5523 {
5524 "item": "`t1`.`f0`"
5525 }
5526 ],
5527 "resulting_clause_is_simple": true,
5528 "resulting_clause": "`t1`.`f1`,`t1`.`f0`"
5529 }
5530 }
5531 },
5532 {
5533 "finalizing_table_conditions": [
5534 ]
5535 },
5536 {
5537 "refine_plan": [
5538 {
5539 "table": "`t1`"
5540 }
5541 ]
5542 },
5543 {
5544 "considering_tmp_tables": [
5545 {
5546 "adding_sort_to_table": "t1"
5547 }
5548 ]
5549 }
5550 ]
5551 }
5552 },
5553 {
5554 "table_dependencies": [
5555 {
5556 "table": "`v1`",
5557 "row_may_be_null": false,
5558 "map_bit": 0,
5559 "depends_on_map_bits": [
5560 ]
5561 }
5562 ]
5563 },
5564 {
5565 "rows_estimation": [
5566 {
5567 "table": "`v1`",
5568 "table_scan": {
5569 "rows": 30,
5570 "cost": 2.875
5571 }
5572 }
5573 ]
5574 },
5575 {
5576 "considered_execution_plans": [
5577 {
5578 "plan_prefix": [
5579 ],
5580 "table": "`v1`",
5581 "best_access_path": {
5582 "considered_access_paths": [
5583 {
5584 "rows_to_scan": 30,
5585 "access_type": "scan",
5586 "resulting_rows": 30,
5587 "cost": 5.875,
5588 "chosen": true
5589 }
5590 ]
5591 },
5592 "condition_filtering_pct": 100,
5593 "rows_for_plan": 30,
5594 "cost_for_plan": 5.875,
5595 "chosen": true
5596 }
5597 ]
5598 },
5599 {
5600 "attaching_conditions_to_tables": {
5601 "original_condition": null,
5602 "attached_conditions_computation": [
5603 ],
5604 "attached_conditions_summary": [
5605 {
5606 "table": "`v1`",
5607 "attached": null
5608 }
5609 ]
5610 }
5611 },
5612 {
5613 "finalizing_table_conditions": [
5614 ]
5615 },
5616 {
5617 "refine_plan": [
5618 {
5619 "table": "`v1`"
5620 }
5621 ]
5622 }
5623 ]
5624 }
5625 },
5626 {
5627 "join_execution": {
5628 "select#": 1,
5629 "steps": [
5630 {
5631 "creating_tmp_table": {
5632 "tmp_table_info": {
5633 "table": "`v1`",
5634 "in_plan_at_position": 0,
5635 "columns": 3,
5636 "row_length": 210,
5637 "key_length": 0,
5638 "unique_constraint": false,
5639 "makes_grouped_rows": false,
5640 "cannot_insert_duplicates": false,
5641 "location": "TempTable"
5642 }
5643 }
5644 },
5645 {
5646 "materialize": {
5647 "select#": 2,
5648 "steps": [
5649 {
5650 "sorting_table": "t1",
5651 "filesort_information": [
5652 {
5653 "direction": "asc",
5654 "expression": "`t1`.`f1`"
5655 },
5656 {
5657 "direction": "asc",
5658 "expression": "`t1`.`f0`"
5659 }
5660 ],
5661 "filesort_priority_queue_optimization": {
5662 "limit": 30,
5663 "chosen": true
5664 },
5665 "filesort_execution": [
5666 ],
5667 "filesort_summary": {
5668 "memory_available": 327680,
5669 "key_size": 17,
5670 "row_size": 227,
5671 "max_rows_per_buffer": 31,
5672 "num_rows_estimate": 500,
5673 "num_rows_found": 500,
5674 "num_initial_chunks_spilled_to_disk": 0,
5675 "peak_memory_used": "NNN",
5676 "sort_algorithm": "std::sort",
5677 "unpacked_addon_fields": "using_priority_queue",
5678 "sort_mode": "<fixed_sort_key, additional_fields>"
5679 }
5680 }
5681 ]
5682 }
5683 }
5684 ]
5685 }
5686 }
5687 ]
5688 } 0 0
5689 drop view v1;
5690 CREATE VIEW v1 as SELECT * FROM t1 ORDER BY f1, f0 LIMIT 100;
5691 SELECT * FROM v1 ORDER BY f2, f0 LIMIT 30;
5692 f0 f1 f2
5693 1 0 0
5694 101 0 0
5695 201 0 0
5696 301 0 0
5697 401 0 0
5698 2 1 1
5699 102 1 1
5700 202 1 1
5701 302 1 1
5702 402 1 1
5703 11 10 10
5704 111 10 10
5705 211 10 10
5706 311 10 10
5707 411 10 10
5708 12 11 11
5709 112 11 11
5710 212 11 11
5711 312 11 11
5712 412 11 11
5713 13 12 12
5714 113 12 12
5715 213 12 12
5716 313 12 12
5717 413 12 12
5718 14 13 13
5719 114 13 13
5720 214 13 13
5721 314 13 13
5722 414 13 13
5723 SELECT * FROM information_schema.OPTIMIZER_TRACE;
5724 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
5725 SELECT * FROM v1 ORDER BY f2, f0 LIMIT 30 {
5726 "steps": [
5727 {
5728 "join_preparation": {
5729 "select#": 1,
5730 "steps": [
5731 {
5732 "join_preparation": {
5733 "select#": 2,
5734 "steps": [
5735 {
5736 "expanded_query": "/* select#2 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` order by `t1`.`f1`,`t1`.`f0` limit 100"
5737 }
5738 ]
5739 }
5740 },
5741 {
5742 "view": {
5743 "table": "`v1`",
5744 "select#": 2,
5745 "materialized": true
5746 }
5747 },
5748 {
5749 "expanded_query": "/* select#1 */ select `v1`.`f0` AS `f0`,`v1`.`f1` AS `f1`,`v1`.`f2` AS `f2` from `v1` order by `v1`.`f2`,`v1`.`f0` limit 30"
5750 }
5751 ]
5752 }
5753 },
5754 {
5755 "join_optimization": {
5756 "select#": 1,
5757 "steps": [
5758 {
5759 "join_optimization": {
5760 "select#": 2,
5761 "steps": [
5762 {
5763 "substitute_generated_columns": {
5764 }
5765 },
5766 {
5767 "table_dependencies": [
5768 {
5769 "table": "`t1`",
5770 "row_may_be_null": false,
5771 "map_bit": 0,
5772 "depends_on_map_bits": [
5773 ]
5774 }
5775 ]
5776 },
5777 {
5778 "rows_estimation": [
5779 {
5780 "table": "`t1`",
5781 "table_scan": {
5782 "rows": 500,
5783 "cost": 1.11035
5784 }
5785 }
5786 ]
5787 },
5788 {
5789 "considered_execution_plans": [
5790 {
5791 "plan_prefix": [
5792 ],
5793 "table": "`t1`",
5794 "best_access_path": {
5795 "considered_access_paths": [
5796 {
5797 "rows_to_scan": 500,
5798 "access_type": "scan",
5799 "resulting_rows": 500,
5800 "cost": 51.1104,
5801 "chosen": true
5802 }
5803 ]
5804 },
5805 "condition_filtering_pct": 100,
5806 "rows_for_plan": 500,
5807 "cost_for_plan": 51.1104,
5808 "chosen": true
5809 }
5810 ]
5811 },
5812 {
5813 "attaching_conditions_to_tables": {
5814 "original_condition": null,
5815 "attached_conditions_computation": [
5816 ],
5817 "attached_conditions_summary": [
5818 {
5819 "table": "`t1`",
5820 "attached": null
5821 }
5822 ]
5823 }
5824 },
5825 {
5826 "optimizing_distinct_group_by_order_by": {
5827 "simplifying_order_by": {
5828 "original_clause": "`t1`.`f1`,`t1`.`f0`",
5829 "items": [
5830 {
5831 "item": "`t1`.`f1`"
5832 },
5833 {
5834 "item": "`t1`.`f0`"
5835 }
5836 ],
5837 "resulting_clause_is_simple": true,
5838 "resulting_clause": "`t1`.`f1`,`t1`.`f0`"
5839 }
5840 }
5841 },
5842 {
5843 "finalizing_table_conditions": [
5844 ]
5845 },
5846 {
5847 "refine_plan": [
5848 {
5849 "table": "`t1`"
5850 }
5851 ]
5852 },
5853 {
5854 "considering_tmp_tables": [
5855 {
5856 "adding_sort_to_table": "t1"
5857 }
5858 ]
5859 }
5860 ]
5861 }
5862 },
5863 {
5864 "substitute_generated_columns": {
5865 }
5866 },
5867 {
5868 "table_dependencies": [
5869 {
5870 "table": "`v1`",
5871 "row_may_be_null": false,
5872 "map_bit": 0,
5873 "depends_on_map_bits": [
5874 ]
5875 }
5876 ]
5877 },
5878 {
5879 "rows_estimation": [
5880 {
5881 "table": "`v1`",
5882 "table_scan": {
5883 "rows": 100,
5884 "cost": 3.75
5885 }
5886 }
5887 ]
5888 },
5889 {
5890 "considered_execution_plans": [
5891 {
5892 "plan_prefix": [
5893 ],
5894 "table": "`v1`",
5895 "best_access_path": {
5896 "considered_access_paths": [
5897 {
5898 "rows_to_scan": 100,
5899 "access_type": "scan",
5900 "resulting_rows": 100,
5901 "cost": 13.75,
5902 "chosen": true
5903 }
5904 ]
5905 },
5906 "condition_filtering_pct": 100,
5907 "rows_for_plan": 100,
5908 "cost_for_plan": 13.75,
5909 "chosen": true
5910 }
5911 ]
5912 },
5913 {
5914 "attaching_conditions_to_tables": {
5915 "original_condition": null,
5916 "attached_conditions_computation": [
5917 ],
5918 "attached_conditions_summary": [
5919 {
5920 "table": "`v1`",
5921 "attached": null
5922 }
5923 ]
5924 }
5925 },
5926 {
5927 "optimizing_distinct_group_by_order_by": {
5928 "simplifying_order_by": {
5929 "original_clause": "`v1`.`f2`,`v1`.`f0`",
5930 "items": [
5931 {
5932 "item": "`v1`.`f2`"
5933 },
5934 {
5935 "item": "`v1`.`f0`"
5936 }
5937 ],
5938 "resulting_clause_is_simple": true,
5939 "resulting_clause": "`v1`.`f2`,`v1`.`f0`"
5940 }
5941 }
5942 },
5943 {
5944 "finalizing_table_conditions": [
5945 ]
5946 },
5947 {
5948 "refine_plan": [
5949 {
5950 "table": "`v1`"
5951 }
5952 ]
5953 },
5954 {
5955 "considering_tmp_tables": [
5956 {
5957 "adding_sort_to_table": "v1"
5958 }
5959 ]
5960 }
5961 ]
5962 }
5963 },
5964 {
5965 "join_execution": {
5966 "select#": 1,
5967 "steps": [
5968 {
5969 "creating_tmp_table": {
5970 "tmp_table_info": {
5971 "table": "`v1`",
5972 "in_plan_at_position": 0,
5973 "columns": 3,
5974 "row_length": 210,
5975 "key_length": 0,
5976 "unique_constraint": false,
5977 "makes_grouped_rows": false,
5978 "cannot_insert_duplicates": false,
5979 "location": "TempTable"
5980 }
5981 }
5982 },
5983 {
5984 "materialize": {
5985 "select#": 2,
5986 "steps": [
5987 {
5988 "sorting_table": "t1",
5989 "filesort_information": [
5990 {
5991 "direction": "asc",
5992 "expression": "`t1`.`f1`"
5993 },
5994 {
5995 "direction": "asc",
5996 "expression": "`t1`.`f0`"
5997 }
5998 ],
5999 "filesort_priority_queue_optimization": {
6000 "limit": 100,
6001 "chosen": true
6002 },
6003 "filesort_execution": [
6004 ],
6005 "filesort_summary": {
6006 "memory_available": 327680,
6007 "key_size": 17,
6008 "row_size": 227,
6009 "max_rows_per_buffer": 101,
6010 "num_rows_estimate": 500,
6011 "num_rows_found": 500,
6012 "num_initial_chunks_spilled_to_disk": 0,
6013 "peak_memory_used": "NNN",
6014 "sort_algorithm": "std::stable_sort",
6015 "unpacked_addon_fields": "using_priority_queue",
6016 "sort_mode": "<fixed_sort_key, additional_fields>"
6017 }
6018 }
6019 ]
6020 }
6021 },
6022 {
6023 "sorting_table": "v1",
6024 "filesort_information": [
6025 {
6026 "direction": "asc",
6027 "expression": "`v1`.`f2`"
6028 },
6029 {
6030 "direction": "asc",
6031 "expression": "`v1`.`f0`"
6032 }
6033 ],
6034 "filesort_priority_queue_optimization": {
6035 "limit": 30,
6036 "chosen": true
6037 },
6038 "filesort_execution": [
6039 ],
6040 "filesort_summary": {
6041 "memory_available": 327680,
6042 "key_size": 209,
6043 "row_size": 419,
6044 "max_rows_per_buffer": 31,
6045 "num_rows_estimate": 100,
6046 "num_rows_found": 100,
6047 "num_initial_chunks_spilled_to_disk": 0,
6048 "peak_memory_used": "NNN",
6049 "sort_algorithm": "std::sort",
6050 "unpacked_addon_fields": "using_priority_queue",
6051 "sort_mode": "<fixed_sort_key, additional_fields>"
6052 }
6053 }
6054 ]
6055 }
6056 }
6057 ]
6058 } 0 0
6059 EXPLAIN FORMAT=tree SELECT * FROM v1 ORDER BY f2, f0 LIMIT 30;
6060 EXPLAIN
6061 -> Limit: 30 row(s) (cost=89.6..89.6 rows=30)
6062 -> Sort: v1.f2, v1.f0, limit input to 30 row(s) per chunk (cost=89.6..89.6 rows=30)
6063 -> Table scan on v1 (cost=61.1..64.9 rows=100)
6064 -> Materialize (cost=61.1..61.1 rows=100)
6065 -> Limit: 100 row(s) (cost=51.1 rows=100)
6066 -> Sort: t1.f1, t1.f0, limit input to 100 row(s) per chunk (cost=51.1 rows=500)
6067 -> Table scan on t1 (cost=51.1 rows=500)
6068
6069 CREATE VIEW v2 as SELECT * FROM t1 ORDER BY f2, f0 LIMIT 100;
6070 SELECT * FROM v1 JOIN v2 on v1.f1=v2.f1 ORDER BY v1.f2,v1.f0,v2.f0
6071 LIMIT 30;
6072 f0 f1 f2 f0 f1 f2
6073 1 0 0 1 0 0
6074 1 0 0 101 0 0
6075 1 0 0 201 0 0
6076 1 0 0 301 0 0
6077 1 0 0 401 0 0
6078 101 0 0 1 0 0
6079 101 0 0 101 0 0
6080 101 0 0 201 0 0
6081 101 0 0 301 0 0
6082 101 0 0 401 0 0
6083 201 0 0 1 0 0
6084 201 0 0 101 0 0
6085 201 0 0 201 0 0
6086 201 0 0 301 0 0
6087 201 0 0 401 0 0
6088 301 0 0 1 0 0
6089 301 0 0 101 0 0
6090 301 0 0 201 0 0
6091 301 0 0 301 0 0
6092 301 0 0 401 0 0
6093 401 0 0 1 0 0
6094 401 0 0 101 0 0
6095 401 0 0 201 0 0
6096 401 0 0 301 0 0
6097 401 0 0 401 0 0
6098 2 1 1 2 1 1
6099 2 1 1 102 1 1
6100 2 1 1 202 1 1
6101 2 1 1 302 1 1
6102 2 1 1 402 1 1
6103 SELECT * FROM information_schema.OPTIMIZER_TRACE;
6104 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
6105 SELECT * FROM v1 JOIN v2 on v1.f1=v2.f1 ORDER BY v1.f2,v1.f0,v2.f0
6106 LIMIT 30 {
6107 "steps": [
6108 {
6109 "join_preparation": {
6110 "select#": 1,
6111 "steps": [
6112 {
6113 "join_preparation": {
6114 "select#": 2,
6115 "steps": [
6116 {
6117 "expanded_query": "/* select#2 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` order by `t1`.`f1`,`t1`.`f0` limit 100"
6118 }
6119 ]
6120 }
6121 },
6122 {
6123 "view": {
6124 "table": "`v1`",
6125 "select#": 2,
6126 "materialized": true
6127 }
6128 },
6129 {
6130 "join_preparation": {
6131 "select#": 3,
6132 "steps": [
6133 {
6134 "expanded_query": "/* select#3 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` order by `t1`.`f2`,`t1`.`f0` limit 100"
6135 }
6136 ]
6137 }
6138 },
6139 {
6140 "view": {
6141 "table": "`v2`",
6142 "select#": 3,
6143 "materialized": true
6144 }
6145 },
6146 {
6147 "expanded_query": "/* select#1 */ select `v1`.`f0` AS `f0`,`v1`.`f1` AS `f1`,`v1`.`f2` AS `f2`,`v2`.`f0` AS `f0`,`v2`.`f1` AS `f1`,`v2`.`f2` AS `f2` from (`v1` join `v2` on((`v1`.`f1` = `v2`.`f1`))) order by `v1`.`f2`,`v1`.`f0`,`v2`.`f0` limit 30"
6148 },
6149 {
6150 "transformations_to_nested_joins": {
6151 "transformations": [
6152 "JOIN_condition_to_WHERE",
6153 "parenthesis_removal"
6154 ],
6155 "expanded_query": "/* select#1 */ select `v1`.`f0` AS `f0`,`v1`.`f1` AS `f1`,`v1`.`f2` AS `f2`,`v2`.`f0` AS `f0`,`v2`.`f1` AS `f1`,`v2`.`f2` AS `f2` from `v1` join `v2` where (`v1`.`f1` = `v2`.`f1`) order by `v1`.`f2`,`v1`.`f0`,`v2`.`f0` limit 30"
6156 }
6157 }
6158 ]
6159 }
6160 },
6161 {
6162 "join_optimization": {
6163 "select#": 1,
6164 "steps": [
6165 {
6166 "join_optimization": {
6167 "select#": 2,
6168 "steps": [
6169 {
6170 "substitute_generated_columns": {
6171 }
6172 },
6173 {
6174 "table_dependencies": [
6175 {
6176 "table": "`t1`",
6177 "row_may_be_null": false,
6178 "map_bit": 0,
6179 "depends_on_map_bits": [
6180 ]
6181 }
6182 ]
6183 },
6184 {
6185 "rows_estimation": [
6186 {
6187 "table": "`t1`",
6188 "table_scan": {
6189 "rows": 500,
6190 "cost": 1.11035
6191 }
6192 }
6193 ]
6194 },
6195 {
6196 "considered_execution_plans": [
6197 {
6198 "plan_prefix": [
6199 ],
6200 "table": "`t1`",
6201 "best_access_path": {
6202 "considered_access_paths": [
6203 {
6204 "rows_to_scan": 500,
6205 "access_type": "scan",
6206 "resulting_rows": 500,
6207 "cost": 51.1104,
6208 "chosen": true
6209 }
6210 ]
6211 },
6212 "condition_filtering_pct": 100,
6213 "rows_for_plan": 500,
6214 "cost_for_plan": 51.1104,
6215 "chosen": true
6216 }
6217 ]
6218 },
6219 {
6220 "attaching_conditions_to_tables": {
6221 "original_condition": null,
6222 "attached_conditions_computation": [
6223 ],
6224 "attached_conditions_summary": [
6225 {
6226 "table": "`t1`",
6227 "attached": null
6228 }
6229 ]
6230 }
6231 },
6232 {
6233 "optimizing_distinct_group_by_order_by": {
6234 "simplifying_order_by": {
6235 "original_clause": "`t1`.`f1`,`t1`.`f0`",
6236 "items": [
6237 {
6238 "item": "`t1`.`f1`"
6239 },
6240 {
6241 "item": "`t1`.`f0`"
6242 }
6243 ],
6244 "resulting_clause_is_simple": true,
6245 "resulting_clause": "`t1`.`f1`,`t1`.`f0`"
6246 }
6247 }
6248 },
6249 {
6250 "finalizing_table_conditions": [
6251 ]
6252 },
6253 {
6254 "refine_plan": [
6255 {
6256 "table": "`t1`"
6257 }
6258 ]
6259 },
6260 {
6261 "considering_tmp_tables": [
6262 {
6263 "adding_sort_to_table": "t1"
6264 }
6265 ]
6266 }
6267 ]
6268 }
6269 },
6270 {
6271 "join_optimization": {
6272 "select#": 3,
6273 "steps": [
6274 {
6275 "substitute_generated_columns": {
6276 }
6277 },
6278 {
6279 "table_dependencies": [
6280 {
6281 "table": "`t1`",
6282 "row_may_be_null": false,
6283 "map_bit": 0,
6284 "depends_on_map_bits": [
6285 ]
6286 }
6287 ]
6288 },
6289 {
6290 "rows_estimation": [
6291 {
6292 "table": "`t1`",
6293 "table_scan": {
6294 "rows": 500,
6295 "cost": 1.11035
6296 }
6297 }
6298 ]
6299 },
6300 {
6301 "considered_execution_plans": [
6302 {
6303 "plan_prefix": [
6304 ],
6305 "table": "`t1`",
6306 "best_access_path": {
6307 "considered_access_paths": [
6308 {
6309 "rows_to_scan": 500,
6310 "access_type": "scan",
6311 "resulting_rows": 500,
6312 "cost": 51.1104,
6313 "chosen": true
6314 }
6315 ]
6316 },
6317 "condition_filtering_pct": 100,
6318 "rows_for_plan": 500,
6319 "cost_for_plan": 51.1104,
6320 "chosen": true
6321 }
6322 ]
6323 },
6324 {
6325 "attaching_conditions_to_tables": {
6326 "original_condition": null,
6327 "attached_conditions_computation": [
6328 ],
6329 "attached_conditions_summary": [
6330 {
6331 "table": "`t1`",
6332 "attached": null
6333 }
6334 ]
6335 }
6336 },
6337 {
6338 "optimizing_distinct_group_by_order_by": {
6339 "simplifying_order_by": {
6340 "original_clause": "`t1`.`f2`,`t1`.`f0`",
6341 "items": [
6342 {
6343 "item": "`t1`.`f2`"
6344 },
6345 {
6346 "item": "`t1`.`f0`"
6347 }
6348 ],
6349 "resulting_clause_is_simple": true,
6350 "resulting_clause": "`t1`.`f2`,`t1`.`f0`"
6351 }
6352 }
6353 },
6354 {
6355 "finalizing_table_conditions": [
6356 ]
6357 },
6358 {
6359 "refine_plan": [
6360 {
6361 "table": "`t1`"
6362 }
6363 ]
6364 },
6365 {
6366 "considering_tmp_tables": [
6367 {
6368 "adding_sort_to_table": "t1"
6369 }
6370 ]
6371 }
6372 ]
6373 }
6374 },
6375 {
6376 "condition_processing": {
6377 "condition": "WHERE",
6378 "original_condition": "(`v1`.`f1` = `v2`.`f1`)",
6379 "steps": [
6380 {
6381 "transformation": "equality_propagation",
6382 "resulting_condition": "multiple equal(`v1`.`f1`, `v2`.`f1`)"
6383 },
6384 {
6385 "transformation": "constant_propagation",
6386 "resulting_condition": "multiple equal(`v1`.`f1`, `v2`.`f1`)"
6387 },
6388 {
6389 "transformation": "trivial_condition_removal",
6390 "resulting_condition": "multiple equal(`v1`.`f1`, `v2`.`f1`)"
6391 }
6392 ]
6393 }
6394 },
6395 {
6396 "substitute_generated_columns": {
6397 }
6398 },
6399 {
6400 "table_dependencies": [
6401 {
6402 "table": "`v1`",
6403 "row_may_be_null": false,
6404 "map_bit": 0,
6405 "depends_on_map_bits": [
6406 ]
6407 },
6408 {
6409 "table": "`v2`",
6410 "row_may_be_null": false,
6411 "map_bit": 1,
6412 "depends_on_map_bits": [
6413 ]
6414 }
6415 ]
6416 },
6417 {
6418 "ref_optimizer_key_uses": [
6419 {
6420 "table": "`v1`",
6421 "field": "f1",
6422 "equals": "`v2`.`f1`",
6423 "null_rejecting": true
6424 },
6425 {
6426 "table": "`v1`",
6427 "field": "f1",
6428 "equals": "`v2`.`f1`",
6429 "null_rejecting": true
6430 },
6431 {
6432 "table": "`v2`",
6433 "field": "f1",
6434 "equals": "`v1`.`f1`",
6435 "null_rejecting": true
6436 },
6437 {
6438 "table": "`v2`",
6439 "field": "f1",
6440 "equals": "`v1`.`f1`",
6441 "null_rejecting": true
6442 }
6443 ]
6444 },
6445 {
6446 "rows_estimation": [
6447 {
6448 "table": "`v1`",
6449 "table_scan": {
6450 "rows": 100,
6451 "cost": 3.75
6452 }
6453 },
6454 {
6455 "table": "`v2`",
6456 "table_scan": {
6457 "rows": 100,
6458 "cost": 3.75
6459 }
6460 }
6461 ]
6462 },
6463 {
6464 "considered_execution_plans": [
6465 {
6466 "plan_prefix": [
6467 ],
6468 "table": "`v1`",
6469 "best_access_path": {
6470 "considered_access_paths": [
6471 {
6472 "access_type": "ref",
6473 "index": "<auto_key0>",
6474 "usable": false,
6475 "chosen": false
6476 },
6477 {
6478 "access_type": "ref",
6479 "index": "<auto_key1>",
6480 "usable": false,
6481 "chosen": false
6482 },
6483 {
6484 "rows_to_scan": 100,
6485 "filtering_effect": [
6486 ],
6487 "final_filtering_effect": 1,
6488 "access_type": "scan",
6489 "resulting_rows": 100,
6490 "cost": 13.75,
6491 "chosen": true
6492 }
6493 ]
6494 },
6495 "condition_filtering_pct": 100,
6496 "rows_for_plan": 100,
6497 "cost_for_plan": 13.75,
6498 "rest_of_plan": [
6499 {
6500 "plan_prefix": [
6501 "`v1`"
6502 ],
6503 "table": "`v2`",
6504 "best_access_path": {
6505 "considered_access_paths": [
6506 {
6507 "access_type": "ref",
6508 "index": "<auto_key0>",
6509 "rows": 10,
6510 "cost": 350,
6511 "chosen": true
6512 },
6513 {
6514 "access_type": "ref",
6515 "index": "<auto_key1>",
6516 "rows": 10,
6517 "cost": 350,
6518 "chosen": false
6519 },
6520 {
6521 "rows_to_scan": 100,
6522 "filtering_effect": [
6523 ],
6524 "final_filtering_effect": 1,
6525 "access_type": "scan",
6526 "using_join_cache": true,
6527 "buffers_needed": 1,
6528 "resulting_rows": 100,
6529 "cost": 1004.05,
6530 "chosen": false
6531 }
6532 ]
6533 },
6534 "condition_filtering_pct": 100,
6535 "rows_for_plan": 1000,
6536 "cost_for_plan": 363.75,
6537 "chosen": true
6538 }
6539 ]
6540 },
6541 {
6542 "plan_prefix": [
6543 ],
6544 "table": "`v2`",
6545 "best_access_path": {
6546 "considered_access_paths": [
6547 {
6548 "access_type": "ref",
6549 "index": "<auto_key0>",
6550 "usable": false,
6551 "chosen": false
6552 },
6553 {
6554 "access_type": "ref",
6555 "index": "<auto_key1>",
6556 "usable": false,
6557 "chosen": false
6558 },
6559 {
6560 "rows_to_scan": 100,
6561 "filtering_effect": [
6562 ],
6563 "final_filtering_effect": 1,
6564 "access_type": "scan",
6565 "resulting_rows": 100,
6566 "cost": 13.75,
6567 "chosen": true
6568 }
6569 ]
6570 },
6571 "condition_filtering_pct": 100,
6572 "rows_for_plan": 100,
6573 "cost_for_plan": 13.75,
6574 "rest_of_plan": [
6575 {
6576 "plan_prefix": [
6577 "`v2`"
6578 ],
6579 "table": "`v1`",
6580 "best_access_path": {
6581 "considered_access_paths": [
6582 {
6583 "access_type": "ref",
6584 "index": "<auto_key0>",
6585 "rows": 10,
6586 "cost": 350,
6587 "chosen": true
6588 },
6589 {
6590 "access_type": "ref",
6591 "index": "<auto_key1>",
6592 "rows": 10,
6593 "cost": 350,
6594 "chosen": false
6595 },
6596 {
6597 "rows_to_scan": 100,
6598 "filtering_effect": [
6599 ],
6600 "final_filtering_effect": 1,
6601 "access_type": "scan",
6602 "using_join_cache": true,
6603 "buffers_needed": 1,
6604 "resulting_rows": 100,
6605 "cost": 1004.05,
6606 "chosen": false
6607 }
6608 ]
6609 },
6610 "condition_filtering_pct": 100,
6611 "rows_for_plan": 1000,
6612 "cost_for_plan": 363.75,
6613 "pruned_by_cost": true
6614 }
6615 ]
6616 }
6617 ]
6618 },
6619 {
6620 "attaching_conditions_to_tables": {
6621 "original_condition": "(`v2`.`f1` = `v1`.`f1`)",
6622 "attached_conditions_computation": [
6623 ],
6624 "attached_conditions_summary": [
6625 {
6626 "table": "`v1`",
6627 "attached": "(`v1`.`f1` is not null)"
6628 },
6629 {
6630 "table": "`v2`",
6631 "attached": "(`v2`.`f1` = `v1`.`f1`)"
6632 }
6633 ]
6634 }
6635 },
6636 {
6637 "optimizing_distinct_group_by_order_by": {
6638 "simplifying_order_by": {
6639 "original_clause": "`v1`.`f2`,`v1`.`f0`,`v2`.`f0`",
6640 "items": [
6641 {
6642 "item": "`v1`.`f2`"
6643 },
6644 {
6645 "item": "`v1`.`f0`"
6646 },
6647 {
6648 "item": "`v2`.`f0`"
6649 }
6650 ],
6651 "resulting_clause_is_simple": false,
6652 "resulting_clause": "`v1`.`f2`,`v1`.`f0`,`v2`.`f0`"
6653 }
6654 }
6655 },
6656 {
6657 "finalizing_table_conditions": [
6658 {
6659 "table": "`v1`",
6660 "original_table_condition": "(`v1`.`f1` is not null)",
6661 "final_table_condition ": "(`v1`.`f1` is not null)"
6662 },
6663 {
6664 "table": "`v2`",
6665 "original_table_condition": "(`v2`.`f1` = `v1`.`f1`)",
6666 "final_table_condition ": null
6667 }
6668 ]
6669 },
6670 {
6671 "refine_plan": [
6672 {
6673 "table": "`v1`"
6674 },
6675 {
6676 "table": "`v2`"
6677 }
6678 ]
6679 },
6680 {
6681 "considering_tmp_tables": [
6682 {
6683 "adding_tmp_table_in_plan_at_position": 2,
6684 "write_method": "write_all_rows"
6685 },
6686 {
6687 "adding_sort_to_table": ""
6688 }
6689 ]
6690 }
6691 ]
6692 }
6693 },
6694 {
6695 "join_execution": {
6696 "select#": 1,
6697 "steps": [
6698 {
6699 "creating_tmp_table": {
6700 "tmp_table_info": {
6701 "table": "`v1`",
6702 "in_plan_at_position": 0,
6703 "columns": 3,
6704 "row_length": 210,
6705 "key_length": 0,
6706 "unique_constraint": false,
6707 "makes_grouped_rows": false,
6708 "cannot_insert_duplicates": false,
6709 "location": "TempTable"
6710 }
6711 }
6712 },
6713 {
6714 "materialize": {
6715 "select#": 2,
6716 "steps": [
6717 {
6718 "sorting_table": "t1",
6719 "filesort_information": [
6720 {
6721 "direction": "asc",
6722 "expression": "`t1`.`f1`"
6723 },
6724 {
6725 "direction": "asc",
6726 "expression": "`t1`.`f0`"
6727 }
6728 ],
6729 "filesort_priority_queue_optimization": {
6730 "limit": 100,
6731 "chosen": true
6732 },
6733 "filesort_execution": [
6734 ],
6735 "filesort_summary": {
6736 "memory_available": 327680,
6737 "key_size": 17,
6738 "row_size": 227,
6739 "max_rows_per_buffer": 101,
6740 "num_rows_estimate": 500,
6741 "num_rows_found": 500,
6742 "num_initial_chunks_spilled_to_disk": 0,
6743 "peak_memory_used": "NNN",
6744 "sort_algorithm": "std::stable_sort",
6745 "unpacked_addon_fields": "using_priority_queue",
6746 "sort_mode": "<fixed_sort_key, additional_fields>"
6747 }
6748 }
6749 ]
6750 }
6751 },
6752 {
6753 "sorting_table": "<temporary>",
6754 "filesort_information": [
6755 {
6756 "direction": "asc",
6757 "expression": "`v1`.`f2`"
6758 },
6759 {
6760 "direction": "asc",
6761 "expression": "`v1`.`f0`"
6762 },
6763 {
6764 "direction": "asc",
6765 "expression": "`v2`.`f0`"
6766 }
6767 ],
6768 "filesort_priority_queue_optimization": {
6769 "limit": 30,
6770 "chosen": true
6771 },
6772 "filesort_execution": [
6773 {
6774 "creating_tmp_table": {
6775 "tmp_table_info": {
6776 "table": "`v2`",
6777 "in_plan_at_position": 1,
6778 "columns": 3,
6779 "row_length": 210,
6780 "key_length": 5,
6781 "unique_constraint": false,
6782 "makes_grouped_rows": false,
6783 "cannot_insert_duplicates": false,
6784 "location": "TempTable"
6785 }
6786 }
6787 },
6788 {
6789 "materialize": {
6790 "select#": 3,
6791 "steps": [
6792 {
6793 "sorting_table": "t1",
6794 "filesort_information": [
6795 {
6796 "direction": "asc",
6797 "expression": "`t1`.`f2`"
6798 },
6799 {
6800 "direction": "asc",
6801 "expression": "`t1`.`f0`"
6802 }
6803 ],
6804 "filesort_priority_queue_optimization": {
6805 "limit": 100,
6806 "chosen": true
6807 },
6808 "filesort_execution": [
6809 ],
6810 "filesort_summary": {
6811 "memory_available": 327680,
6812 "key_size": 209,
6813 "row_size": 419,
6814 "max_rows_per_buffer": 101,
6815 "num_rows_estimate": 500,
6816 "num_rows_found": 500,
6817 "num_initial_chunks_spilled_to_disk": 0,
6818 "peak_memory_used": "NNN",
6819 "sort_algorithm": "std::stable_sort",
6820 "unpacked_addon_fields": "using_priority_queue",
6821 "sort_mode": "<fixed_sort_key, additional_fields>"
6822 }
6823 }
6824 ]
6825 }
6826 }
6827 ],
6828 "filesort_summary": {
6829 "memory_available": 327680,
6830 "key_size": 217,
6831 "row_size": 636,
6832 "max_rows_per_buffer": 31,
6833 "num_rows_estimate": 10000,
6834 "num_rows_found": 325,
6835 "num_initial_chunks_spilled_to_disk": 0,
6836 "peak_memory_used": "NNN",
6837 "sort_algorithm": "std::sort",
6838 "unpacked_addon_fields": "using_priority_queue",
6839 "sort_mode": "<fixed_sort_key, additional_fields>"
6840 }
6841 }
6842 ]
6843 }
6844 }
6845 ]
6846 } 0 0
6847 SELECT floor(f1/10) f3, count(f2) FROM t1
6848 GROUP BY 1 ORDER BY 2,1 LIMIT 5;
6849 f3 count(f2)
6850 0 50
6851 1 50
6852 2 50
6853 3 50
6854 4 50
6855 SELECT * FROM information_schema.OPTIMIZER_TRACE;
6856 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
6857 SELECT floor(f1/10) f3, count(f2) FROM t1
6858 GROUP BY 1 ORDER BY 2,1 LIMIT 5 {
6859 "steps": [
6860 {
6861 "join_preparation": {
6862 "select#": 1,
6863 "steps": [
6864 {
6865 "expanded_query": "/* select#1 */ select floor((`t1`.`f1` / 10)) AS `f3`,count(`t1`.`f2`) AS `count(f2)` from `t1` group by floor((`t1`.`f1` / 10)) order by count(`t1`.`f2`),floor((`t1`.`f1` / 10)) limit 5"
6866 }
6867 ]
6868 }
6869 },
6870 {
6871 "join_optimization": {
6872 "select#": 1,
6873 "steps": [
6874 {
6875 "substitute_generated_columns": {
6876 }
6877 },
6878 {
6879 "table_dependencies": [
6880 {
6881 "table": "`t1`",
6882 "row_may_be_null": false,
6883 "map_bit": 0,
6884 "depends_on_map_bits": [
6885 ]
6886 }
6887 ]
6888 },
6889 {
6890 "rows_estimation": [
6891 {
6892 "table": "`t1`",
6893 "table_scan": {
6894 "rows": 500,
6895 "cost": 1.11035
6896 }
6897 }
6898 ]
6899 },
6900 {
6901 "considered_execution_plans": [
6902 {
6903 "plan_prefix": [
6904 ],
6905 "table": "`t1`",
6906 "best_access_path": {
6907 "considered_access_paths": [
6908 {
6909 "rows_to_scan": 500,
6910 "access_type": "scan",
6911 "resulting_rows": 500,
6912 "cost": 51.1104,
6913 "chosen": true
6914 }
6915 ]
6916 },
6917 "condition_filtering_pct": 100,
6918 "rows_for_plan": 500,
6919 "cost_for_plan": 51.1104,
6920 "chosen": true
6921 }
6922 ]
6923 },
6924 {
6925 "attaching_conditions_to_tables": {
6926 "original_condition": null,
6927 "attached_conditions_computation": [
6928 ],
6929 "attached_conditions_summary": [
6930 {
6931 "table": "`t1`",
6932 "attached": null
6933 }
6934 ]
6935 }
6936 },
6937 {
6938 "optimizing_distinct_group_by_order_by": {
6939 "simplifying_order_by": {
6940 "original_clause": "count(`t1`.`f2`),floor((`t1`.`f1` / 10))",
6941 "items": [
6942 {
6943 "item": "count(`t1`.`f2`)"
6944 },
6945 {
6946 "item": "floor((`t1`.`f1` / 10))"
6947 }
6948 ],
6949 "resulting_clause_is_simple": false,
6950 "resulting_clause": "count(`t1`.`f2`),floor((`t1`.`f1` / 10))"
6951 },
6952 "simplifying_group_by": {
6953 "original_clause": "floor((`t1`.`f1` / 10))",
6954 "items": [
6955 {
6956 "item": "floor((`t1`.`f1` / 10))"
6957 }
6958 ],
6959 "resulting_clause_is_simple": true,
6960 "resulting_clause": "floor((`t1`.`f1` / 10))"
6961 }
6962 }
6963 },
6964 {
6965 "finalizing_table_conditions": [
6966 ]
6967 },
6968 {
6969 "refine_plan": [
6970 {
6971 "table": "`t1`"
6972 }
6973 ]
6974 },
6975 {
6976 "considering_tmp_tables": [
6977 {
6978 "adding_tmp_table_in_plan_at_position": 1,
6979 "write_method": "continuously_update_group_row"
6980 },
6981 {
6982 "adding_sort_to_table": ""
6983 }
6984 ]
6985 }
6986 ]
6987 }
6988 },
6989 {
6990 "join_execution": {
6991 "select#": 1,
6992 "steps": [
6993 {
6994 "temp_table_aggregate": {
6995 "select#": 1,
6996 "steps": [
6997 {
6998 "creating_tmp_table": {
6999 "tmp_table_info": {
7000 "table": "<temporary>",
7001 "in_plan_at_position": 1,
7002 "columns": 2,
7003 "row_length": 18,
7004 "key_length": 9,
7005 "unique_constraint": false,
7006 "makes_grouped_rows": true,
7007 "cannot_insert_duplicates": false,
7008 "location": "TempTable"
7009 }
7010 }
7011 }
7012 ]
7013 }
7014 },
7015 {
7016 "sorting_table": "<temporary>",
7017 "filesort_information": [
7018 {
7019 "direction": "asc",
7020 "expression": "`count(f2)`"
7021 },
7022 {
7023 "direction": "asc",
7024 "expression": "`f3`"
7025 }
7026 ],
7027 "filesort_priority_queue_optimization": {
7028 "limit": 5,
7029 "chosen": true
7030 },
7031 "filesort_execution": [
7032 ],
7033 "filesort_summary": {
7034 "memory_available": 327680,
7035 "key_size": 17,
7036 "row_size": 34,
7037 "max_rows_per_buffer": 6,
7038 "num_rows_estimate": 18446744073709551615,
7039 "num_rows_found": 10,
7040 "num_initial_chunks_spilled_to_disk": 0,
7041 "peak_memory_used": "NNN",
7042 "sort_algorithm": "std::sort",
7043 "unpacked_addon_fields": "using_priority_queue",
7044 "sort_mode": "<fixed_sort_key, additional_fields>"
7045 }
7046 }
7047 ]
7048 }
7049 }
7050 ]
7051 } 0 0
7052 SELECT floor(f1/10) f3, count(f2) FROM t1
7053 GROUP BY 1 ORDER BY 2,1 LIMIT 0;
7054 f3 count(f2)
7055 SELECT * FROM information_schema.OPTIMIZER_TRACE;
7056 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
7057 SELECT floor(f1/10) f3, count(f2) FROM t1
7058 GROUP BY 1 ORDER BY 2,1 LIMIT 0 {
7059 "steps": [
7060 {
7061 "join_preparation": {
7062 "select#": 1,
7063 "steps": [
7064 {
7065 "expanded_query": "/* select#1 */ select floor((`t1`.`f1` / 10)) AS `f3`,count(`t1`.`f2`) AS `count(f2)` from `t1` group by floor((`t1`.`f1` / 10)) order by count(`t1`.`f2`),floor((`t1`.`f1` / 10)) limit 0"
7066 }
7067 ]
7068 }
7069 },
7070 {
7071 "join_optimization": {
7072 "select#": 1,
7073 "steps": [
7074 ],
7075 "empty_result": {
7076 "cause": "Zero limit"
7077 }
7078 }
7079 },
7080 {
7081 "join_execution": {
7082 "select#": 1,
7083 "steps": [
7084 ]
7085 }
7086 }
7087 ]
7088 } 0 0
7089 CREATE PROCEDURE wl1393_sp_test()
7090 BEGIN
7091 SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 30;
7092 SELECT * FROM information_schema.OPTIMIZER_TRACE;
7093 SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 15 OFFSET 15;
7094 SELECT * FROM information_schema.OPTIMIZER_TRACE;
7095 SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE f1>10
7096 ORDER BY f2, f0 LIMIT 15 OFFSET 15;
7097 SELECT * FROM information_schema.OPTIMIZER_TRACE;
7098 SELECT FOUND_ROWS();
7099 SELECT * FROM v1 ORDER BY f2, f0 LIMIT 30;
7100 SELECT * FROM information_schema.OPTIMIZER_TRACE;
7101 END|
7102 Warnings:
7103 Warning 1287 SQL_CALC_FOUND_ROWS is deprecated and will be removed in a future release. Consider using two separate queries instead.
7104 Warning 1287 FOUND_ROWS() is deprecated and will be removed in a future release. Consider using COUNT(*) instead.
7105 CALL wl1393_sp_test()|
7106 f0 f1 f2
7107 12 11 11
7108 112 11 11
7109 212 11 11
7110 312 11 11
7111 412 11 11
7112 13 12 12
7113 113 12 12
7114 213 12 12
7115 313 12 12
7116 413 12 12
7117 14 13 13
7118 114 13 13
7119 214 13 13
7120 314 13 13
7121 414 13 13
7122 15 14 14
7123 115 14 14
7124 215 14 14
7125 315 14 14
7126 415 14 14
7127 16 15 15
7128 116 15 15
7129 216 15 15
7130 316 15 15
7131 416 15 15
7132 17 16 16
7133 117 16 16
7134 217 16 16
7135 317 16 16
7136 417 16 16
7137 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
7138 SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 30 {
7139 "steps": [
7140 {
7141 "join_preparation": {
7142 "select#": 1,
7143 "steps": [
7144 {
7145 "expanded_query": "/* select#1 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` where (`t1`.`f1` > 10) order by `t1`.`f2`,`t1`.`f0` limit 30"
7146 }
7147 ]
7148 }
7149 },
7150 {
7151 "join_optimization": {
7152 "select#": 1,
7153 "steps": [
7154 {
7155 "condition_processing": {
7156 "condition": "WHERE",
7157 "original_condition": "(`t1`.`f1` > 10)",
7158 "steps": [
7159 {
7160 "transformation": "equality_propagation",
7161 "resulting_condition": "(`t1`.`f1` > 10)"
7162 },
7163 {
7164 "transformation": "constant_propagation",
7165 "resulting_condition": "(`t1`.`f1` > 10)"
7166 },
7167 {
7168 "transformation": "trivial_condition_removal",
7169 "resulting_condition": "(`t1`.`f1` > 10)"
7170 }
7171 ]
7172 }
7173 },
7174 {
7175 "substitute_generated_columns": {
7176 }
7177 },
7178 {
7179 "table_dependencies": [
7180 {
7181 "table": "`t1`",
7182 "row_may_be_null": false,
7183 "map_bit": 0,
7184 "depends_on_map_bits": [
7185 ]
7186 }
7187 ]
7188 },
7189 {
7190 "ref_optimizer_key_uses": [
7191 ]
7192 },
7193 {
7194 "rows_estimation": [
7195 {
7196 "table": "`t1`",
7197 "table_scan": {
7198 "rows": 500,
7199 "cost": 1.11035
7200 }
7201 }
7202 ]
7203 },
7204 {
7205 "considered_execution_plans": [
7206 {
7207 "plan_prefix": [
7208 ],
7209 "table": "`t1`",
7210 "best_access_path": {
7211 "considered_access_paths": [
7212 {
7213 "rows_to_scan": 500,
7214 "filtering_effect": [
7215 ],
7216 "final_filtering_effect": 0.3333,
7217 "access_type": "scan",
7218 "resulting_rows": 166.65,
7219 "cost": 51.1104,
7220 "chosen": true
7221 }
7222 ]
7223 },
7224 "condition_filtering_pct": 100,
7225 "rows_for_plan": 166.65,
7226 "cost_for_plan": 51.1104,
7227 "chosen": true
7228 }
7229 ]
7230 },
7231 {
7232 "attaching_conditions_to_tables": {
7233 "original_condition": "(`t1`.`f1` > 10)",
7234 "attached_conditions_computation": [
7235 ],
7236 "attached_conditions_summary": [
7237 {
7238 "table": "`t1`",
7239 "attached": "(`t1`.`f1` > 10)"
7240 }
7241 ]
7242 }
7243 },
7244 {
7245 "optimizing_distinct_group_by_order_by": {
7246 "simplifying_order_by": {
7247 "original_clause": "`t1`.`f2`,`t1`.`f0`",
7248 "items": [
7249 {
7250 "item": "`t1`.`f2`"
7251 },
7252 {
7253 "item": "`t1`.`f0`"
7254 }
7255 ],
7256 "resulting_clause_is_simple": true,
7257 "resulting_clause": "`t1`.`f2`,`t1`.`f0`"
7258 }
7259 }
7260 },
7261 {
7262 "finalizing_table_conditions": [
7263 {
7264 "table": "`t1`",
7265 "original_table_condition": "(`t1`.`f1` > 10)",
7266 "final_table_condition ": "(`t1`.`f1` > 10)"
7267 }
7268 ]
7269 },
7270 {
7271 "refine_plan": [
7272 {
7273 "table": "`t1`"
7274 }
7275 ]
7276 },
7277 {
7278 "considering_tmp_tables": [
7279 {
7280 "adding_sort_to_table": "t1"
7281 }
7282 ]
7283 }
7284 ]
7285 }
7286 },
7287 {
7288 "join_execution": {
7289 "select#": 1,
7290 "steps": [
7291 {
7292 "sorting_table": "t1",
7293 "filesort_information": [
7294 {
7295 "direction": "asc",
7296 "expression": "`t1`.`f2`"
7297 },
7298 {
7299 "direction": "asc",
7300 "expression": "`t1`.`f0`"
7301 }
7302 ],
7303 "filesort_priority_queue_optimization": {
7304 "limit": 30,
7305 "chosen": true
7306 },
7307 "filesort_execution": [
7308 ],
7309 "filesort_summary": {
7310 "memory_available": 327680,
7311 "key_size": 209,
7312 "row_size": 419,
7313 "max_rows_per_buffer": 31,
7314 "num_rows_estimate": 500,
7315 "num_rows_found": 445,
7316 "num_initial_chunks_spilled_to_disk": 0,
7317 "peak_memory_used": "NNN",
7318 "sort_algorithm": "std::sort",
7319 "unpacked_addon_fields": "using_priority_queue",
7320 "sort_mode": "<fixed_sort_key, additional_fields>"
7321 }
7322 }
7323 ]
7324 }
7325 }
7326 ]
7327 } 0 0
7328 f0 f1 f2
7329 15 14 14
7330 115 14 14
7331 215 14 14
7332 315 14 14
7333 415 14 14
7334 16 15 15
7335 116 15 15
7336 216 15 15
7337 316 15 15
7338 416 15 15
7339 17 16 16
7340 117 16 16
7341 217 16 16
7342 317 16 16
7343 417 16 16
7344 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
7345 SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 15 OFFSET 15 {
7346 "steps": [
7347 {
7348 "join_preparation": {
7349 "select#": 1,
7350 "steps": [
7351 {
7352 "expanded_query": "/* select#1 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` where (`t1`.`f1` > 10) order by `t1`.`f2`,`t1`.`f0` limit 15,15"
7353 }
7354 ]
7355 }
7356 },
7357 {
7358 "join_optimization": {
7359 "select#": 1,
7360 "steps": [
7361 {
7362 "condition_processing": {
7363 "condition": "WHERE",
7364 "original_condition": "(`t1`.`f1` > 10)",
7365 "steps": [
7366 {
7367 "transformation": "equality_propagation",
7368 "resulting_condition": "(`t1`.`f1` > 10)"
7369 },
7370 {
7371 "transformation": "constant_propagation",
7372 "resulting_condition": "(`t1`.`f1` > 10)"
7373 },
7374 {
7375 "transformation": "trivial_condition_removal",
7376 "resulting_condition": "(`t1`.`f1` > 10)"
7377 }
7378 ]
7379 }
7380 },
7381 {
7382 "substitute_generated_columns": {
7383 }
7384 },
7385 {
7386 "table_dependencies": [
7387 {
7388 "table": "`t1`",
7389 "row_may_be_null": false,
7390 "map_bit": 0,
7391 "depends_on_map_bits": [
7392 ]
7393 }
7394 ]
7395 },
7396 {
7397 "ref_optimizer_key_uses": [
7398 ]
7399 },
7400 {
7401 "rows_estimation": [
7402 {
7403 "table": "`t1`",
7404 "table_scan": {
7405 "rows": 500,
7406 "cost": 1.11035
7407 }
7408 }
7409 ]
7410 },
7411 {
7412 "considered_execution_plans": [
7413 {
7414 "plan_prefix": [
7415 ],
7416 "table": "`t1`",
7417 "best_access_path": {
7418 "considered_access_paths": [
7419 {
7420 "rows_to_scan": 500,
7421 "filtering_effect": [
7422 ],
7423 "final_filtering_effect": 0.3333,
7424 "access_type": "scan",
7425 "resulting_rows": 166.65,
7426 "cost": 51.1104,
7427 "chosen": true
7428 }
7429 ]
7430 },
7431 "condition_filtering_pct": 100,
7432 "rows_for_plan": 166.65,
7433 "cost_for_plan": 51.1104,
7434 "chosen": true
7435 }
7436 ]
7437 },
7438 {
7439 "attaching_conditions_to_tables": {
7440 "original_condition": "(`t1`.`f1` > 10)",
7441 "attached_conditions_computation": [
7442 ],
7443 "attached_conditions_summary": [
7444 {
7445 "table": "`t1`",
7446 "attached": "(`t1`.`f1` > 10)"
7447 }
7448 ]
7449 }
7450 },
7451 {
7452 "optimizing_distinct_group_by_order_by": {
7453 "simplifying_order_by": {
7454 "original_clause": "`t1`.`f2`,`t1`.`f0`",
7455 "items": [
7456 {
7457 "item": "`t1`.`f2`"
7458 },
7459 {
7460 "item": "`t1`.`f0`"
7461 }
7462 ],
7463 "resulting_clause_is_simple": true,
7464 "resulting_clause": "`t1`.`f2`,`t1`.`f0`"
7465 }
7466 }
7467 },
7468 {
7469 "finalizing_table_conditions": [
7470 {
7471 "table": "`t1`",
7472 "original_table_condition": "(`t1`.`f1` > 10)",
7473 "final_table_condition ": "(`t1`.`f1` > 10)"
7474 }
7475 ]
7476 },
7477 {
7478 "refine_plan": [
7479 {
7480 "table": "`t1`"
7481 }
7482 ]
7483 },
7484 {
7485 "considering_tmp_tables": [
7486 {
7487 "adding_sort_to_table": "t1"
7488 }
7489 ]
7490 }
7491 ]
7492 }
7493 },
7494 {
7495 "join_execution": {
7496 "select#": 1,
7497 "steps": [
7498 {
7499 "sorting_table": "t1",
7500 "filesort_information": [
7501 {
7502 "direction": "asc",
7503 "expression": "`t1`.`f2`"
7504 },
7505 {
7506 "direction": "asc",
7507 "expression": "`t1`.`f0`"
7508 }
7509 ],
7510 "filesort_priority_queue_optimization": {
7511 "limit": 30,
7512 "chosen": true
7513 },
7514 "filesort_execution": [
7515 ],
7516 "filesort_summary": {
7517 "memory_available": 327680,
7518 "key_size": 209,
7519 "row_size": 419,
7520 "max_rows_per_buffer": 31,
7521 "num_rows_estimate": 500,
7522 "num_rows_found": 445,
7523 "num_initial_chunks_spilled_to_disk": 0,
7524 "peak_memory_used": "NNN",
7525 "sort_algorithm": "std::sort",
7526 "unpacked_addon_fields": "using_priority_queue",
7527 "sort_mode": "<fixed_sort_key, additional_fields>"
7528 }
7529 }
7530 ]
7531 }
7532 }
7533 ]
7534 } 0 0
7535 f0 f1 f2
7536 15 14 14
7537 115 14 14
7538 215 14 14
7539 315 14 14
7540 415 14 14
7541 16 15 15
7542 116 15 15
7543 216 15 15
7544 316 15 15
7545 416 15 15
7546 17 16 16
7547 117 16 16
7548 217 16 16
7549 317 16 16
7550 417 16 16
7551 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
7552 SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE f1>10
7553 ORDER BY f2, f0 LIMIT 15 OFFSET 15 {
7554 "steps": [
7555 {
7556 "join_preparation": {
7557 "select#": 1,
7558 "steps": [
7559 {
7560 "expanded_query": "/* select#1 */ select sql_calc_found_rows `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` where (`t1`.`f1` > 10) order by `t1`.`f2`,`t1`.`f0` limit 15,15"
7561 }
7562 ]
7563 }
7564 },
7565 {
7566 "join_optimization": {
7567 "select#": 1,
7568 "steps": [
7569 {
7570 "condition_processing": {
7571 "condition": "WHERE",
7572 "original_condition": "(`t1`.`f1` > 10)",
7573 "steps": [
7574 {
7575 "transformation": "equality_propagation",
7576 "resulting_condition": "(`t1`.`f1` > 10)"
7577 },
7578 {
7579 "transformation": "constant_propagation",
7580 "resulting_condition": "(`t1`.`f1` > 10)"
7581 },
7582 {
7583 "transformation": "trivial_condition_removal",
7584 "resulting_condition": "(`t1`.`f1` > 10)"
7585 }
7586 ]
7587 }
7588 },
7589 {
7590 "substitute_generated_columns": {
7591 }
7592 },
7593 {
7594 "table_dependencies": [
7595 {
7596 "table": "`t1`",
7597 "row_may_be_null": false,
7598 "map_bit": 0,
7599 "depends_on_map_bits": [
7600 ]
7601 }
7602 ]
7603 },
7604 {
7605 "ref_optimizer_key_uses": [
7606 ]
7607 },
7608 {
7609 "rows_estimation": [
7610 {
7611 "table": "`t1`",
7612 "table_scan": {
7613 "rows": 500,
7614 "cost": 1.11035
7615 }
7616 }
7617 ]
7618 },
7619 {
7620 "considered_execution_plans": [
7621 {
7622 "plan_prefix": [
7623 ],
7624 "table": "`t1`",
7625 "best_access_path": {
7626 "considered_access_paths": [
7627 {
7628 "rows_to_scan": 500,
7629 "filtering_effect": [
7630 ],
7631 "final_filtering_effect": 0.3333,
7632 "access_type": "scan",
7633 "resulting_rows": 166.65,
7634 "cost": 51.1104,
7635 "chosen": true
7636 }
7637 ]
7638 },
7639 "condition_filtering_pct": 100,
7640 "rows_for_plan": 166.65,
7641 "cost_for_plan": 51.1104,
7642 "chosen": true
7643 }
7644 ]
7645 },
7646 {
7647 "attaching_conditions_to_tables": {
7648 "original_condition": "(`t1`.`f1` > 10)",
7649 "attached_conditions_computation": [
7650 ],
7651 "attached_conditions_summary": [
7652 {
7653 "table": "`t1`",
7654 "attached": "(`t1`.`f1` > 10)"
7655 }
7656 ]
7657 }
7658 },
7659 {
7660 "optimizing_distinct_group_by_order_by": {
7661 "simplifying_order_by": {
7662 "original_clause": "`t1`.`f2`,`t1`.`f0`",
7663 "items": [
7664 {
7665 "item": "`t1`.`f2`"
7666 },
7667 {
7668 "item": "`t1`.`f0`"
7669 }
7670 ],
7671 "resulting_clause_is_simple": true,
7672 "resulting_clause": "`t1`.`f2`,`t1`.`f0`"
7673 }
7674 }
7675 },
7676 {
7677 "finalizing_table_conditions": [
7678 {
7679 "table": "`t1`",
7680 "original_table_condition": "(`t1`.`f1` > 10)",
7681 "final_table_condition ": "(`t1`.`f1` > 10)"
7682 }
7683 ]
7684 },
7685 {
7686 "refine_plan": [
7687 {
7688 "table": "`t1`"
7689 }
7690 ]
7691 },
7692 {
7693 "considering_tmp_tables": [
7694 {
7695 "adding_sort_to_table": "t1"
7696 }
7697 ]
7698 }
7699 ]
7700 }
7701 },
7702 {
7703 "join_execution": {
7704 "select#": 1,
7705 "steps": [
7706 {
7707 "sorting_table": "t1",
7708 "filesort_information": [
7709 {
7710 "direction": "asc",
7711 "expression": "`t1`.`f2`"
7712 },
7713 {
7714 "direction": "asc",
7715 "expression": "`t1`.`f0`"
7716 }
7717 ],
7718 "filesort_priority_queue_optimization": {
7719 "usable": false,
7720 "cause": "not applicable (no LIMIT)"
7721 },
7722 "filesort_execution": [
7723 ],
7724 "filesort_summary": {
7725 "memory_available": 327680,
7726 "key_size": 209,
7727 "row_size": 423,
7728 "max_rows_per_buffer": 500,
7729 "num_rows_estimate": 500,
7730 "num_rows_found": 445,
7731 "num_initial_chunks_spilled_to_disk": 0,
7732 "peak_memory_used": "NNN",
7733 "sort_algorithm": "std::stable_sort",
7734 "sort_mode": "<fixed_sort_key, packed_additional_fields>"
7735 }
7736 }
7737 ]
7738 }
7739 }
7740 ]
7741 } 0 0
7742 FOUND_ROWS()
7743 1
7744 f0 f1 f2
7745 1 0 0
7746 101 0 0
7747 201 0 0
7748 301 0 0
7749 401 0 0
7750 2 1 1
7751 102 1 1
7752 202 1 1
7753 302 1 1
7754 402 1 1
7755 11 10 10
7756 111 10 10
7757 211 10 10
7758 311 10 10
7759 411 10 10
7760 12 11 11
7761 112 11 11
7762 212 11 11
7763 312 11 11
7764 412 11 11
7765 13 12 12
7766 113 12 12
7767 213 12 12
7768 313 12 12
7769 413 12 12
7770 14 13 13
7771 114 13 13
7772 214 13 13
7773 314 13 13
7774 414 13 13
7775 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
7776 SELECT * FROM v1 ORDER BY f2, f0 LIMIT 30 {
7777 "steps": [
7778 {
7779 "join_preparation": {
7780 "select#": 1,
7781 "steps": [
7782 {
7783 "join_preparation": {
7784 "select#": 2,
7785 "steps": [
7786 {
7787 "expanded_query": "/* select#2 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` order by `t1`.`f1`,`t1`.`f0` limit 100"
7788 }
7789 ]
7790 }
7791 },
7792 {
7793 "view": {
7794 "table": "`v1`",
7795 "select#": 2,
7796 "materialized": true
7797 }
7798 },
7799 {
7800 "expanded_query": "/* select#1 */ select `v1`.`f0` AS `f0`,`v1`.`f1` AS `f1`,`v1`.`f2` AS `f2` from `v1` order by `v1`.`f2`,`v1`.`f0` limit 30"
7801 }
7802 ]
7803 }
7804 },
7805 {
7806 "join_optimization": {
7807 "select#": 1,
7808 "steps": [
7809 {
7810 "join_optimization": {
7811 "select#": 2,
7812 "steps": [
7813 {
7814 "substitute_generated_columns": {
7815 }
7816 },
7817 {
7818 "table_dependencies": [
7819 {
7820 "table": "`t1`",
7821 "row_may_be_null": false,
7822 "map_bit": 0,
7823 "depends_on_map_bits": [
7824 ]
7825 }
7826 ]
7827 },
7828 {
7829 "rows_estimation": [
7830 {
7831 "table": "`t1`",
7832 "table_scan": {
7833 "rows": 500,
7834 "cost": 1.11035
7835 }
7836 }
7837 ]
7838 },
7839 {
7840 "considered_execution_plans": [
7841 {
7842 "plan_prefix": [
7843 ],
7844 "table": "`t1`",
7845 "best_access_path": {
7846 "considered_access_paths": [
7847 {
7848 "rows_to_scan": 500,
7849 "access_type": "scan",
7850 "resulting_rows": 500,
7851 "cost": 51.1104,
7852 "chosen": true
7853 }
7854 ]
7855 },
7856 "condition_filtering_pct": 100,
7857 "rows_for_plan": 500,
7858 "cost_for_plan": 51.1104,
7859 "chosen": true
7860 }
7861 ]
7862 },
7863 {
7864 "attaching_conditions_to_tables": {
7865 "original_condition": null,
7866 "attached_conditions_computation": [
7867 ],
7868 "attached_conditions_summary": [
7869 {
7870 "table": "`t1`",
7871 "attached": null
7872 }
7873 ]
7874 }
7875 },
7876 {
7877 "optimizing_distinct_group_by_order_by": {
7878 "simplifying_order_by": {
7879 "original_clause": "`t1`.`f1`,`t1`.`f0`",
7880 "items": [
7881 {
7882 "item": "`t1`.`f1`"
7883 },
7884 {
7885 "item": "`t1`.`f0`"
7886 }
7887 ],
7888 "resulting_clause_is_simple": true,
7889 "resulting_clause": "`t1`.`f1`,`t1`.`f0`"
7890 }
7891 }
7892 },
7893 {
7894 "finalizing_table_conditions": [
7895 ]
7896 },
7897 {
7898 "refine_plan": [
7899 {
7900 "table": "`t1`"
7901 }
7902 ]
7903 },
7904 {
7905 "considering_tmp_tables": [
7906 {
7907 "adding_sort_to_table": "t1"
7908 }
7909 ]
7910 }
7911 ]
7912 }
7913 },
7914 {
7915 "substitute_generated_columns": {
7916 }
7917 },
7918 {
7919 "table_dependencies": [
7920 {
7921 "table": "`v1`",
7922 "row_may_be_null": false,
7923 "map_bit": 0,
7924 "depends_on_map_bits": [
7925 ]
7926 }
7927 ]
7928 },
7929 {
7930 "rows_estimation": [
7931 {
7932 "table": "`v1`",
7933 "table_scan": {
7934 "rows": 100,
7935 "cost": 3.75
7936 }
7937 }
7938 ]
7939 },
7940 {
7941 "considered_execution_plans": [
7942 {
7943 "plan_prefix": [
7944 ],
7945 "table": "`v1`",
7946 "best_access_path": {
7947 "considered_access_paths": [
7948 {
7949 "rows_to_scan": 100,
7950 "access_type": "scan",
7951 "resulting_rows": 100,
7952 "cost": 13.75,
7953 "chosen": true
7954 }
7955 ]
7956 },
7957 "condition_filtering_pct": 100,
7958 "rows_for_plan": 100,
7959 "cost_for_plan": 13.75,
7960 "chosen": true
7961 }
7962 ]
7963 },
7964 {
7965 "attaching_conditions_to_tables": {
7966 "original_condition": null,
7967 "attached_conditions_computation": [
7968 ],
7969 "attached_conditions_summary": [
7970 {
7971 "table": "`v1`",
7972 "attached": null
7973 }
7974 ]
7975 }
7976 },
7977 {
7978 "optimizing_distinct_group_by_order_by": {
7979 "simplifying_order_by": {
7980 "original_clause": "`v1`.`f2`,`v1`.`f0`",
7981 "items": [
7982 {
7983 "item": "`v1`.`f2`"
7984 },
7985 {
7986 "item": "`v1`.`f0`"
7987 }
7988 ],
7989 "resulting_clause_is_simple": true,
7990 "resulting_clause": "`v1`.`f2`,`v1`.`f0`"
7991 }
7992 }
7993 },
7994 {
7995 "finalizing_table_conditions": [
7996 ]
7997 },
7998 {
7999 "refine_plan": [
8000 {
8001 "table": "`v1`"
8002 }
8003 ]
8004 },
8005 {
8006 "considering_tmp_tables": [
8007 {
8008 "adding_sort_to_table": "v1"
8009 }
8010 ]
8011 }
8012 ]
8013 }
8014 },
8015 {
8016 "join_execution": {
8017 "select#": 1,
8018 "steps": [
8019 {
8020 "creating_tmp_table": {
8021 "tmp_table_info": {
8022 "table": "`v1`",
8023 "in_plan_at_position": 0,
8024 "columns": 3,
8025 "row_length": 210,
8026 "key_length": 0,
8027 "unique_constraint": false,
8028 "makes_grouped_rows": false,
8029 "cannot_insert_duplicates": false,
8030 "location": "TempTable"
8031 }
8032 }
8033 },
8034 {
8035 "materialize": {
8036 "select#": 2,
8037 "steps": [
8038 {
8039 "sorting_table": "t1",
8040 "filesort_information": [
8041 {
8042 "direction": "asc",
8043 "expression": "`t1`.`f1`"
8044 },
8045 {
8046 "direction": "asc",
8047 "expression": "`t1`.`f0`"
8048 }
8049 ],
8050 "filesort_priority_queue_optimization": {
8051 "limit": 100,
8052 "chosen": true
8053 },
8054 "filesort_execution": [
8055 ],
8056 "filesort_summary": {
8057 "memory_available": 327680,
8058 "key_size": 17,
8059 "row_size": 227,
8060 "max_rows_per_buffer": 101,
8061 "num_rows_estimate": 500,
8062 "num_rows_found": 500,
8063 "num_initial_chunks_spilled_to_disk": 0,
8064 "peak_memory_used": "NNN",
8065 "sort_algorithm": "std::stable_sort",
8066 "unpacked_addon_fields": "using_priority_queue",
8067 "sort_mode": "<fixed_sort_key, additional_fields>"
8068 }
8069 }
8070 ]
8071 }
8072 },
8073 {
8074 "sorting_table": "v1",
8075 "filesort_information": [
8076 {
8077 "direction": "asc",
8078 "expression": "`v1`.`f2`"
8079 },
8080 {
8081 "direction": "asc",
8082 "expression": "`v1`.`f0`"
8083 }
8084 ],
8085 "filesort_priority_queue_optimization": {
8086 "limit": 30,
8087 "chosen": true
8088 },
8089 "filesort_execution": [
8090 ],
8091 "filesort_summary": {
8092 "memory_available": 327680,
8093 "key_size": 209,
8094 "row_size": 419,
8095 "max_rows_per_buffer": 31,
8096 "num_rows_estimate": 100,
8097 "num_rows_found": 100,
8098 "num_initial_chunks_spilled_to_disk": 0,
8099 "peak_memory_used": "NNN",
8100 "sort_algorithm": "std::sort",
8101 "unpacked_addon_fields": "using_priority_queue",
8102 "sort_mode": "<fixed_sort_key, additional_fields>"
8103 }
8104 }
8105 ]
8106 }
8107 }
8108 ]
8109 } 0 0
8110 DROP PROCEDURE wl1393_sp_test|
8111 SELECT d1.f1, d1.f2 FROM t1
8112 LEFT JOIN (SELECT * FROM t1 ORDER BY f1 LIMIT 30) d1 on t1.f1=d1.f1
8113 ORDER BY d1.f2 DESC LIMIT 30;
8114 f1 f2
8115 5 5
8116 5 5
8117 5 5
8118 5 5
8119 5 5
8120 5 5
8121 5 5
8122 5 5
8123 5 5
8124 5 5
8125 5 5
8126 5 5
8127 5 5
8128 5 5
8129 5 5
8130 5 5
8131 5 5
8132 5 5
8133 5 5
8134 5 5
8135 5 5
8136 5 5
8137 5 5
8138 5 5
8139 5 5
8140 4 4
8141 4 4
8142 4 4
8143 4 4
8144 4 4
8145 SELECT * FROM information_schema.OPTIMIZER_TRACE;
8146 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
8147 SELECT d1.f1, d1.f2 FROM t1
8148 LEFT JOIN (SELECT * FROM t1 ORDER BY f1 LIMIT 30) d1 on t1.f1=d1.f1
8149 ORDER BY d1.f2 DESC LIMIT 30 {
8150 "steps": [
8151 {
8152 "join_preparation": {
8153 "select#": 1,
8154 "steps": [
8155 {
8156 "join_preparation": {
8157 "select#": 2,
8158 "steps": [
8159 {
8160 "expanded_query": "/* select#2 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` order by `t1`.`f1` limit 30"
8161 }
8162 ]
8163 }
8164 },
8165 {
8166 "derived": {
8167 "table": " `d1`",
8168 "select#": 2,
8169 "materialized": true
8170 }
8171 },
8172 {
8173 "expanded_query": "/* select#1 */ select `d1`.`f1` AS `f1`,`d1`.`f2` AS `f2` from (`t1` left join (/* select#2 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` order by `t1`.`f1` limit 30) `d1` on((`t1`.`f1` = `d1`.`f1`))) order by `d1`.`f2` desc limit 30"
8174 },
8175 {
8176 "transformations_to_nested_joins": {
8177 "transformations": [
8178 "parenthesis_removal"
8179 ],
8180 "expanded_query": "/* select#1 */ select `d1`.`f1` AS `f1`,`d1`.`f2` AS `f2` from `t1` left join (/* select#2 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` order by `t1`.`f1` limit 30) `d1` on((`t1`.`f1` = `d1`.`f1`)) order by `d1`.`f2` desc limit 30"
8181 }
8182 }
8183 ]
8184 }
8185 },
8186 {
8187 "join_optimization": {
8188 "select#": 1,
8189 "steps": [
8190 {
8191 "join_optimization": {
8192 "select#": 2,
8193 "steps": [
8194 {
8195 "substitute_generated_columns": {
8196 }
8197 },
8198 {
8199 "table_dependencies": [
8200 {
8201 "table": "`t1`",
8202 "row_may_be_null": false,
8203 "map_bit": 0,
8204 "depends_on_map_bits": [
8205 ]
8206 }
8207 ]
8208 },
8209 {
8210 "rows_estimation": [
8211 {
8212 "table": "`t1`",
8213 "table_scan": {
8214 "rows": 500,
8215 "cost": 1.11035
8216 }
8217 }
8218 ]
8219 },
8220 {
8221 "considered_execution_plans": [
8222 {
8223 "plan_prefix": [
8224 ],
8225 "table": "`t1`",
8226 "best_access_path": {
8227 "considered_access_paths": [
8228 {
8229 "rows_to_scan": 500,
8230 "access_type": "scan",
8231 "resulting_rows": 500,
8232 "cost": 51.1104,
8233 "chosen": true
8234 }
8235 ]
8236 },
8237 "condition_filtering_pct": 100,
8238 "rows_for_plan": 500,
8239 "cost_for_plan": 51.1104,
8240 "chosen": true
8241 }
8242 ]
8243 },
8244 {
8245 "attaching_conditions_to_tables": {
8246 "original_condition": null,
8247 "attached_conditions_computation": [
8248 ],
8249 "attached_conditions_summary": [
8250 {
8251 "table": "`t1`",
8252 "attached": null
8253 }
8254 ]
8255 }
8256 },
8257 {
8258 "optimizing_distinct_group_by_order_by": {
8259 "simplifying_order_by": {
8260 "original_clause": "`t1`.`f1`",
8261 "items": [
8262 {
8263 "item": "`t1`.`f1`"
8264 }
8265 ],
8266 "resulting_clause_is_simple": true,
8267 "resulting_clause": "`t1`.`f1`"
8268 }
8269 }
8270 },
8271 {
8272 "finalizing_table_conditions": [
8273 ]
8274 },
8275 {
8276 "refine_plan": [
8277 {
8278 "table": "`t1`"
8279 }
8280 ]
8281 },
8282 {
8283 "considering_tmp_tables": [
8284 {
8285 "adding_sort_to_table": "t1"
8286 }
8287 ]
8288 }
8289 ]
8290 }
8291 },
8292 {
8293 "condition_processing": {
8294 "condition": "WHERE",
8295 "original_condition": null,
8296 "steps": [
8297 {
8298 "transformation": "equality_propagation",
8299 "resulting_condition": null
8300 }
8301 ]
8302 }
8303 },
8304 {
8305 "substitute_generated_columns": {
8306 }
8307 },
8308 {
8309 "table_dependencies": [
8310 {
8311 "table": "`t1`",
8312 "row_may_be_null": false,
8313 "map_bit": 0,
8314 "depends_on_map_bits": [
8315 ]
8316 },
8317 {
8318 "table": " `d1`",
8319 "row_may_be_null": true,
8320 "map_bit": 1,
8321 "depends_on_map_bits": [
8322 0
8323 ]
8324 }
8325 ]
8326 },
8327 {
8328 "ref_optimizer_key_uses": [
8329 {
8330 "table": " `d1`",
8331 "field": "f1",
8332 "equals": "`t1`.`f1`",
8333 "null_rejecting": true
8334 },
8335 {
8336 "table": " `d1`",
8337 "field": "f1",
8338 "equals": "`t1`.`f1`",
8339 "null_rejecting": true
8340 }
8341 ]
8342 },
8343 {
8344 "rows_estimation": [
8345 {
8346 "table": "`t1`",
8347 "table_scan": {
8348 "rows": 500,
8349 "cost": 1.11035
8350 }
8351 },
8352 {
8353 "table": " `d1`",
8354 "table_scan": {
8355 "rows": 30,
8356 "cost": 2.875
8357 }
8358 }
8359 ]
8360 },
8361 {
8362 "considered_execution_plans": [
8363 {
8364 "plan_prefix": [
8365 ],
8366 "table": "`t1`",
8367 "best_access_path": {
8368 "considered_access_paths": [
8369 {
8370 "rows_to_scan": 500,
8371 "access_type": "scan",
8372 "resulting_rows": 500,
8373 "cost": 51.1104,
8374 "chosen": true
8375 }
8376 ]
8377 },
8378 "condition_filtering_pct": 100,
8379 "rows_for_plan": 500,
8380 "cost_for_plan": 51.1104,
8381 "rest_of_plan": [
8382 {
8383 "plan_prefix": [
8384 "`t1`"
8385 ],
8386 "table": " `d1`",
8387 "best_access_path": {
8388 "considered_access_paths": [
8389 {
8390 "access_type": "ref",
8391 "index": "<auto_key0>",
8392 "rows": 3,
8393 "cost": 525,
8394 "chosen": true
8395 },
8396 {
8397 "access_type": "ref",
8398 "index": "<auto_key1>",
8399 "rows": 3,
8400 "cost": 525,
8401 "chosen": false
8402 },
8403 {
8404 "rows_to_scan": 30,
8405 "access_type": "scan",
8406 "using_join_cache": true,
8407 "buffers_needed": 1,
8408 "resulting_rows": 30,
8409 "cost": 1502.9,
8410 "chosen": false
8411 }
8412 ]
8413 },
8414 "condition_filtering_pct": 100,
8415 "rows_for_plan": 1500,
8416 "cost_for_plan": 576.11,
8417 "sort_cost": 1500,
8418 "new_cost_for_plan": 2076.11,
8419 "chosen": true
8420 }
8421 ]
8422 }
8423 ]
8424 },
8425 {
8426 "condition_on_constant_tables": "true",
8427 "condition_value": true
8428 },
8429 {
8430 "attaching_conditions_to_tables": {
8431 "original_condition": "true",
8432 "attached_conditions_computation": [
8433 ],
8434 "attached_conditions_summary": [
8435 {
8436 "table": "`t1`",
8437 "attached": null
8438 },
8439 {
8440 "table": " `d1`",
8441 "attached": "<if>(is_not_null_compl(d1), (`d1`.`f1` = `t1`.`f1`), true)"
8442 }
8443 ]
8444 }
8445 },
8446 {
8447 "optimizing_distinct_group_by_order_by": {
8448 "simplifying_order_by": {
8449 "original_clause": "`d1`.`f2` desc",
8450 "items": [
8451 {
8452 "item": "`d1`.`f2`"
8453 }
8454 ],
8455 "resulting_clause_is_simple": false,
8456 "resulting_clause": "`d1`.`f2` desc"
8457 }
8458 }
8459 },
8460 {
8461 "finalizing_table_conditions": [
8462 {
8463 "table": " `d1`",
8464 "original_table_condition": "<if>(is_not_null_compl(d1), (`d1`.`f1` = `t1`.`f1`), true)",
8465 "final_table_condition ": null
8466 }
8467 ]
8468 },
8469 {
8470 "refine_plan": [
8471 {
8472 "table": "`t1`"
8473 },
8474 {
8475 "table": " `d1`"
8476 }
8477 ]
8478 },
8479 {
8480 "considering_tmp_tables": [
8481 {
8482 "adding_tmp_table_in_plan_at_position": 2,
8483 "write_method": "write_all_rows"
8484 },
8485 {
8486 "adding_sort_to_table": ""
8487 }
8488 ]
8489 }
8490 ]
8491 }
8492 },
8493 {
8494 "join_execution": {
8495 "select#": 1,
8496 "steps": [
8497 {
8498 "sorting_table": "<temporary>",
8499 "filesort_information": [
8500 {
8501 "direction": "desc",
8502 "expression": "`d1`.`f2`"
8503 }
8504 ],
8505 "filesort_priority_queue_optimization": {
8506 "limit": 30,
8507 "chosen": true
8508 },
8509 "filesort_execution": [
8510 {
8511 "creating_tmp_table": {
8512 "tmp_table_info": {
8513 "table": "d1",
8514 "in_plan_at_position": 1,
8515 "columns": 3,
8516 "row_length": 210,
8517 "key_length": 5,
8518 "unique_constraint": false,
8519 "makes_grouped_rows": false,
8520 "cannot_insert_duplicates": false,
8521 "location": "TempTable"
8522 }
8523 }
8524 },
8525 {
8526 "materialize": {
8527 "select#": 2,
8528 "steps": [
8529 {
8530 "sorting_table": "t1",
8531 "filesort_information": [
8532 {
8533 "direction": "asc",
8534 "expression": "`t1`.`f1`"
8535 }
8536 ],
8537 "filesort_priority_queue_optimization": {
8538 "limit": 30,
8539 "chosen": true
8540 },
8541 "filesort_execution": [
8542 ],
8543 "filesort_summary": {
8544 "memory_available": 327680,
8545 "key_size": 9,
8546 "row_size": 219,
8547 "max_rows_per_buffer": 31,
8548 "num_rows_estimate": 500,
8549 "num_rows_found": 500,
8550 "num_initial_chunks_spilled_to_disk": 0,
8551 "peak_memory_used": "NNN",
8552 "sort_algorithm": "std::sort",
8553 "unpacked_addon_fields": "using_priority_queue",
8554 "sort_mode": "<fixed_sort_key, additional_fields>"
8555 }
8556 }
8557 ]
8558 }
8559 }
8560 ],
8561 "filesort_summary": {
8562 "memory_available": 327680,
8563 "key_size": 201,
8564 "row_size": 407,
8565 "max_rows_per_buffer": 31,
8566 "num_rows_estimate": 15000,
8567 "num_rows_found": 620,
8568 "num_initial_chunks_spilled_to_disk": 0,
8569 "peak_memory_used": "NNN",
8570 "sort_algorithm": "std::sort",
8571 "unpacked_addon_fields": "using_priority_queue",
8572 "sort_mode": "<fixed_sort_key, additional_fields>"
8573 }
8574 }
8575 ]
8576 }
8577 }
8578 ]
8579 } 0 0
8580 SELECT * FROM t1 WHERE f1 = (SELECT f1 FROM t1 ORDER BY 1 LIMIT 1);
8581 f0 f1 f2
8582 1 0 0
8583 101 0 0
8584 201 0 0
8585 301 0 0
8586 401 0 0
8587 SELECT * FROM information_schema.OPTIMIZER_TRACE;
8588 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
8589 SELECT * FROM t1 WHERE f1 = (SELECT f1 FROM t1 ORDER BY 1 LIMIT 1) {
8590 "steps": [
8591 {
8592 "join_preparation": {
8593 "select#": 1,
8594 "steps": [
8595 {
8596 "join_preparation": {
8597 "select#": 2,
8598 "steps": [
8599 {
8600 "expanded_query": "/* select#2 */ select `t1`.`f1` from `t1` order by `t1`.`f1` limit 1"
8601 }
8602 ]
8603 }
8604 },
8605 {
8606 "expanded_query": "/* select#1 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` where (`t1`.`f1` = (/* select#2 */ select `t1`.`f1` from `t1` order by `t1`.`f1` limit 1))"
8607 }
8608 ]
8609 }
8610 },
8611 {
8612 "join_optimization": {
8613 "select#": 1,
8614 "steps": [
8615 {
8616 "condition_processing": {
8617 "condition": "WHERE",
8618 "original_condition": "(`t1`.`f1` = (/* select#2 */ select `t1`.`f1` from `t1` order by `t1`.`f1` limit 1))",
8619 "steps": [
8620 {
8621 "transformation": "equality_propagation",
8622 "subselect_evaluation": [
8623 ],
8624 "resulting_condition": "multiple equal((/* select#2 */ select `t1`.`f1` from `t1` order by `t1`.`f1` limit 1), `t1`.`f1`)"
8625 },
8626 {
8627 "transformation": "constant_propagation",
8628 "resulting_condition": "multiple equal((/* select#2 */ select `t1`.`f1` from `t1` order by `t1`.`f1` limit 1), `t1`.`f1`)"
8629 },
8630 {
8631 "transformation": "trivial_condition_removal",
8632 "resulting_condition": "multiple equal((/* select#2 */ select `t1`.`f1` from `t1` order by `t1`.`f1` limit 1), `t1`.`f1`)"
8633 }
8634 ]
8635 }
8636 },
8637 {
8638 "substitute_generated_columns": {
8639 }
8640 },
8641 {
8642 "table_dependencies": [
8643 {
8644 "table": "`t1`",
8645 "row_may_be_null": false,
8646 "map_bit": 0,
8647 "depends_on_map_bits": [
8648 ]
8649 }
8650 ]
8651 },
8652 {
8653 "ref_optimizer_key_uses": [
8654 ]
8655 },
8656 {
8657 "rows_estimation": [
8658 {
8659 "table": "`t1`",
8660 "table_scan": {
8661 "rows": 500,
8662 "cost": 1.11035
8663 }
8664 }
8665 ]
8666 },
8667 {
8668 "considered_execution_plans": [
8669 {
8670 "plan_prefix": [
8671 ],
8672 "table": "`t1`",
8673 "best_access_path": {
8674 "considered_access_paths": [
8675 {
8676 "rows_to_scan": 500,
8677 "access_type": "scan",
8678 "resulting_rows": 500,
8679 "cost": 51.1104,
8680 "chosen": true
8681 }
8682 ]
8683 },
8684 "condition_filtering_pct": 100,
8685 "rows_for_plan": 500,
8686 "cost_for_plan": 51.1104,
8687 "chosen": true
8688 }
8689 ]
8690 },
8691 {
8692 "attaching_conditions_to_tables": {
8693 "original_condition": "(`t1`.`f1` = (/* select#2 */ select `t1`.`f1` from `t1` order by `t1`.`f1` limit 1))",
8694 "attached_conditions_computation": [
8695 ],
8696 "attached_conditions_summary": [
8697 {
8698 "table": "`t1`",
8699 "attached": "(`t1`.`f1` = (/* select#2 */ select `t1`.`f1` from `t1` order by `t1`.`f1` limit 1))"
8700 }
8701 ]
8702 }
8703 },
8704 {
8705 "finalizing_table_conditions": [
8706 {
8707 "table": "`t1`",
8708 "original_table_condition": "(`t1`.`f1` = (/* select#2 */ select `t1`.`f1` from `t1` order by `t1`.`f1` limit 1))",
8709 "final_table_condition ": "(`t1`.`f1` = (/* select#2 */ select `t1`.`f1` from `t1` order by `t1`.`f1` limit 1))"
8710 }
8711 ]
8712 },
8713 {
8714 "refine_plan": [
8715 {
8716 "table": "`t1`"
8717 }
8718 ]
8719 }
8720 ]
8721 }
8722 },
8723 {
8724 "join_optimization": {
8725 "select#": 2,
8726 "steps": [
8727 {
8728 "substitute_generated_columns": {
8729 }
8730 },
8731 {
8732 "table_dependencies": [
8733 {
8734 "table": "`t1`",
8735 "row_may_be_null": false,
8736 "map_bit": 0,
8737 "depends_on_map_bits": [
8738 ]
8739 }
8740 ]
8741 },
8742 {
8743 "rows_estimation": [
8744 {
8745 "table": "`t1`",
8746 "table_scan": {
8747 "rows": 500,
8748 "cost": 1.11035
8749 }
8750 }
8751 ]
8752 },
8753 {
8754 "considered_execution_plans": [
8755 {
8756 "plan_prefix": [
8757 ],
8758 "table": "`t1`",
8759 "best_access_path": {
8760 "considered_access_paths": [
8761 {
8762 "rows_to_scan": 500,
8763 "access_type": "scan",
8764 "resulting_rows": 500,
8765 "cost": 51.1104,
8766 "chosen": true
8767 }
8768 ]
8769 },
8770 "condition_filtering_pct": 100,
8771 "rows_for_plan": 500,
8772 "cost_for_plan": 51.1104,
8773 "chosen": true
8774 }
8775 ]
8776 },
8777 {
8778 "attaching_conditions_to_tables": {
8779 "original_condition": null,
8780 "attached_conditions_computation": [
8781 ],
8782 "attached_conditions_summary": [
8783 {
8784 "table": "`t1`",
8785 "attached": null
8786 }
8787 ]
8788 }
8789 },
8790 {
8791 "optimizing_distinct_group_by_order_by": {
8792 "simplifying_order_by": {
8793 "original_clause": "`t1`.`f1`",
8794 "items": [
8795 {
8796 "item": "`t1`.`f1`"
8797 }
8798 ],
8799 "resulting_clause_is_simple": true,
8800 "resulting_clause": "`t1`.`f1`"
8801 }
8802 }
8803 },
8804 {
8805 "finalizing_table_conditions": [
8806 ]
8807 },
8808 {
8809 "refine_plan": [
8810 {
8811 "table": "`t1`"
8812 }
8813 ]
8814 },
8815 {
8816 "considering_tmp_tables": [
8817 {
8818 "adding_sort_to_table": "t1"
8819 }
8820 ]
8821 }
8822 ]
8823 }
8824 },
8825 {
8826 "join_execution": {
8827 "select#": 1,
8828 "steps": [
8829 {
8830 "subselect_execution": {
8831 "select#": 2,
8832 "steps": [
8833 {
8834 "join_execution": {
8835 "select#": 2,
8836 "steps": [
8837 {
8838 "sorting_table": "t1",
8839 "filesort_information": [
8840 {
8841 "direction": "asc",
8842 "expression": "`t1`.`f1`"
8843 }
8844 ],
8845 "filesort_priority_queue_optimization": {
8846 "limit": 1,
8847 "chosen": true
8848 },
8849 "filesort_execution": [
8850 ],
8851 "filesort_summary": {
8852 "memory_available": 327680,
8853 "key_size": 9,
8854 "row_size": 14,
8855 "max_rows_per_buffer": 2,
8856 "num_rows_estimate": 500,
8857 "num_rows_found": 500,
8858 "num_initial_chunks_spilled_to_disk": 0,
8859 "peak_memory_used": "NNN",
8860 "sort_algorithm": "std::sort",
8861 "unpacked_addon_fields": "using_priority_queue",
8862 "sort_mode": "<fixed_sort_key, additional_fields>"
8863 }
8864 }
8865 ]
8866 }
8867 }
8868 ]
8869 }
8870 },
8871 {
8872 "subselect_execution": {
8873 "select#": 2,
8874 "steps": [
8875 ]
8876 }
8877 },
8878 {
8879 "subselect_execution": {
8880 "select#": 2,
8881 "steps": [
8882 ]
8883 }
8884 },
8885 {
8886 "subselect_execution": {
8887 "select#": 2,
8888 "steps": [
8889 ]
8890 }
8891 },
8892 {
8893 "subselect_execution": {
8894 "select#": 2,
8895 "steps": [
8896 ]
8897 }
8898 },
8899 {
8900 "subselect_execution": {
8901 "select#": 2,
8902 "steps": [
8903 ]
8904 }
8905 },
8906 {
8907 "subselect_execution": {
8908 "select#": 2,
8909 "steps": [
8910 ]
8911 }
8912 },
8913 {
8914 "subselect_execution": {
8915 "select#": 2,
8916 "steps": [
8917 ]
8918 }
8919 },
8920 {
8921 "subselect_execution": {
8922 "select#": 2,
8923 "steps": [
8924 ]
8925 }
8926 },
8927 {
8928 "subselect_execution": {
8929 "select#": 2,
8930 "steps": [
8931 ]
8932 }
8933 },
8934 {
8935 "subselect_execution": {
8936 "select#": 2,
8937 "steps": [
8938 ]
8939 }
8940 },
8941 {
8942 "subselect_execution": {
8943 "select#": 2,
8944 "steps": [
8945 ]
8946 }
8947 },
8948 {
8949 "subselect_execution": {
8950 "select#": 2,
8951 "steps": [
8952 ]
8953 }
8954 },
8955 {
8956 "subselect_execution": {
8957 "select#": 2,
8958 "steps": [
8959 ]
8960 }
8961 },
8962 {
8963 "subselect_execution": {
8964 "select#": 2,
8965 "steps": [
8966 ]
8967 }
8968 },
8969 {
8970 "subselect_execution": {
8971 "select#": 2,
8972 "steps": [
8973 ]
8974 }
8975 },
8976 {
8977 "subselect_execution": {
8978 "select#": 2,
8979 "steps": [
8980 ]
8981 }
8982 },
8983 {
8984 "subselect_execution": {
8985 "select#": 2,
8986 "steps": [
8987 ]
8988 }
8989 },
8990 {
8991 "subselect_execution": {
8992 "select#": 2,
8993 "steps": [
8994 ]
8995 }
8996 },
8997 {
8998 "subselect_execution": {
8999 "select#": 2,
9000 "steps": [
9001 ]
9002 }
9003 },
9004 {
9005 "subselect_execution": {
9006 "select#": 2,
9007 "steps": [
9008 ]
9009 }
9010 },
9011 {
9012 "subselect_execution": {
9013 "select#": 2,
9014 "steps": [
9015 ]
9016 }
9017 },
9018 {
9019 "subselect_execution": {
9020 "select#": 2,
9021 "steps": [
9022 ]
9023 }
9024 },
9025 {
9026 "subselect_execution": {
9027 "select#": 2,
9028 "steps": [
9029 ]
9030 }
9031 },
9032 {
9033 "subselect_execution": {
9034 "select#": 2,
9035 "steps": [
9036 ]
9037 }
9038 },
9039 {
9040 "subselect_execution": {
9041 "select#": 2,
9042 "steps": [
9043 ]
9044 }
9045 },
9046 {
9047 "subselect_execution": {
9048 "select#": 2,
9049 "steps": [
9050 ]
9051 }
9052 },
9053 {
9054 "subselect_execution": {
9055 "select#": 2,
9056 "steps": [
9057 ]
9058 }
9059 },
9060 {
9061 "subselect_execution": {
9062 "select#": 2,
9063 "steps": [
9064 ]
9065 }
9066 },
9067 {
9068 "subselect_execution": {
9069 "select#": 2,
9070 "steps": [
9071 ]
9072 }
9073 },
9074 {
9075 "subselect_execution": {
9076 "select#": 2,
9077 "steps": [
9078 ]
9079 }
9080 },
9081 {
9082 "subselect_execution": {
9083 "select#": 2,
9084 "steps": [
9085 ]
9086 }
9087 },
9088 {
9089 "subselect_execution": {
9090 "select#": 2,
9091 "steps": [
9092 ]
9093 }
9094 },
9095 {
9096 "subselect_execution": {
9097 "select#": 2,
9098 "steps": [
9099 ]
9100 }
9101 },
9102 {
9103 "subselect_execution": {
9104 "select#": 2,
9105 "steps": [
9106 ]
9107 }
9108 },
9109 {
9110 "subselect_execution": {
9111 "select#": 2,
9112 "steps": [
9113 ]
9114 }
9115 },
9116 {
9117 "subselect_execution": {
9118 "select#": 2,
9119 "steps": [
9120 ]
9121 }
9122 },
9123 {
9124 "subselect_execution": {
9125 "select#": 2,
9126 "steps": [
9127 ]
9128 }
9129 },
9130 {
9131 "subselect_execution": {
9132 "select#": 2,
9133 "steps": [
9134 ]
9135 }
9136 },
9137 {
9138 "subselect_execution": {
9139 "select#": 2,
9140 "steps": [
9141 ]
9142 }
9143 },
9144 {
9145 "subselect_execution": {
9146 "select#": 2,
9147 "steps": [
9148 ]
9149 }
9150 },
9151 {
9152 "subselect_execution": {
9153 "select#": 2,
9154 "steps": [
9155 ]
9156 }
9157 },
9158 {
9159 "subselect_execution": {
9160 "select#": 2,
9161 "steps": [
9162 ]
9163 }
9164 },
9165 {
9166 "subselect_execution": {
9167 "select#": 2,
9168 "steps": [
9169 ]
9170 }
9171 },
9172 {
9173 "subselect_execution": {
9174 "select#": 2,
9175 "steps": [
9176 ]
9177 }
9178 },
9179 {
9180 "subselect_execution": {
9181 "select#": 2,
9182 "steps": [
9183 ]
9184 }
9185 },
9186 {
9187 "subselect_execution": {
9188 "select#": 2,
9189 "steps": [
9190 ]
9191 }
9192 },
9193 {
9194 "subselect_execution": {
9195 "select#": 2,
9196 "steps": [
9197 ]
9198 }
9199 },
9200 {
9201 "subselect_execution": {
9202 "select#": 2,
9203 "steps": [
9204 ]
9205 }
9206 },
9207 {
9208 "subselect_execution": {
9209 "select#": 2,
9210 "steps": [
9211 ]
9212 }
9213 },
9214 {
9215 "subselect_execution": {
9216 "select#": 2,
9217 "steps": [
9218 ]
9219 }
9220 },
9221 {
9222 "subselect_execution": {
9223 "select#": 2,
9224 "steps": [
9225 ]
9226 }
9227 },
9228 {
9229 "subselect_execution": {
9230 "select#": 2,
9231 "steps": [
9232 ]
9233 }
9234 },
9235 {
9236 "subselect_execution": {
9237 "select#": 2,
9238 "steps": [
9239 ]
9240 }
9241 },
9242 {
9243 "subselect_execution": {
9244 "select#": 2,
9245 "steps": [
9246 ]
9247 }
9248 },
9249 {
9250 "subselect_execution": {
9251 "select#": 2,
9252 "steps": [
9253 ]
9254 }
9255 },
9256 {
9257 "subselect_execution": {
9258 "select#": 2,
9259 "steps": [
9260 ]
9261 }
9262 },
9263 {
9264 "subselect_execution": {
9265 "select#": 2,
9266 "steps": [
9267 ]
9268 }
9269 },
9270 {
9271 "subselect_execution": {
9272 "select#": 2,
9273 "steps": [
9274 ]
9275 }
9276 },
9277 {
9278 "subselect_execution": {
9279 "select#": 2,
9280 "steps": [
9281 ]
9282 }
9283 },
9284 {
9285 "subselect_execution": {
9286 "select#": 2,
9287 "steps": [
9288 ]
9289 }
9290 },
9291 {
9292 "subselect_execution": {
9293 "select#": 2,
9294 "steps": [
9295 ]
9296 }
9297 },
9298 {
9299 "subselect_execution": {
9300 "select#": 2,
9301 "steps": [
9302 ]
9303 }
9304 },
9305 {
9306 "subselect_execution": {
9307 "select#": 2,
9308 "steps": [
9309 ]
9310 }
9311 },
9312 {
9313 "subselect_execution": {
9314 "select#": 2,
9315 "steps": [
9316 ]
9317 }
9318 },
9319 {
9320 "subselect_execution": {
9321 "select#": 2,
9322 "steps": [
9323 ]
9324 }
9325 },
9326 {
9327 "subselect_execution": {
9328 "select#": 2,
9329 "steps": [
9330 ]
9331 }
9332 },
9333 {
9334 "subselect_execution": {
9335 "select#": 2,
9336 "steps": [
9337 ]
9338 }
9339 },
9340 {
9341 "subselect_execution": {
9342 "select#": 2,
9343 "steps": [
9344 ]
9345 }
9346 },
9347 {
9348 "subselect_execution": {
9349 "select#": 2,
9350 "steps": [
9351 ]
9352 }
9353 },
9354 {
9355 "subselect_execution": {
9356 "select#": 2,
9357 "steps": [
9358 ]
9359 }
9360 },
9361 {
9362 "subselect_execution": {
9363 "select#": 2,
9364 "steps": [
9365 ]
9366 }
9367 },
9368 {
9369 "subselect_execution": {
9370 "select#": 2,
9371 "steps": [
9372 ]
9373 }
9374 },
9375 {
9376 "subselect_execution": {
9377 "select#": 2,
9378 "steps": [
9379 ]
9380 }
9381 },
9382 {
9383 "subselect_execution": {
9384 "select#": 2,
9385 "steps": [
9386 ]
9387 }
9388 },
9389 {
9390 "subselect_execution": {
9391 "select#": 2,
9392 "steps": [
9393 ]
9394 }
9395 },
9396 {
9397 "subselect_execution": {
9398 "select#": 2,
9399 "steps": [
9400 ]
9401 }
9402 },
9403 {
9404 "subselect_execution": {
9405 "select#": 2,
9406 "steps": [
9407 ]
9408 }
9409 },
9410 {
9411 "subselect_execution": {
9412 "select#": 2,
9413 "steps": [
9414 ]
9415 }
9416 },
9417 {
9418 "subselect_execution": {
9419 "select#": 2,
9420 "steps": [
9421 ]
9422 }
9423 },
9424 {
9425 "subselect_execution": {
9426 "select#": 2,
9427 "steps": [
9428 ]
9429 }
9430 },
9431 {
9432 "subselect_execution": {
9433 "select#": 2,
9434 "steps": [
9435 ]
9436 }
9437 },
9438 {
9439 "subselect_execution": {
9440 "select#": 2,
9441 "steps": [
9442 ]
9443 }
9444 },
9445 {
9446 "subselect_execution": {
9447 "select#": 2,
9448 "steps": [
9449 ]
9450 }
9451 },
9452 {
9453 "subselect_execution": {
9454 "select#": 2,
9455 "steps": [
9456 ]
9457 }
9458 },
9459 {
9460 "subselect_execution": {
9461 "select#": 2,
9462 "steps": [
9463 ]
9464 }
9465 },
9466 {
9467 "subselect_execution": {
9468 "select#": 2,
9469 "steps": [
9470 ]
9471 }
9472 },
9473 {
9474 "subselect_execution": {
9475 "select#": 2,
9476 "steps": [
9477 ]
9478 }
9479 },
9480 {
9481 "subselect_execution": {
9482 "select#": 2,
9483 "steps": [
9484 ]
9485 }
9486 },
9487 {
9488 "subselect_execution": {
9489 "select#": 2,
9490 "steps": [
9491 ]
9492 }
9493 },
9494 {
9495 "subselect_execution": {
9496 "select#": 2,
9497 "steps": [
9498 ]
9499 }
9500 },
9501 {
9502 "subselect_execution": {
9503 "select#": 2,
9504 "steps": [
9505 ]
9506 }
9507 },
9508 {
9509 "subselect_execution": {
9510 "select#": 2,
9511 "steps": [
9512 ]
9513 }
9514 },
9515 {
9516 "subselect_execution": {
9517 "select#": 2,
9518 "steps": [
9519 ]
9520 }
9521 },
9522 {
9523 "subselect_execution": {
9524 "select#": 2,
9525 "steps": [
9526 ]
9527 }
9528 },
9529 {
9530 "subselect_execution": {
9531 "select#": 2,
9532 "steps": [
9533 ]
9534 }
9535 },
9536 {
9537 "subselect_execution": {
9538 "select#": 2,
9539 "steps": [
9540 ]
9541 }
9542 },
9543 {
9544 "subselect_execution": {
9545 "select#": 2,
9546 "steps": [
9547 ]
9548 }
9549 },
9550 {
9551 "subselect_execution": {
9552 "select#": 2,
9553 "steps": [
9554 ]
9555 }
9556 },
9557 {
9558 "subselect_execution": {
9559 "select#": 2,
9560 "steps": [
9561 ]
9562 }
9563 },
9564 {
9565 "subselect_execution": {
9566 "select#": 2,
9567 "steps": [
9568 ]
9569 }
9570 },
9571 {
9572 "subselect_execution": {
9573 "select#": 2,
9574 "steps": [
9575 ]
9576 }
9577 },
9578 {
9579 "subselect_execution": {
9580 "select#": 2,
9581 "steps": [
9582 ]
9583 }
9584 },
9585 {
9586 "subselect_execution": {
9587 "select#": 2,
9588 "steps": [
9589 ]
9590 }
9591 },
9592 {
9593 "subselect_execution": {
9594 "select#": 2,
9595 "steps": [
9596 ]
9597 }
9598 },
9599 {
9600 "subselect_execution": {
9601 "select#": 2,
9602 "steps": [
9603 ]
9604 }
9605 },
9606 {
9607 "subselect_execution": {
9608 "select#": 2,
9609 "steps": [
9610 ]
9611 }
9612 },
9613 {
9614 "subselect_execution": {
9615 "select#": 2,
9616 "steps": [
9617 ]
9618 }
9619 },
9620 {
9621 "subselect_execution": {
9622 "select#": 2,
9623 "steps": [
9624 ]
9625 }
9626 },
9627 {
9628 "subselect_execution": {
9629 "select#": 2,
9630 "steps": [
9631 ]
9632 }
9633 },
9634 {
9635 "subselect_execution": {
9636 "select#": 2,
9637 "steps": [
9638 ]
9639 }
9640 },
9641 {
9642 "subselect_execution": {
9643 "select#": 2,
9644 "steps": [
9645 ]
9646 }
9647 },
9648 {
9649 "subselect_execution": {
9650 "select#": 2,
9651 "steps": [
9652 ]
9653 }
9654 },
9655 {
9656 "subselect_execution": {
9657 "select#": 2,
9658 "steps": [
9659 ]
9660 }
9661 },
9662 {
9663 "subselect_execution": {
9664 "select#": 2,
9665 "steps": [
9666 ]
9667 }
9668 },
9669 {
9670 "subselect_execution": {
9671 "select#": 2,
9672 "steps": [
9673 ]
9674 }
9675 },
9676 {
9677 "subselect_execution": {
9678 "select#": 2,
9679 "steps": [
9680 ]
9681 }
9682 },
9683 {
9684 "subselect_execution": {
9685 "select#": 2,
9686 "steps": [
9687 ]
9688 }
9689 },
9690 {
9691 "subselect_execution": {
9692 "select#": 2,
9693 "steps": [
9694 ]
9695 }
9696 },
9697 {
9698 "subselect_execution": {
9699 "select#": 2,
9700 "steps": [
9701 ]
9702 }
9703 },
9704 {
9705 "subselect_execution": {
9706 "select#": 2,
9707 "steps": [
9708 ]
9709 }
9710 },
9711 {
9712 "subselect_execution": {
9713 "select#": 2,
9714 "steps": [
9715 ]
9716 }
9717 },
9718 {
9719 "subselect_execution": {
9720 "select#": 2,
9721 "steps": [
9722 ]
9723 }
9724 },
9725 {
9726 "subselect_execution": {
9727 "select#": 2,
9728 "steps": [
9729 ]
9730 }
9731 },
9732 {
9733 "subselect_execution": {
9734 "select#": 2,
9735 "steps": [
9736 ]
9737 }
9738 },
9739 {
9740 "subselect_execution": {
9741 "select#": 2,
9742 "steps": [
9743 ]
9744 }
9745 },
9746 {
9747 "subselect_execution": {
9748 "select#": 2,
9749 "steps": [
9750 ]
9751 }
9752 },
9753 {
9754 "subselect_execution": {
9755 "select#": 2,
9756 "steps": [
9757 ]
9758 }
9759 },
9760 {
9761 "subselect_execution": {
9762 "select#": 2,
9763 "steps": [
9764 ]
9765 }
9766 },
9767 {
9768 "subselect_execution": {
9769 "select#": 2,
9770 "steps": [
9771 ]
9772 }
9773 },
9774 {
9775 "subselect_execution": {
9776 "select#": 2,
9777 "steps": [
9778 ]
9779 }
9780 },
9781 {
9782 "subselect_execution": {
9783 "select#": 2,
9784 "steps": [
9785 ]
9786 }
9787 },
9788 {
9789 "subselect_execution": {
9790 "select#": 2,
9791 "steps": [
9792 ]
9793 }
9794 },
9795 {
9796 "subselect_execution": {
9797 "select#": 2,
9798 "steps": [
9799 ]
9800 }
9801 },
9802 {
9803 "subselect_execution": {
9804 "select#": 2,
9805 "steps": [
9806 ]
9807 }
9808 },
9809 {
9810 "subselect_execution": {
9811 "select#": 2,
9812 "steps": [
9813 ]
9814 }
9815 },
9816 {
9817 "subselect_execution": {
9818 "select#": 2,
9819 "steps": [
9820 ]
9821 }
9822 },
9823 {
9824 "subselect_execution": {
9825 "select#": 2,
9826 "steps": [
9827 ]
9828 }
9829 },
9830 {
9831 "subselect_execution": {
9832 "select#": 2,
9833 "steps": [
9834 ]
9835 }
9836 },
9837 {
9838 "subselect_execution": {
9839 "select#": 2,
9840 "steps": [
9841 ]
9842 }
9843 },
9844 {
9845 "subselect_execution": {
9846 "select#": 2,
9847 "steps": [
9848 ]
9849 }
9850 },
9851 {
9852 "subselect_execution": {
9853 "select#": 2,
9854 "steps": [
9855 ]
9856 }
9857 },
9858 {
9859 "subselect_execution": {
9860 "select#": 2,
9861 "steps": [
9862 ]
9863 }
9864 },
9865 {
9866 "subselect_execution": {
9867 "select#": 2,
9868 "steps": [
9869 ]
9870 }
9871 },
9872 {
9873 "subselect_execution": {
9874 "select#": 2,
9875 "steps": [
9876 ]
9877 }
9878 },
9879 {
9880 "subselect_execution": {
9881 "select#": 2,
9882 "steps": [
9883 ]
9884 }
9885 },
9886 {
9887 "subselect_execution": {
9888 "select#": 2,
9889 "steps": [
9890 ]
9891 }
9892 },
9893 {
9894 "subselect_execution": {
9895 "select#": 2,
9896 "steps": [
9897 ]
9898 }
9899 },
9900 {
9901 "subselect_execution": {
9902 "select#": 2,
9903 "steps": [
9904 ]
9905 }
9906 },
9907 {
9908 "subselect_execution": {
9909 "select#": 2,
9910 "steps": [
9911 ]
9912 }
9913 },
9914 {
9915 "subselect_execution": {
9916 "select#": 2,
9917 "steps": [
9918 ]
9919 }
9920 },
9921 {
9922 "subselect_execution": {
9923 "select#": 2,
9924 "steps": [
9925 ]
9926 }
9927 },
9928 {
9929 "subselect_execution": {
9930 "select#": 2,
9931 "steps": [
9932 ]
9933 }
9934 },
9935 {
9936 "subselect_execution": {
9937 "select#": 2,
9938 "steps": [
9939 ]
9940 }
9941 },
9942 {
9943 "subselect_execution": {
9944 "select#": 2,
9945 "steps": [
9946 ]
9947 }
9948 },
9949 {
9950 "subselect_execution": {
9951 "select#": 2,
9952 "steps": [
9953 ]
9954 }
9955 },
9956 {
9957 "subselect_execution": {
9958 "select#": 2,
9959 "steps": [
9960 ]
9961 }
9962 },
9963 {
9964 "subselect_execution": {
9965 "select#": 2,
9966 "steps": [
9967 ]
9968 }
9969 },
9970 {
9971 "subselect_execution": {
9972 "select#": 2,
9973 "steps": [
9974 ]
9975 }
9976 },
9977 {
9978 "subselect_execution": {
9979 "select#": 2,
9980 "steps": [
9981 ]
9982 }
9983 },
9984 {
9985 "subselect_execution": {
9986 "select#": 2,
9987 "steps": [
9988 ]
9989 }
9990 },
9991 {
9992 "subselect_execution": {
9993 "select#": 2,
9994 "steps": [
9995 ]
9996 }
9997 },
9998 {
9999 "subselect_execution": {
10000 "select#": 2,
10001 "steps": [
10002 ]
10003 }
10004 },
10005 {
10006 "subselect_execution": {
10007 "select#": 2,
10008 "steps": [
10009 ]
10010 }
10011 },
10012 {
10013 "subselect_execution": {
10014 "select#": 2,
10015 "steps": [
10016 ]
10017 }
10018 },
10019 {
10020 "subselect_execution": {
10021 "select#": 2,
10022 "steps": [
10023 ]
10024 }
10025 },
10026 {
10027 "subselect_execution": {
10028 "select#": 2,
10029 "steps": [
10030 ]
10031 }
10032 },
10033 {
10034 "subselect_execution": {
10035 "select#": 2,
10036 "steps": [
10037 ]
10038 }
10039 },
10040 {
10041 "subselect_execution": {
10042 "select#": 2,
10043 "steps": [
10044 ]
10045 }
10046 },
10047 {
10048 "subselect_execution": {
10049 "select#": 2,
10050 "steps": [
10051 ]
10052 }
10053 },
10054 {
10055 "subselect_execution": {
10056 "select#": 2,
10057 "steps": [
10058 ]
10059 }
10060 },
10061 {
10062 "subselect_execution": {
10063 "select#": 2,
10064 "steps": [
10065 ]
10066 }
10067 },
10068 {
10069 "subselect_execution": {
10070 "select#": 2,
10071 "steps": [
10072 ]
10073 }
10074 },
10075 {
10076 "subselect_execution": {
10077 "select#": 2,
10078 "steps": [
10079 ]
10080 }
10081 },
10082 {
10083 "subselect_execution": {
10084 "select#": 2,
10085 "steps": [
10086 ]
10087 }
10088 },
10089 {
10090 "subselect_execution": {
10091 "select#": 2,
10092 "steps": [
10093 ]
10094 }
10095 },
10096 {
10097 "subselect_execution": {
10098 "select#": 2,
10099 "steps": [
10100 ]
10101 }
10102 },
10103 {
10104 "subselect_execution": {
10105 "select#": 2,
10106 "steps": [
10107 ]
10108 }
10109 },
10110 {
10111 "subselect_execution": {
10112 "select#": 2,
10113 "steps": [
10114 ]
10115 }
10116 },
10117 {
10118 "subselect_execution": {
10119 "select#": 2,
10120 "steps": [
10121 ]
10122 }
10123 },
10124 {
10125 "subselect_execution": {
10126 "select#": 2,
10127 "steps": [
10128 ]
10129 }
10130 },
10131 {
10132 "subselect_execution": {
10133 "select#": 2,
10134 "steps": [
10135 ]
10136 }
10137 },
10138 {
10139 "subselect_execution": {
10140 "select#": 2,
10141 "steps": [
10142 ]
10143 }
10144 },
10145 {
10146 "subselect_execution": {
10147 "select#": 2,
10148 "steps": [
10149 ]
10150 }
10151 },
10152 {
10153 "subselect_execution": {
10154 "select#": 2,
10155 "steps": [
10156 ]
10157 }
10158 },
10159 {
10160 "subselect_execution": {
10161 "select#": 2,
10162 "steps": [
10163 ]
10164 }
10165 },
10166 {
10167 "subselect_execution": {
10168 "select#": 2,
10169 "steps": [
10170 ]
10171 }
10172 },
10173 {
10174 "subselect_execution": {
10175 "select#": 2,
10176 "steps": [
10177 ]
10178 }
10179 },
10180 {
10181 "subselect_execution": {
10182 "select#": 2,
10183 "steps": [
10184 ]
10185 }
10186 },
10187 {
10188 "subselect_execution": {
10189 "select#": 2,
10190 "steps": [
10191 ]
10192 }
10193 },
10194 {
10195 "subselect_execution": {
10196 "select#": 2,
10197 "steps": [
10198 ]
10199 }
10200 },
10201 {
10202 "subselect_execution": {
10203 "select#": 2,
10204 "steps": [
10205 ]
10206 }
10207 },
10208 {
10209 "subselect_execution": {
10210 "select#": 2,
10211 "steps": [
10212 ]
10213 }
10214 },
10215 {
10216 "subselect_execution": {
10217 "select#": 2,
10218 "steps": [
10219 ]
10220 }
10221 },
10222 {
10223 "subselect_execution": {
10224 "select#": 2,
10225 "steps": [
10226 ]
10227 }
10228 },
10229 {
10230 "subselect_execution": {
10231 "select#": 2,
10232 "steps": [
10233 ]
10234 }
10235 },
10236 {
10237 "subselect_execution": {
10238 "select#": 2,
10239 "steps": [
10240 ]
10241 }
10242 },
10243 {
10244 "subselect_execution": {
10245 "select#": 2,
10246 "steps": [
10247 ]
10248 }
10249 },
10250 {
10251 "subselect_execution": {
10252 "select#": 2,
10253 "steps": [
10254 ]
10255 }
10256 },
10257 {
10258 "subselect_execution": {
10259 "select#": 2,
10260 "steps": [
10261 ]
10262 }
10263 },
10264 {
10265 "subselect_execution": {
10266 "select#": 2,
10267 "steps": [
10268 ]
10269 }
10270 },
10271 {
10272 "subselect_execution": {
10273 "select#": 2,
10274 "steps": [
10275 ]
10276 }
10277 },
10278 {
10279 "subselect_execution": {
10280 "select#": 2,
10281 "steps": [
10282 ]
10283 }
10284 },
10285 {
10286 "subselect_execution": {
10287 "select#": 2,
10288 "steps": [
10289 ]
10290 }
10291 },
10292 {
10293 "subselect_execution": {
10294 "select#": 2,
10295 "steps": [
10296 ]
10297 }
10298 },
10299 {
10300 "subselect_execution": {
10301 "select#": 2,
10302 "steps": [
10303 ]
10304 }
10305 },
10306 {
10307 "subselect_execution": {
10308 "select#": 2,
10309 "steps": [
10310 ]
10311 }
10312 },
10313 {
10314 "subselect_execution": {
10315 "select#": 2,
10316 "steps": [
10317 ]
10318 }
10319 },
10320 {
10321 "subselect_execution": {
10322 "select#": 2,
10323 "steps": [
10324 ]
10325 }
10326 },
10327 {
10328 "subselect_execution": {
10329 "select#": 2,
10330 "steps": [
10331 ]
10332 }
10333 },
10334 {
10335 "subselect_execution": {
10336 "select#": 2,
10337 "steps": [
10338 ]
10339 }
10340 },
10341 {
10342 "subselect_execution": {
10343 "select#": 2,
10344 "steps": [
10345 ]
10346 }
10347 },
10348 {
10349 "subselect_execution": {
10350 "select#": 2,
10351 "steps": [
10352 ]
10353 }
10354 },
10355 {
10356 "subselect_execution": {
10357 "select#": 2,
10358 "steps": [
10359 ]
10360 }
10361 },
10362 {
10363 "subselect_execution": {
10364 "select#": 2,
10365 "steps": [
10366 ]
10367 }
10368 },
10369 {
10370 "subselect_execution": {
10371 "select#": 2,
10372 "steps": [
10373 ]
10374 }
10375 },
10376 {
10377 "subselect_execution": {
10378 "select#": 2,
10379 "steps": [
10380 ]
10381 }
10382 },
10383 {
10384 "subselect_execution": {
10385 "select#": 2,
10386 "steps": [
10387 ]
10388 }
10389 },
10390 {
10391 "subselect_execution": {
10392 "select#": 2,
10393 "steps": [
10394 ]
10395 }
10396 },
10397 {
10398 "subselect_execution": {
10399 "select#": 2,
10400 "steps": [
10401 ]
10402 }
10403 },
10404 {
10405 "subselect_execution": {
10406 "select#": 2,
10407 "steps": [
10408 ]
10409 }
10410 },
10411 {
10412 "subselect_execution": {
10413 "select#": 2,
10414 "steps": [
10415 ]
10416 }
10417 },
10418 {
10419 "subselect_execution": {
10420 "select#": 2,
10421 "steps": [
10422 ]
10423 }
10424 },
10425 {
10426 "subselect_execution": {
10427 "select#": 2,
10428 "steps": [
10429 ]
10430 }
10431 },
10432 {
10433 "subselect_execution": {
10434 "select#": 2,
10435 "steps": [
10436 ]
10437 }
10438 },
10439 {
10440 "subselect_execution": {
10441 "select#": 2,
10442 "steps": [
10443 ]
10444 }
10445 },
10446 {
10447 "subselect_execution": {
10448 "select#": 2,
10449 "steps": [
10450 ]
10451 }
10452 },
10453 {
10454 "subselect_execution": {
10455 "select#": 2,
10456 "steps": [
10457 ]
10458 }
10459 },
10460 {
10461 "subselect_execution": {
10462 "select#": 2,
10463 "steps": [
10464 ]
10465 }
10466 },
10467 {
10468 "subselect_execution": {
10469 "select#": 2,
10470 "steps": [
10471 ]
10472 }
10473 },
10474 {
10475 "subselect_execution": {
10476 "select#": 2,
10477 "steps": [
10478 ]
10479 }
10480 },
10481 {
10482 "subselect_execution": {
10483 "select#": 2,
10484 "steps": [
10485 ]
10486 }
10487 },
10488 {
10489 "subselect_execution": {
10490 "select#": 2,
10491 "steps": [
10492 ]
10493 }
10494 },
10495 {
10496 "subselect_execution": {
10497 "select#": 2,
10498 "steps": [
10499 ]
10500 }
10501 },
10502 {
10503 "subselect_execution": {
10504 "select#": 2,
10505 "steps": [
10506 ]
10507 }
10508 },
10509 {
10510 "subselect_execution": {
10511 "select#": 2,
10512 "steps": [
10513 ]
10514 }
10515 },
10516 {
10517 "subselect_execution": {
10518 "select#": 2,
10519 "steps": [
10520 ]
10521 }
10522 },
10523 {
10524 "subselect_execution": {
10525 "select#": 2,
10526 "steps": [
10527 ]
10528 }
10529 },
10530 {
10531 "subselect_execution": {
10532 "select#": 2,
10533 "steps": [
10534 ]
10535 }
10536 },
10537 {
10538 "subselect_execution": {
10539 "select#": 2,
10540 "steps": [
10541 ]
10542 }
10543 },
10544 {
10545 "subselect_execution": {
10546 "select#": 2,
10547 "steps": [
10548 ]
10549 }
10550 },
10551 {
10552 "subselect_execution": {
10553 "select#": 2,
10554 "steps": [
10555 ]
10556 }
10557 },
10558 {
10559 "subselect_execution": {
10560 "select#": 2,
10561 "steps": [
10562 ]
10563 }
10564 },
10565 {
10566 "subselect_execution": {
10567 "select#": 2,
10568 "steps": [
10569 ]
10570 }
10571 },
10572 {
10573 "subselect_execution": {
10574 "select#": 2,
10575 "steps": [
10576 ]
10577 }
10578 },
10579 {
10580 "subselect_execution": {
10581 "select#": 2,
10582 "steps": [
10583 ]
10584 }
10585 },
10586 {
10587 "subselect_execution": {
10588 "select#": 2,
10589 "steps": [
10590 ]
10591 }
10592 },
10593 {
10594 "subselect_execution": {
10595 "select#": 2,
10596 "steps": [
10597 ]
10598 }
10599 },
10600 {
10601 "subselect_execution": {
10602 "select#": 2,
10603 "steps": [
10604 ]
10605 }
10606 },
10607 {
10608 "subselect_execution": {
10609 "select#": 2,
10610 "steps": [
10611 ]
10612 }
10613 },
10614 {
10615 "subselect_execution": {
10616 "select#": 2,
10617 "steps": [
10618 ]
10619 }
10620 },
10621 {
10622 "subselect_execution": {
10623 "select#": 2,
10624 "steps": [
10625 ]
10626 }
10627 },
10628 {
10629 "subselect_execution": {
10630 "select#": 2,
10631 "steps": [
10632 ]
10633 }
10634 },
10635 {
10636 "subselect_execution": {
10637 "select#": 2,
10638 "steps": [
10639 ]
10640 }
10641 },
10642 {
10643 "subselect_execution": {
10644 "select#": 2,
10645 "steps": [
10646 ]
10647 }
10648 },
10649 {
10650 "subselect_execution": {
10651 "select#": 2,
10652 "steps": [
10653 ]
10654 }
10655 },
10656 {
10657 "subselect_execution": {
10658 "select#": 2,
10659 "steps": [
10660 ]
10661 }
10662 },
10663 {
10664 "subselect_execution": {
10665 "select#": 2,
10666 "steps": [
10667 ]
10668 }
10669 },
10670 {
10671 "subselect_execution": {
10672 "select#": 2,
10673 "steps": [
10674 ]
10675 }
10676 },
10677 {
10678 "subselect_execution": {
10679 "select#": 2,
10680 "steps": [
10681 ]
10682 }
10683 },
10684 {
10685 "subselect_execution": {
10686 "select#": 2,
10687 "steps": [
10688 ]
10689 }
10690 },
10691 {
10692 "subselect_execution": {
10693 "select#": 2,
10694 "steps": [
10695 ]
10696 }
10697 },
10698 {
10699 "subselect_execution": {
10700 "select#": 2,
10701 "steps": [
10702 ]
10703 }
10704 },
10705 {
10706 "subselect_execution": {
10707 "select#": 2,
10708 "steps": [
10709 ]
10710 }
10711 },
10712 {
10713 "subselect_execution": {
10714 "select#": 2,
10715 "steps": [
10716 ]
10717 }
10718 },
10719 {
10720 "subselect_execution": {
10721 "select#": 2,
10722 "steps": [
10723 ]
10724 }
10725 },
10726 {
10727 "subselect_execution": {
10728 "select#": 2,
10729 "steps": [
10730 ]
10731 }
10732 },
10733 {
10734 "subselect_execution": {
10735 "select#": 2,
10736 "steps": [
10737 ]
10738 }
10739 },
10740 {
10741 "subselect_execution": {
10742 "select#": 2,
10743 "steps": [
10744 ]
10745 }
10746 },
10747 {
10748 "subselect_execution": {
10749 "select#": 2,
10750 "steps": [
10751 ]
10752 }
10753 },
10754 {
10755 "subselect_execution": {
10756 "select#": 2,
10757 "steps": [
10758 ]
10759 }
10760 },
10761 {
10762 "subselect_execution": {
10763 "select#": 2,
10764 "steps": [
10765 ]
10766 }
10767 },
10768 {
10769 "subselect_execution": {
10770 "select#": 2,
10771 "steps": [
10772 ]
10773 }
10774 },
10775 {
10776 "subselect_execution": {
10777 "select#": 2,
10778 "steps": [
10779 ]
10780 }
10781 },
10782 {
10783 "subselect_execution": {
10784 "select#": 2,
10785 "steps": [
10786 ]
10787 }
10788 },
10789 {
10790 "subselect_execution": {
10791 "select#": 2,
10792 "steps": [
10793 ]
10794 }
10795 },
10796 {
10797 "subselect_execution": {
10798 "select#": 2,
10799 "steps": [
10800 ]
10801 }
10802 },
10803 {
10804 "subselect_execution": {
10805 "select#": 2,
10806 "steps": [
10807 ]
10808 }
10809 },
10810 {
10811 "subselect_execution": {
10812 "select#": 2,
10813 "steps": [
10814 ]
10815 }
10816 },
10817 {
10818 "subselect_execution": {
10819 "select#": 2,
10820 "steps": [
10821 ]
10822 }
10823 },
10824 {
10825 "subselect_execution": {
10826 "select#": 2,
10827 "steps": [
10828 ]
10829 }
10830 },
10831 {
10832 "subselect_execution": {
10833 "select#": 2,
10834 "steps": [
10835 ]
10836 }
10837 },
10838 {
10839 "subselect_execution": {
10840 "select#": 2,
10841 "steps": [
10842 ]
10843 }
10844 },
10845 {
10846 "subselect_execution": {
10847 "select#": 2,
10848 "steps": [
10849 ]
10850 }
10851 },
10852 {
10853 "subselect_execution": {
10854 "select#": 2,
10855 "steps": [
10856 ]
10857 }
10858 },
10859 {
10860 "subselect_execution": {
10861 "select#": 2,
10862 "steps": [
10863 ]
10864 }
10865 },
10866 {
10867 "subselect_execution": {
10868 "select#": 2,
10869 "steps": [
10870 ]
10871 }
10872 },
10873 {
10874 "subselect_execution": {
10875 "select#": 2,
10876 "steps": [
10877 ]
10878 }
10879 },
10880 {
10881 "subselect_execution": {
10882 "select#": 2,
10883 "steps": [
10884 ]
10885 }
10886 },
10887 {
10888 "subselect_execution": {
10889 "select#": 2,
10890 "steps": [
10891 ]
10892 }
10893 },
10894 {
10895 "subselect_execution": {
10896 "select#": 2,
10897 "steps": [
10898 ]
10899 }
10900 },
10901 {
10902 "subselect_execution": {
10903 "select#": 2,
10904 "steps": [
10905 ]
10906 }
10907 },
10908 {
10909 "subselect_execution": {
10910 "select#": 2,
10911 "steps": [
10912 ]
10913 }
10914 },
10915 {
10916 "subselect_execution": {
10917 "select#": 2,
10918 "steps": [
10919 ]
10920 }
10921 },
10922 {
10923 "subselect_execution": {
10924 "select#": 2,
10925 "steps": [
10926 ]
10927 }
10928 },
10929 {
10930 "subselect_execution": {
10931 "select#": 2,
10932 "steps": [
10933 ]
10934 }
10935 },
10936 {
10937 "subselect_execution": {
10938 "select#": 2,
10939 "steps": [
10940 ]
10941 }
10942 },
10943 {
10944 "subselect_execution": {
10945 "select#": 2,
10946 "steps": [
10947 ]
10948 }
10949 },
10950 {
10951 "subselect_execution": {
10952 "select#": 2,
10953 "steps": [
10954 ]
10955 }
10956 },
10957 {
10958 "subselect_execution": {
10959 "select#": 2,
10960 "steps": [
10961 ]
10962 }
10963 },
10964 {
10965 "subselect_execution": {
10966 "select#": 2,
10967 "steps": [
10968 ]
10969 }
10970 },
10971 {
10972 "subselect_execution": {
10973 "select#": 2,
10974 "steps": [
10975 ]
10976 }
10977 },
10978 {
10979 "subselect_execution": {
10980 "select#": 2,
10981 "steps": [
10982 ]
10983 }
10984 },
10985 {
10986 "subselect_execution": {
10987 "select#": 2,
10988 "steps": [
10989 ]
10990 }
10991 },
10992 {
10993 "subselect_execution": {
10994 "select#": 2,
10995 "steps": [
10996 ]
10997 }
10998 },
10999 {
11000 "subselect_execution": {
11001 "select#": 2,
11002 "steps": [
11003 ]
11004 }
11005 },
11006 {
11007 "subselect_execution": {
11008 "select#": 2,
11009 "steps": [
11010 ]
11011 }
11012 },
11013 {
11014 "subselect_execution": {
11015 "select#": 2,
11016 "steps": [
11017 ]
11018 }
11019 },
11020 {
11021 "subselect_execution": {
11022 "select#": 2,
11023 "steps": [
11024 ]
11025 }
11026 },
11027 {
11028 "subselect_execution": {
11029 "select#": 2,
11030 "steps": [
11031 ]
11032 }
11033 },
11034 {
11035 "subselect_execution": {
11036 "select#": 2,
11037 "steps": [
11038 ]
11039 }
11040 },
11041 {
11042 "subselect_execution": {
11043 "select#": 2,
11044 "steps": [
11045 ]
11046 }
11047 },
11048 {
11049 "subselect_execution": {
11050 "select#": 2,
11051 "steps": [
11052 ]
11053 }
11054 },
11055 {
11056 "subselect_execution": {
11057 "select#": 2,
11058 "steps": [
11059 ]
11060 }
11061 },
11062 {
11063 "subselect_execution": {
11064 "select#": 2,
11065 "steps": [
11066 ]
11067 }
11068 },
11069 {
11070 "subselect_execution": {
11071 "select#": 2,
11072 "steps": [
11073 ]
11074 }
11075 },
11076 {
11077 "subselect_execution": {
11078 "select#": 2,
11079 "steps": [
11080 ]
11081 }
11082 },
11083 {
11084 "subselect_execution": {
11085 "select#": 2,
11086 "steps": [
11087 ]
11088 }
11089 },
11090 {
11091 "subselect_execution": {
11092 "select#": 2,
11093 "steps": [
11094 ]
11095 }
11096 },
11097 {
11098 "subselect_execution": {
11099 "select#": 2,
11100 "steps": [
11101 ]
11102 }
11103 },
11104 {
11105 "subselect_execution": {
11106 "select#": 2,
11107 "steps": [
11108 ]
11109 }
11110 },
11111 {
11112 "subselect_execution": {
11113 "select#": 2,
11114 "steps": [
11115 ]
11116 }
11117 },
11118 {
11119 "subselect_execution": {
11120 "select#": 2,
11121 "steps": [
11122 ]
11123 }
11124 },
11125 {
11126 "subselect_execution": {
11127 "select#": 2,
11128 "steps": [
11129 ]
11130 }
11131 },
11132 {
11133 "subselect_execution": {
11134 "select#": 2,
11135 "steps": [
11136 ]
11137 }
11138 },
11139 {
11140 "subselect_execution": {
11141 "select#": 2,
11142 "steps": [
11143 ]
11144 }
11145 },
11146 {
11147 "subselect_execution": {
11148 "select#": 2,
11149 "steps": [
11150 ]
11151 }
11152 },
11153 {
11154 "subselect_execution": {
11155 "select#": 2,
11156 "steps": [
11157 ]
11158 }
11159 },
11160 {
11161 "subselect_execution": {
11162 "select#": 2,
11163 "steps": [
11164 ]
11165 }
11166 },
11167 {
11168 "subselect_execution": {
11169 "select#": 2,
11170 "steps": [
11171 ]
11172 }
11173 },
11174 {
11175 "subselect_execution": {
11176 "select#": 2,
11177 "steps": [
11178 ]
11179 }
11180 },
11181 {
11182 "subselect_execution": {
11183 "select#": 2,
11184 "steps": [
11185 ]
11186 }
11187 },
11188 {
11189 "subselect_execution": {
11190 "select#": 2,
11191 "steps": [
11192 ]
11193 }
11194 },
11195 {
11196 "subselect_execution": {
11197 "select#": 2,
11198 "steps": [
11199 ]
11200 }
11201 },
11202 {
11203 "subselect_execution": {
11204 "select#": 2,
11205 "steps": [
11206 ]
11207 }
11208 },
11209 {
11210 "subselect_execution": {
11211 "select#": 2,
11212 "steps": [
11213 ]
11214 }
11215 },
11216 {
11217 "subselect_execution": {
11218 "select#": 2,
11219 "steps": [
11220 ]
11221 }
11222 },
11223 {
11224 "subselect_execution": {
11225 "select#": 2,
11226 "steps": [
11227 ]
11228 }
11229 },
11230 {
11231 "subselect_execution": {
11232 "select#": 2,
11233 "steps": [
11234 ]
11235 }
11236 },
11237 {
11238 "subselect_execution": {
11239 "select#": 2,
11240 "steps": [
11241 ]
11242 }
11243 },
11244 {
11245 "subselect_execution": {
11246 "select#": 2,
11247 "steps": [
11248 ]
11249 }
11250 },
11251 {
11252 "subselect_execution": {
11253 "select#": 2,
11254 "steps": [
11255 ]
11256 }
11257 },
11258 {
11259 "subselect_execution": {
11260 "select#": 2,
11261 "steps": [
11262 ]
11263 }
11264 },
11265 {
11266 "subselect_execution": {
11267 "select#": 2,
11268 "steps": [
11269 ]
11270 }
11271 },
11272 {
11273 "subselect_execution": {
11274 "select#": 2,
11275 "steps": [
11276 ]
11277 }
11278 },
11279 {
11280 "subselect_execution": {
11281 "select#": 2,
11282 "steps": [
11283 ]
11284 }
11285 },
11286 {
11287 "subselect_execution": {
11288 "select#": 2,
11289 "steps": [
11290 ]
11291 }
11292 },
11293 {
11294 "subselect_execution": {
11295 "select#": 2,
11296 "steps": [
11297 ]
11298 }
11299 },
11300 {
11301 "subselect_execution": {
11302 "select#": 2,
11303 "steps": [
11304 ]
11305 }
11306 },
11307 {
11308 "subselect_execution": {
11309 "select#": 2,
11310 "steps": [
11311 ]
11312 }
11313 },
11314 {
11315 "subselect_execution": {
11316 "select#": 2,
11317 "steps": [
11318 ]
11319 }
11320 },
11321 {
11322 "subselect_execution": {
11323 "select#": 2,
11324 "steps": [
11325 ]
11326 }
11327 },
11328 {
11329 "subselect_execution": {
11330 "select#": 2,
11331 "steps": [
11332 ]
11333 }
11334 },
11335 {
11336 "subselect_execution": {
11337 "select#": 2,
11338 "steps": [
11339 ]
11340 }
11341 },
11342 {
11343 "subselect_execution": {
11344 "select#": 2,
11345 "steps": [
11346 ]
11347 }
11348 },
11349 {
11350 "subselect_execution": {
11351 "select#": 2,
11352 "steps": [
11353 ]
11354 }
11355 },
11356 {
11357 "subselect_execution": {
11358 "select#": 2,
11359 "steps": [
11360 ]
11361 }
11362 },
11363 {
11364 "subselect_execution": {
11365 "select#": 2,
11366 "steps": [
11367 ]
11368 }
11369 },
11370 {
11371 "subselect_execution": {
11372 "select#": 2,
11373 "steps": [
11374 ]
11375 }
11376 },
11377 {
11378 "subselect_execution": {
11379 "select#": 2,
11380 "steps": [
11381 ]
11382 }
11383 },
11384 {
11385 "subselect_execution": {
11386 "select#": 2,
11387 "steps": [
11388 ]
11389 }
11390 },
11391 {
11392 "subselect_execution": {
11393 "select#": 2,
11394 "steps": [
11395 ]
11396 }
11397 },
11398 {
11399 "subselect_execution": {
11400 "select#": 2,
11401 "steps": [
11402 ]
11403 }
11404 },
11405 {
11406 "subselect_execution": {
11407 "select#": 2,
11408 "steps": [
11409 ]
11410 }
11411 },
11412 {
11413 "subselect_execution": {
11414 "select#": 2,
11415 "steps": [
11416 ]
11417 }
11418 },
11419 {
11420 "subselect_execution": {
11421 "select#": 2,
11422 "steps": [
11423 ]
11424 }
11425 },
11426 {
11427 "subselect_execution": {
11428 "select#": 2,
11429 "steps": [
11430 ]
11431 }
11432 },
11433 {
11434 "subselect_execution": {
11435 "select#": 2,
11436 "steps": [
11437 ]
11438 }
11439 },
11440 {
11441 "subselect_execution": {
11442 "select#": 2,
11443 "steps": [
11444 ]
11445 }
11446 },
11447 {
11448 "subselect_execution": {
11449 "select#": 2,
11450 "steps": [
11451 ]
11452 }
11453 },
11454 {
11455 "subselect_execution": {
11456 "select#": 2,
11457 "steps": [
11458 ]
11459 }
11460 },
11461 {
11462 "subselect_execution": {
11463 "select#": 2,
11464 "steps": [
11465 ]
11466 }
11467 },
11468 {
11469 "subselect_execution": {
11470 "select#": 2,
11471 "steps": [
11472 ]
11473 }
11474 },
11475 {
11476 "subselect_execution": {
11477 "select#": 2,
11478 "steps": [
11479 ]
11480 }
11481 },
11482 {
11483 "subselect_execution": {
11484 "select#": 2,
11485 "steps": [
11486 ]
11487 }
11488 },
11489 {
11490 "subselect_execution": {
11491 "select#": 2,
11492 "steps": [
11493 ]
11494 }
11495 },
11496 {
11497 "subselect_execution": {
11498 "select#": 2,
11499 "steps": [
11500 ]
11501 }
11502 },
11503 {
11504 "subselect_execution": {
11505 "select#": 2,
11506 "steps": [
11507 ]
11508 }
11509 },
11510 {
11511 "subselect_execution": {
11512 "select#": 2,
11513 "steps": [
11514 ]
11515 }
11516 },
11517 {
11518 "subselect_execution": {
11519 "select#": 2,
11520 "steps": [
11521 ]
11522 }
11523 },
11524 {
11525 "subselect_execution": {
11526 "select#": 2,
11527 "steps": [
11528 ]
11529 }
11530 },
11531 {
11532 "subselect_execution": {
11533 "select#": 2,
11534 "steps": [
11535 ]
11536 }
11537 },
11538 {
11539 "subselect_execution": {
11540 "select#": 2,
11541 "steps": [
11542 ]
11543 }
11544 },
11545 {
11546 "subselect_execution": {
11547 "select#": 2,
11548 "steps": [
11549 ]
11550 }
11551 },
11552 {
11553 "subselect_execution": {
11554 "select#": 2,
11555 "steps": [
11556 ]
11557 }
11558 },
11559 {
11560 "subselect_execution": {
11561 "select#": 2,
11562 "steps": [
11563 ]
11564 }
11565 },
11566 {
11567 "subselect_execution": {
11568 "select#": 2,
11569 "steps": [
11570 ]
11571 }
11572 },
11573 {
11574 "subselect_execution": {
11575 "select#": 2,
11576 "steps": [
11577 ]
11578 }
11579 },
11580 {
11581 "subselect_execution": {
11582 "select#": 2,
11583 "steps": [
11584 ]
11585 }
11586 },
11587 {
11588 "subselect_execution": {
11589 "select#": 2,
11590 "steps": [
11591 ]
11592 }
11593 },
11594 {
11595 "subselect_execution": {
11596 "select#": 2,
11597 "steps": [
11598 ]
11599 }
11600 },
11601 {
11602 "subselect_execution": {
11603 "select#": 2,
11604 "steps": [
11605 ]
11606 }
11607 },
11608 {
11609 "subselect_execution": {
11610 "select#": 2,
11611 "steps": [
11612 ]
11613 }
11614 },
11615 {
11616 "subselect_execution": {
11617 "select#": 2,
11618 "steps": [
11619 ]
11620 }
11621 },
11622 {
11623 "subselect_execution": {
11624 "select#": 2,
11625 "steps": [
11626 ]
11627 }
11628 },
11629 {
11630 "subselect_execution": {
11631 "select#": 2,
11632 "steps": [
11633 ]
11634 }
11635 },
11636 {
11637 "subselect_execution": {
11638 "select#": 2,
11639 "steps": [
11640 ]
11641 }
11642 },
11643 {
11644 "subselect_execution": {
11645 "select#": 2,
11646 "steps": [
11647 ]
11648 }
11649 },
11650 {
11651 "subselect_execution": {
11652 "select#": 2,
11653 "steps": [
11654 ]
11655 }
11656 },
11657 {
11658 "subselect_execution": {
11659 "select#": 2,
11660 "steps": [
11661 ]
11662 }
11663 },
11664 {
11665 "subselect_execution": {
11666 "select#": 2,
11667 "steps": [
11668 ]
11669 }
11670 },
11671 {
11672 "subselect_execution": {
11673 "select#": 2,
11674 "steps": [
11675 ]
11676 }
11677 },
11678 {
11679 "subselect_execution": {
11680 "select#": 2,
11681 "steps": [
11682 ]
11683 }
11684 },
11685 {
11686 "subselect_execution": {
11687 "select#": 2,
11688 "steps": [
11689 ]
11690 }
11691 },
11692 {
11693 "subselect_execution": {
11694 "select#": 2,
11695 "steps": [
11696 ]
11697 }
11698 },
11699 {
11700 "subselect_execution": {
11701 "select#": 2,
11702 "steps": [
11703 ]
11704 }
11705 },
11706 {
11707 "subselect_execution": {
11708 "select#": 2,
11709 "steps": [
11710 ]
11711 }
11712 },
11713 {
11714 "subselect_execution": {
11715 "select#": 2,
11716 "steps": [
11717 ]
11718 }
11719 },
11720 {
11721 "subselect_execution": {
11722 "select#": 2,
11723 "steps": [
11724 ]
11725 }
11726 },
11727 {
11728 "subselect_execution": {
11729 "select#": 2,
11730 "steps": [
11731 ]
11732 }
11733 },
11734 {
11735 "subselect_execution": {
11736 "select#": 2,
11737 "steps": [
11738 ]
11739 }
11740 },
11741 {
11742 "subselect_execution": {
11743 "select#": 2,
11744 "steps": [
11745 ]
11746 }
11747 },
11748 {
11749 "subselect_execution": {
11750 "select#": 2,
11751 "steps": [
11752 ]
11753 }
11754 },
11755 {
11756 "subselect_execution": {
11757 "select#": 2,
11758 "steps": [
11759 ]
11760 }
11761 },
11762 {
11763 "subselect_execution": {
11764 "select#": 2,
11765 "steps": [
11766 ]
11767 }
11768 },
11769 {
11770 "subselect_execution": {
11771 "select#": 2,
11772 "steps": [
11773 ]
11774 }
11775 },
11776 {
11777 "subselect_execution": {
11778 "select#": 2,
11779 "steps": [
11780 ]
11781 }
11782 },
11783 {
11784 "subselect_execution": {
11785 "select#": 2,
11786 "steps": [
11787 ]
11788 }
11789 },
11790 {
11791 "subselect_execution": {
11792 "select#": 2,
11793 "steps": [
11794 ]
11795 }
11796 },
11797 {
11798 "subselect_execution": {
11799 "select#": 2,
11800 "steps": [
11801 ]
11802 }
11803 },
11804 {
11805 "subselect_execution": {
11806 "select#": 2,
11807 "steps": [
11808 ]
11809 }
11810 },
11811 {
11812 "subselect_execution": {
11813 "select#": 2,
11814 "steps": [
11815 ]
11816 }
11817 },
11818 {
11819 "subselect_execution": {
11820 "select#": 2,
11821 "steps": [
11822 ]
11823 }
11824 },
11825 {
11826 "subselect_execution": {
11827 "select#": 2,
11828 "steps": [
11829 ]
11830 }
11831 },
11832 {
11833 "subselect_execution": {
11834 "select#": 2,
11835 "steps": [
11836 ]
11837 }
11838 },
11839 {
11840 "subselect_execution": {
11841 "select#": 2,
11842 "steps": [
11843 ]
11844 }
11845 },
11846 {
11847 "subselect_execution": {
11848 "select#": 2,
11849 "steps": [
11850 ]
11851 }
11852 },
11853 {
11854 "subselect_execution": {
11855 "select#": 2,
11856 "steps": [
11857 ]
11858 }
11859 },
11860 {
11861 "subselect_execution": {
11862 "select#": 2,
11863 "steps": [
11864 ]
11865 }
11866 },
11867 {
11868 "subselect_execution": {
11869 "select#": 2,
11870 "steps": [
11871 ]
11872 }
11873 },
11874 {
11875 "subselect_execution": {
11876 "select#": 2,
11877 "steps": [
11878 ]
11879 }
11880 },
11881 {
11882 "subselect_execution": {
11883 "select#": 2,
11884 "steps": [
11885 ]
11886 }
11887 },
11888 {
11889 "subselect_execution": {
11890 "select#": 2,
11891 "steps": [
11892 ]
11893 }
11894 },
11895 {
11896 "subselect_execution": {
11897 "select#": 2,
11898 "steps": [
11899 ]
11900 }
11901 },
11902 {
11903 "subselect_execution": {
11904 "select#": 2,
11905 "steps": [
11906 ]
11907 }
11908 },
11909 {
11910 "subselect_execution": {
11911 "select#": 2,
11912 "steps": [
11913 ]
11914 }
11915 },
11916 {
11917 "subselect_execution": {
11918 "select#": 2,
11919 "steps": [
11920 ]
11921 }
11922 },
11923 {
11924 "subselect_execution": {
11925 "select#": 2,
11926 "steps": [
11927 ]
11928 }
11929 },
11930 {
11931 "subselect_execution": {
11932 "select#": 2,
11933 "steps": [
11934 ]
11935 }
11936 },
11937 {
11938 "subselect_execution": {
11939 "select#": 2,
11940 "steps": [
11941 ]
11942 }
11943 },
11944 {
11945 "subselect_execution": {
11946 "select#": 2,
11947 "steps": [
11948 ]
11949 }
11950 },
11951 {
11952 "subselect_execution": {
11953 "select#": 2,
11954 "steps": [
11955 ]
11956 }
11957 },
11958 {
11959 "subselect_execution": {
11960 "select#": 2,
11961 "steps": [
11962 ]
11963 }
11964 },
11965 {
11966 "subselect_execution": {
11967 "select#": 2,
11968 "steps": [
11969 ]
11970 }
11971 },
11972 {
11973 "subselect_execution": {
11974 "select#": 2,
11975 "steps": [
11976 ]
11977 }
11978 },
11979 {
11980 "subselect_execution": {
11981 "select#": 2,
11982 "steps": [
11983 ]
11984 }
11985 },
11986 {
11987 "subselect_execution": {
11988 "select#": 2,
11989 "steps": [
11990 ]
11991 }
11992 },
11993 {
11994 "subselect_execution": {
11995 "select#": 2,
11996 "steps": [
11997 ]
11998 }
11999 },
12000 {
12001 "subselect_execution": {
12002 "select#": 2,
12003 "steps": [
12004 ]
12005 }
12006 },
12007 {
12008 "subselect_execution": {
12009 "select#": 2,
12010 "steps": [
12011 ]
12012 }
12013 },
12014 {
12015 "subselect_execution": {
12016 "select#": 2,
12017 "steps": [
12018 ]
12019 }
12020 },
12021 {
12022 "subselect_execution": {
12023 "select#": 2,
12024 "steps": [
12025 ]
12026 }
12027 },
12028 {
12029 "subselect_execution": {
12030 "select#": 2,
12031 "steps": [
12032 ]
12033 }
12034 },
12035 {
12036 "subselect_execution": {
12037 "select#": 2,
12038 "steps": [
12039 ]
12040 }
12041 },
12042 {
12043 "subselect_execution": {
12044 "select#": 2,
12045 "steps": [
12046 ]
12047 }
12048 },
12049 {
12050 "subselect_execution": {
12051 "select#": 2,
12052 "steps": [
12053 ]
12054 }
12055 },
12056 {
12057 "subselect_execution": {
12058 "select#": 2,
12059 "steps": [
12060 ]
12061 }
12062 },
12063 {
12064 "subselect_execution": {
12065 "select#": 2,
12066 "steps": [
12067 ]
12068 }
12069 },
12070 {
12071 "subselect_execution": {
12072 "select#": 2,
12073 "steps": [
12074 ]
12075 }
12076 },
12077 {
12078 "subselect_execution": {
12079 "select#": 2,
12080 "steps": [
12081 ]
12082 }
12083 },
12084 {
12085 "subselect_execution": {
12086 "select#": 2,
12087 "steps": [
12088 ]
12089 }
12090 },
12091 {
12092 "subselect_execution": {
12093 "select#": 2,
12094 "steps": [
12095 ]
12096 }
12097 },
12098 {
12099 "subselect_execution": {
12100 "select#": 2,
12101 "steps": [
12102 ]
12103 }
12104 },
12105 {
12106 "subselect_execution": {
12107 "select#": 2,
12108 "steps": [
12109 ]
12110 }
12111 },
12112 {
12113 "subselect_execution": {
12114 "select#": 2,
12115 "steps": [
12116 ]
12117 }
12118 },
12119 {
12120 "subselect_execution": {
12121 "select#": 2,
12122 "steps": [
12123 ]
12124 }
12125 },
12126 {
12127 "subselect_execution": {
12128 "select#": 2,
12129 "steps": [
12130 ]
12131 }
12132 },
12133 {
12134 "subselect_execution": {
12135 "select#": 2,
12136 "steps": [
12137 ]
12138 }
12139 },
12140 {
12141 "subselect_execution": {
12142 "select#": 2,
12143 "steps": [
12144 ]
12145 }
12146 },
12147 {
12148 "subselect_execution": {
12149 "select#": 2,
12150 "steps": [
12151 ]
12152 }
12153 },
12154 {
12155 "subselect_execution": {
12156 "select#": 2,
12157 "steps": [
12158 ]
12159 }
12160 },
12161 {
12162 "subselect_execution": {
12163 "select#": 2,
12164 "steps": [
12165 ]
12166 }
12167 },
12168 {
12169 "subselect_execution": {
12170 "select#": 2,
12171 "steps": [
12172 ]
12173 }
12174 },
12175 {
12176 "subselect_execution": {
12177 "select#": 2,
12178 "steps": [
12179 ]
12180 }
12181 },
12182 {
12183 "subselect_execution": {
12184 "select#": 2,
12185 "steps": [
12186 ]
12187 }
12188 },
12189 {
12190 "subselect_execution": {
12191 "select#": 2,
12192 "steps": [
12193 ]
12194 }
12195 },
12196 {
12197 "subselect_execution": {
12198 "select#": 2,
12199 "steps": [
12200 ]
12201 }
12202 },
12203 {
12204 "subselect_execution": {
12205 "select#": 2,
12206 "steps": [
12207 ]
12208 }
12209 },
12210 {
12211 "subselect_execution": {
12212 "select#": 2,
12213 "steps": [
12214 ]
12215 }
12216 },
12217 {
12218 "subselect_execution": {
12219 "select#": 2,
12220 "steps": [
12221 ]
12222 }
12223 },
12224 {
12225 "subselect_execution": {
12226 "select#": 2,
12227 "steps": [
12228 ]
12229 }
12230 },
12231 {
12232 "subselect_execution": {
12233 "select#": 2,
12234 "steps": [
12235 ]
12236 }
12237 },
12238 {
12239 "subselect_execution": {
12240 "select#": 2,
12241 "steps": [
12242 ]
12243 }
12244 },
12245 {
12246 "subselect_execution": {
12247 "select#": 2,
12248 "steps": [
12249 ]
12250 }
12251 },
12252 {
12253 "subselect_execution": {
12254 "select#": 2,
12255 "steps": [
12256 ]
12257 }
12258 },
12259 {
12260 "subselect_execution": {
12261 "select#": 2,
12262 "steps": [
12263 ]
12264 }
12265 },
12266 {
12267 "subselect_execution": {
12268 "select#": 2,
12269 "steps": [
12270 ]
12271 }
12272 },
12273 {
12274 "subselect_execution": {
12275 "select#": 2,
12276 "steps": [
12277 ]
12278 }
12279 },
12280 {
12281 "subselect_execution": {
12282 "select#": 2,
12283 "steps": [
12284 ]
12285 }
12286 },
12287 {
12288 "subselect_execution": {
12289 "select#": 2,
12290 "steps": [
12291 ]
12292 }
12293 },
12294 {
12295 "subselect_execution": {
12296 "select#": 2,
12297 "steps": [
12298 ]
12299 }
12300 },
12301 {
12302 "subselect_execution": {
12303 "select#": 2,
12304 "steps": [
12305 ]
12306 }
12307 },
12308 {
12309 "subselect_execution": {
12310 "select#": 2,
12311 "steps": [
12312 ]
12313 }
12314 },
12315 {
12316 "subselect_execution": {
12317 "select#": 2,
12318 "steps": [
12319 ]
12320 }
12321 },
12322 {
12323 "subselect_execution": {
12324 "select#": 2,
12325 "steps": [
12326 ]
12327 }
12328 },
12329 {
12330 "subselect_execution": {
12331 "select#": 2,
12332 "steps": [
12333 ]
12334 }
12335 },
12336 {
12337 "subselect_execution": {
12338 "select#": 2,
12339 "steps": [
12340 ]
12341 }
12342 },
12343 {
12344 "subselect_execution": {
12345 "select#": 2,
12346 "steps": [
12347 ]
12348 }
12349 },
12350 {
12351 "subselect_execution": {
12352 "select#": 2,
12353 "steps": [
12354 ]
12355 }
12356 },
12357 {
12358 "subselect_execution": {
12359 "select#": 2,
12360 "steps": [
12361 ]
12362 }
12363 }
12364 ]
12365 }
12366 }
12367 ]
12368 } 0 0
12369 SELECT * FROM t1 WHERE f1 = (SELECT f1 FROM t1 ORDER BY 1 LIMIT 2);
12370 ERROR 21000: Subquery returns more than 1 row
12371 SELECT * FROM information_schema.OPTIMIZER_TRACE;
12372 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
12373 SELECT * FROM t1 WHERE f1 = (SELECT f1 FROM t1 ORDER BY 1 LIMIT 2) {
12374 "steps": [
12375 {
12376 "join_preparation": {
12377 "select#": 1,
12378 "steps": [
12379 {
12380 "join_preparation": {
12381 "select#": 2,
12382 "steps": [
12383 {
12384 "expanded_query": "/* select#2 */ select `t1`.`f1` from `t1` order by `t1`.`f1` limit 2"
12385 }
12386 ]
12387 }
12388 },
12389 {
12390 "expanded_query": "/* select#1 */ select `t1`.`f0` AS `f0`,`t1`.`f1` AS `f1`,`t1`.`f2` AS `f2` from `t1` where (`t1`.`f1` = (/* select#2 */ select `t1`.`f1` from `t1` order by `t1`.`f1` limit 2))"
12391 }
12392 ]
12393 }
12394 },
12395 {
12396 "join_optimization": {
12397 "select#": 1,
12398 "steps": [
12399 {
12400 "condition_processing": {
12401 "condition": "WHERE",
12402 "original_condition": "(`t1`.`f1` = (/* select#2 */ select `t1`.`f1` from `t1` order by `t1`.`f1` limit 2))",
12403 "steps": [
12404 {
12405 "transformation": "equality_propagation",
12406 "subselect_evaluation": [
12407 ],
12408 "resulting_condition": "multiple equal((/* select#2 */ select `t1`.`f1` from `t1` order by `t1`.`f1` limit 2), `t1`.`f1`)"
12409 },
12410 {
12411 "transformation": "constant_propagation",
12412 "resulting_condition": "multiple equal((/* select#2 */ select `t1`.`f1` from `t1` order by `t1`.`f1` limit 2), `t1`.`f1`)"
12413 },
12414 {
12415 "transformation": "trivial_condition_removal",
12416 "resulting_condition": "multiple equal((/* select#2 */ select `t1`.`f1` from `t1` order by `t1`.`f1` limit 2), `t1`.`f1`)"
12417 }
12418 ]
12419 }
12420 },
12421 {
12422 "substitute_generated_columns": {
12423 }
12424 },
12425 {
12426 "table_dependencies": [
12427 {
12428 "table": "`t1`",
12429 "row_may_be_null": false,
12430 "map_bit": 0,
12431 "depends_on_map_bits": [
12432 ]
12433 }
12434 ]
12435 },
12436 {
12437 "ref_optimizer_key_uses": [
12438 ]
12439 },
12440 {
12441 "rows_estimation": [
12442 {
12443 "table": "`t1`",
12444 "table_scan": {
12445 "rows": 500,
12446 "cost": 1.11035
12447 }
12448 }
12449 ]
12450 },
12451 {
12452 "considered_execution_plans": [
12453 {
12454 "plan_prefix": [
12455 ],
12456 "table": "`t1`",
12457 "best_access_path": {
12458 "considered_access_paths": [
12459 {
12460 "rows_to_scan": 500,
12461 "access_type": "scan",
12462 "resulting_rows": 500,
12463 "cost": 51.1104,
12464 "chosen": true
12465 }
12466 ]
12467 },
12468 "condition_filtering_pct": 100,
12469 "rows_for_plan": 500,
12470 "cost_for_plan": 51.1104,
12471 "chosen": true
12472 }
12473 ]
12474 },
12475 {
12476 "attaching_conditions_to_tables": {
12477 "original_condition": "(`t1`.`f1` = (/* select#2 */ select `t1`.`f1` from `t1` order by `t1`.`f1` limit 2))",
12478 "attached_conditions_computation": [
12479 ],
12480 "attached_conditions_summary": [
12481 {
12482 "table": "`t1`",
12483 "attached": "(`t1`.`f1` = (/* select#2 */ select `t1`.`f1` from `t1` order by `t1`.`f1` limit 2))"
12484 }
12485 ]
12486 }
12487 },
12488 {
12489 "finalizing_table_conditions": [
12490 {
12491 "table": "`t1`",
12492 "original_table_condition": "(`t1`.`f1` = (/* select#2 */ select `t1`.`f1` from `t1` order by `t1`.`f1` limit 2))",
12493 "final_table_condition ": "(`t1`.`f1` = (/* select#2 */ select `t1`.`f1` from `t1` order by `t1`.`f1` limit 2))"
12494 }
12495 ]
12496 },
12497 {
12498 "refine_plan": [
12499 {
12500 "table": "`t1`"
12501 }
12502 ]
12503 }
12504 ]
12505 }
12506 },
12507 {
12508 "join_optimization": {
12509 "select#": 2,
12510 "steps": [
12511 {
12512 "substitute_generated_columns": {
12513 }
12514 },
12515 {
12516 "table_dependencies": [
12517 {
12518 "table": "`t1`",
12519 "row_may_be_null": false,
12520 "map_bit": 0,
12521 "depends_on_map_bits": [
12522 ]
12523 }
12524 ]
12525 },
12526 {
12527 "rows_estimation": [
12528 {
12529 "table": "`t1`",
12530 "table_scan": {
12531 "rows": 500,
12532 "cost": 1.11035
12533 }
12534 }
12535 ]
12536 },
12537 {
12538 "considered_execution_plans": [
12539 {
12540 "plan_prefix": [
12541 ],
12542 "table": "`t1`",
12543 "best_access_path": {
12544 "considered_access_paths": [
12545 {
12546 "rows_to_scan": 500,
12547 "access_type": "scan",
12548 "resulting_rows": 500,
12549 "cost": 51.1104,
12550 "chosen": true
12551 }
12552 ]
12553 },
12554 "condition_filtering_pct": 100,
12555 "rows_for_plan": 500,
12556 "cost_for_plan": 51.1104,
12557 "chosen": true
12558 }
12559 ]
12560 },
12561 {
12562 "attaching_conditions_to_tables": {
12563 "original_condition": null,
12564 "attached_conditions_computation": [
12565 ],
12566 "attached_conditions_summary": [
12567 {
12568 "table": "`t1`",
12569 "attached": null
12570 }
12571 ]
12572 }
12573 },
12574 {
12575 "optimizing_distinct_group_by_order_by": {
12576 "simplifying_order_by": {
12577 "original_clause": "`t1`.`f1`",
12578 "items": [
12579 {
12580 "item": "`t1`.`f1`"
12581 }
12582 ],
12583 "resulting_clause_is_simple": true,
12584 "resulting_clause": "`t1`.`f1`"
12585 }
12586 }
12587 },
12588 {
12589 "finalizing_table_conditions": [
12590 ]
12591 },
12592 {
12593 "refine_plan": [
12594 {
12595 "table": "`t1`"
12596 }
12597 ]
12598 },
12599 {
12600 "considering_tmp_tables": [
12601 {
12602 "adding_sort_to_table": "t1"
12603 }
12604 ]
12605 }
12606 ]
12607 }
12608 },
12609 {
12610 "join_execution": {
12611 "select#": 1,
12612 "steps": [
12613 {
12614 "subselect_execution": {
12615 "select#": 2,
12616 "steps": [
12617 {
12618 "join_execution": {
12619 "select#": 2,
12620 "steps": [
12621 {
12622 "sorting_table": "t1",
12623 "filesort_information": [
12624 {
12625 "direction": "asc",
12626 "expression": "`t1`.`f1`"
12627 }
12628 ],
12629 "filesort_priority_queue_optimization": {
12630 "limit": 2,
12631 "chosen": true
12632 },
12633 "filesort_execution": [
12634 ],
12635 "filesort_summary": {
12636 "memory_available": 327680,
12637 "key_size": 9,
12638 "row_size": 14,
12639 "max_rows_per_buffer": 3,
12640 "num_rows_estimate": 500,
12641 "num_rows_found": 500,
12642 "num_initial_chunks_spilled_to_disk": 0,
12643 "peak_memory_used": "NNN",
12644 "sort_algorithm": "std::sort",
12645 "unpacked_addon_fields": "using_priority_queue",
12646 "sort_mode": "<fixed_sort_key, additional_fields>"
12647 }
12648 }
12649 ]
12650 }
12651 }
12652 ]
12653 }
12654 }
12655 ]
12656 }
12657 }
12658 ]
12659 } 0 0
12660 DROP TABLE t1;
12661 DROP VIEW v1, v2;
12662 # end of WL#1393 - Optimizing filesort with small limit
12663 # end of WL#5834 - Add optimizer traces for sorting
12664 # WL#8741 Varlen keys for sorting JSON values
12665 # Note that JSON keys can't use the priority queue optimization for LIMIT,
12666 # since they can be of unbounded length.
12667 set sort_buffer_size= 32768;
12668 CREATE TABLE t(id INT PRIMARY KEY AUTO_INCREMENT, j JSON);
12669 INSERT INTO t(j) VALUES
12670 (NULL), ('true'), ('false'),
12671 ('"abc"'), ('""'), ('"abcd"'), ('"bc"'),
12672 ('"abc\\u0000\\u0000"'),
12673 ('"abc\\u0000"'),
12674 ('0.0'), ('-0.0'), ('9223372036854776000'),
12675 ('1.0e-1'), ('1.0e-2')
12676 ;
12677 SELECT j, JSON_TYPE(j) AS tp FROM t ORDER BY j, id;
12678 j tp
12679 NULL NULL
12680 0.0 DOUBLE
12681 -0.0 DOUBLE
12682 0.01 DOUBLE
12683 0.1 DOUBLE
12684 9223372036854776000 UNSIGNED INTEGER
12685 "" STRING
12686 "abc" STRING
12687 "abc\u0000" STRING
12688 "abc\u0000\u0000" STRING
12689 "abcd" STRING
12690 "bc" STRING
12691 false BOOLEAN
12692 true BOOLEAN
12693 SELECT j, JSON_TYPE(j) AS tp FROM t ORDER BY j, id limit 2 offset 2;
12694 j tp
12695 -0.0 DOUBLE
12696 0.01 DOUBLE
12697 SELECT * FROM information_schema.OPTIMIZER_TRACE;
12698 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
12699 SELECT j, JSON_TYPE(j) AS tp FROM t ORDER BY j, id limit 2 offset 2 {
12700 "steps": [
12701 {
12702 "join_preparation": {
12703 "select#": 1,
12704 "steps": [
12705 {
12706 "expanded_query": "/* select#1 */ select `t`.`j` AS `j`,json_type(`t`.`j`) AS `tp` from `t` order by `t`.`j`,`t`.`id` limit 2,2"
12707 }
12708 ]
12709 }
12710 },
12711 {
12712 "join_optimization": {
12713 "select#": 1,
12714 "steps": [
12715 {
12716 "substitute_generated_columns": {
12717 }
12718 },
12719 {
12720 "table_dependencies": [
12721 {
12722 "table": "`t`",
12723 "row_may_be_null": false,
12724 "map_bit": 0,
12725 "depends_on_map_bits": [
12726 ]
12727 }
12728 ]
12729 },
12730 {
12731 "rows_estimation": [
12732 {
12733 "table": "`t`",
12734 "table_scan": {
12735 "rows": 14,
12736 "cost": 0.518311
12737 }
12738 }
12739 ]
12740 },
12741 {
12742 "considered_execution_plans": [
12743 {
12744 "plan_prefix": [
12745 ],
12746 "table": "`t`",
12747 "best_access_path": {
12748 "considered_access_paths": [
12749 {
12750 "rows_to_scan": 14,
12751 "access_type": "scan",
12752 "resulting_rows": 14,
12753 "cost": 1.91831,
12754 "chosen": true
12755 }
12756 ]
12757 },
12758 "condition_filtering_pct": 100,
12759 "rows_for_plan": 14,
12760 "cost_for_plan": 1.91831,
12761 "chosen": true
12762 }
12763 ]
12764 },
12765 {
12766 "attaching_conditions_to_tables": {
12767 "original_condition": null,
12768 "attached_conditions_computation": [
12769 ],
12770 "attached_conditions_summary": [
12771 {
12772 "table": "`t`",
12773 "attached": null
12774 }
12775 ]
12776 }
12777 },
12778 {
12779 "optimizing_distinct_group_by_order_by": {
12780 "simplifying_order_by": {
12781 "original_clause": "`t`.`j`,`t`.`id`",
12782 "items": [
12783 {
12784 "item": "`t`.`j`"
12785 },
12786 {
12787 "item": "`t`.`id`"
12788 }
12789 ],
12790 "resulting_clause_is_simple": true,
12791 "resulting_clause": "`t`.`j`,`t`.`id`"
12792 }
12793 }
12794 },
12795 {
12796 "finalizing_table_conditions": [
12797 ]
12798 },
12799 {
12800 "refine_plan": [
12801 {
12802 "table": "`t`"
12803 }
12804 ]
12805 },
12806 {
12807 "considering_tmp_tables": [
12808 {
12809 "adding_sort_to_table": "t"
12810 }
12811 ]
12812 }
12813 ]
12814 }
12815 },
12816 {
12817 "join_execution": {
12818 "select#": 1,
12819 "steps": [
12820 {
12821 "sorting_table": "t",
12822 "filesort_information": [
12823 {
12824 "direction": "asc",
12825 "expression": "`t`.`j`"
12826 },
12827 {
12828 "direction": "asc",
12829 "expression": "`t`.`id`"
12830 }
12831 ],
12832 "filesort_priority_queue_optimization": {
12833 "limit": 4,
12834 "usable": false,
12835 "cause": "contains records of unbounded length"
12836 },
12837 "filesort_execution": [
12838 ],
12839 "filesort_summary": {
12840 "memory_available": 32768,
12841 "key_size": 4294967295,
12842 "row_size": 4294967295,
12843 "max_rows_per_buffer": 0,
12844 "num_rows_estimate": 15,
12845 "num_rows_found": 14,
12846 "num_initial_chunks_spilled_to_disk": 0,
12847 "peak_memory_used": "NNN",
12848 "sort_algorithm": "std::sort",
12849 "sort_mode": "<varlen_sort_key, packed_additional_fields>"
12850 }
12851 }
12852 ]
12853 }
12854 }
12855 ]
12856 } 0 0
12857 SELECT j, JSON_TYPE(j) AS tp FROM t ORDER BY j DESC, id;
12858 j tp
12859 true BOOLEAN
12860 false BOOLEAN
12861 "bc" STRING
12862 "abcd" STRING
12863 "abc\u0000\u0000" STRING
12864 "abc\u0000" STRING
12865 "abc" STRING
12866 "" STRING
12867 9223372036854776000 UNSIGNED INTEGER
12868 0.1 DOUBLE
12869 0.01 DOUBLE
12870 0.0 DOUBLE
12871 -0.0 DOUBLE
12872 NULL NULL
12873 SELECT j, JSON_TYPE(j) AS tp FROM t ORDER BY j DESC, id limit 2 offset 2;
12874 j tp
12875 "bc" STRING
12876 "abcd" STRING
12877 SELECT * FROM information_schema.OPTIMIZER_TRACE;
12878 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
12879 SELECT j, JSON_TYPE(j) AS tp FROM t ORDER BY j DESC, id limit 2 offset 2 {
12880 "steps": [
12881 {
12882 "join_preparation": {
12883 "select#": 1,
12884 "steps": [
12885 {
12886 "expanded_query": "/* select#1 */ select `t`.`j` AS `j`,json_type(`t`.`j`) AS `tp` from `t` order by `t`.`j` desc,`t`.`id` limit 2,2"
12887 }
12888 ]
12889 }
12890 },
12891 {
12892 "join_optimization": {
12893 "select#": 1,
12894 "steps": [
12895 {
12896 "substitute_generated_columns": {
12897 }
12898 },
12899 {
12900 "table_dependencies": [
12901 {
12902 "table": "`t`",
12903 "row_may_be_null": false,
12904 "map_bit": 0,
12905 "depends_on_map_bits": [
12906 ]
12907 }
12908 ]
12909 },
12910 {
12911 "rows_estimation": [
12912 {
12913 "table": "`t`",
12914 "table_scan": {
12915 "rows": 14,
12916 "cost": 0.518311
12917 }
12918 }
12919 ]
12920 },
12921 {
12922 "considered_execution_plans": [
12923 {
12924 "plan_prefix": [
12925 ],
12926 "table": "`t`",
12927 "best_access_path": {
12928 "considered_access_paths": [
12929 {
12930 "rows_to_scan": 14,
12931 "access_type": "scan",
12932 "resulting_rows": 14,
12933 "cost": 1.91831,
12934 "chosen": true
12935 }
12936 ]
12937 },
12938 "condition_filtering_pct": 100,
12939 "rows_for_plan": 14,
12940 "cost_for_plan": 1.91831,
12941 "chosen": true
12942 }
12943 ]
12944 },
12945 {
12946 "attaching_conditions_to_tables": {
12947 "original_condition": null,
12948 "attached_conditions_computation": [
12949 ],
12950 "attached_conditions_summary": [
12951 {
12952 "table": "`t`",
12953 "attached": null
12954 }
12955 ]
12956 }
12957 },
12958 {
12959 "optimizing_distinct_group_by_order_by": {
12960 "simplifying_order_by": {
12961 "original_clause": "`t`.`j` desc,`t`.`id`",
12962 "items": [
12963 {
12964 "item": "`t`.`j`"
12965 },
12966 {
12967 "item": "`t`.`id`"
12968 }
12969 ],
12970 "resulting_clause_is_simple": true,
12971 "resulting_clause": "`t`.`j` desc,`t`.`id`"
12972 }
12973 }
12974 },
12975 {
12976 "finalizing_table_conditions": [
12977 ]
12978 },
12979 {
12980 "refine_plan": [
12981 {
12982 "table": "`t`"
12983 }
12984 ]
12985 },
12986 {
12987 "considering_tmp_tables": [
12988 {
12989 "adding_sort_to_table": "t"
12990 }
12991 ]
12992 }
12993 ]
12994 }
12995 },
12996 {
12997 "join_execution": {
12998 "select#": 1,
12999 "steps": [
13000 {
13001 "sorting_table": "t",
13002 "filesort_information": [
13003 {
13004 "direction": "desc",
13005 "expression": "`t`.`j`"
13006 },
13007 {
13008 "direction": "asc",
13009 "expression": "`t`.`id`"
13010 }
13011 ],
13012 "filesort_priority_queue_optimization": {
13013 "limit": 4,
13014 "usable": false,
13015 "cause": "contains records of unbounded length"
13016 },
13017 "filesort_execution": [
13018 ],
13019 "filesort_summary": {
13020 "memory_available": 32768,
13021 "key_size": 4294967295,
13022 "row_size": 4294967295,
13023 "max_rows_per_buffer": 0,
13024 "num_rows_estimate": 15,
13025 "num_rows_found": 14,
13026 "num_initial_chunks_spilled_to_disk": 0,
13027 "peak_memory_used": "NNN",
13028 "sort_algorithm": "std::sort",
13029 "sort_mode": "<varlen_sort_key, packed_additional_fields>"
13030 }
13031 }
13032 ]
13033 }
13034 }
13035 ]
13036 } 0 0
13037 SELECT JSON_EXTRACT(j, '$') AS je, JSON_TYPE(j) AS tp FROM t ORDER BY je, id;
13038 je tp
13039 NULL NULL
13040 0.0 DOUBLE
13041 -0.0 DOUBLE
13042 0.01 DOUBLE
13043 0.1 DOUBLE
13044 9223372036854776000 UNSIGNED INTEGER
13045 "" STRING
13046 "abc" STRING
13047 "abc\u0000" STRING
13048 "abc\u0000\u0000" STRING
13049 "abcd" STRING
13050 "bc" STRING
13051 false BOOLEAN
13052 true BOOLEAN
13053 SELECT JSON_EXTRACT(j, '$') AS je, JSON_TYPE(j) AS tp FROM t ORDER BY je, id
13054 limit 2 offset 2;
13055 je tp
13056 -0.0 DOUBLE
13057 0.01 DOUBLE
13058 SELECT * FROM information_schema.OPTIMIZER_TRACE;
13059 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
13060 SELECT JSON_EXTRACT(j, '$') AS je, JSON_TYPE(j) AS tp FROM t ORDER BY je, id
13061 limit 2 offset 2 {
13062 "steps": [
13063 {
13064 "join_preparation": {
13065 "select#": 1,
13066 "steps": [
13067 {
13068 "expanded_query": "/* select#1 */ select json_extract(`t`.`j`,'$') AS `je`,json_type(`t`.`j`) AS `tp` from `t` order by `je`,`t`.`id` limit 2,2"
13069 }
13070 ]
13071 }
13072 },
13073 {
13074 "join_optimization": {
13075 "select#": 1,
13076 "steps": [
13077 {
13078 "substitute_generated_columns": {
13079 }
13080 },
13081 {
13082 "table_dependencies": [
13083 {
13084 "table": "`t`",
13085 "row_may_be_null": false,
13086 "map_bit": 0,
13087 "depends_on_map_bits": [
13088 ]
13089 }
13090 ]
13091 },
13092 {
13093 "rows_estimation": [
13094 {
13095 "table": "`t`",
13096 "table_scan": {
13097 "rows": 14,
13098 "cost": 0.518311
13099 }
13100 }
13101 ]
13102 },
13103 {
13104 "considered_execution_plans": [
13105 {
13106 "plan_prefix": [
13107 ],
13108 "table": "`t`",
13109 "best_access_path": {
13110 "considered_access_paths": [
13111 {
13112 "rows_to_scan": 14,
13113 "access_type": "scan",
13114 "resulting_rows": 14,
13115 "cost": 1.91831,
13116 "chosen": true
13117 }
13118 ]
13119 },
13120 "condition_filtering_pct": 100,
13121 "rows_for_plan": 14,
13122 "cost_for_plan": 1.91831,
13123 "chosen": true
13124 }
13125 ]
13126 },
13127 {
13128 "attaching_conditions_to_tables": {
13129 "original_condition": null,
13130 "attached_conditions_computation": [
13131 ],
13132 "attached_conditions_summary": [
13133 {
13134 "table": "`t`",
13135 "attached": null
13136 }
13137 ]
13138 }
13139 },
13140 {
13141 "optimizing_distinct_group_by_order_by": {
13142 "simplifying_order_by": {
13143 "original_clause": "`je`,`t`.`id`",
13144 "items": [
13145 {
13146 "item": "json_extract(`t`.`j`,'$')"
13147 },
13148 {
13149 "item": "`t`.`id`"
13150 }
13151 ],
13152 "resulting_clause_is_simple": true,
13153 "resulting_clause": "`je`,`t`.`id`"
13154 }
13155 }
13156 },
13157 {
13158 "finalizing_table_conditions": [
13159 ]
13160 },
13161 {
13162 "refine_plan": [
13163 {
13164 "table": "`t`"
13165 }
13166 ]
13167 },
13168 {
13169 "considering_tmp_tables": [
13170 {
13171 "adding_sort_to_table": "t"
13172 }
13173 ]
13174 }
13175 ]
13176 }
13177 },
13178 {
13179 "join_execution": {
13180 "select#": 1,
13181 "steps": [
13182 {
13183 "sorting_table": "t",
13184 "filesort_information": [
13185 {
13186 "direction": "asc",
13187 "expression": "json_extract(`t`.`j`,'$')"
13188 },
13189 {
13190 "direction": "asc",
13191 "expression": "`t`.`id`"
13192 }
13193 ],
13194 "filesort_priority_queue_optimization": {
13195 "limit": 4,
13196 "usable": false,
13197 "cause": "contains records of unbounded length"
13198 },
13199 "filesort_execution": [
13200 ],
13201 "filesort_summary": {
13202 "memory_available": 32768,
13203 "key_size": 4294967295,
13204 "row_size": 4294967295,
13205 "max_rows_per_buffer": 0,
13206 "num_rows_estimate": 15,
13207 "num_rows_found": 14,
13208 "num_initial_chunks_spilled_to_disk": 0,
13209 "peak_memory_used": "NNN",
13210 "sort_algorithm": "std::sort",
13211 "sort_mode": "<varlen_sort_key, packed_additional_fields>"
13212 }
13213 }
13214 ]
13215 }
13216 }
13217 ]
13218 } 0 0
13219 DROP TABLE t;
13220 # --end of WL#8741 Varlen keys for sorting JSON values