query: SET OPTIMIZER_USE_MRR = 'DISABLE' | EXPLAIN select | EXPLAIN select | EXPLAIN select | EXPLAIN select | select | select | select | select ; select: SELECT outer_select_item FROM outer_from WHERE subquery_expression logical_operator outer_condition_top outer_group_by outer_having limit; outer_select_item: OUTR . field_name AS X | aggregate_function OUTR . field_name ) AS X; aggregate_function: AVG( | BIT_AND( | BIT_OR( | BIT_XOR( | COUNT(DISTINCT | COUNT( | GROUP_CONCAT( | MIN( | MIN(DISTINCT | MAX( | MAX(DISTINCT | STD( | STDDEV_POP( | STDDEV_SAMP( | SUM( | SUM(DISTINCT | VAR_POP( | VAR_SAMP( | VARIANCE( ; aggregate_function_disabled: AVG(DISTINCT ; outer_from: outer_table_name AS OUTR | outer_table_name AS OUTR2 LEFT JOIN outer_table_name AS OUTR ON ( OUTR2 . field_name arithmetic_operator OUTR . field_name ); outer_group_by: | GROUP BY OUTR . field_name | GROUP BY OUTR . field_name WITH ROLLUP; outer_having: | HAVING X arithmetic_operator value ; limit: | LIMIT digit ; select_inner: SELECT inner_select_item FROM inner_from WHERE inner_condition_top inner_group_by inner_having; select_inner_two_cols: SELECT INNR . field_name AS X , INNR . field_name AS Z FROM inner_from WHERE inner_condition_top inner_group_by inner_having; inner_group_by: ; inner_group_by_disabled: | GROUP BY INNR . field_name | GROUP BY INNR . field_name WITH ROLLUP; inner_having: | HAVING X arithmetic_operator value ; inner_select_item: INNR . field_name AS Y | aggregate_function INNR . field_name ) AS Y ; inner_from: inner_table_name AS INNR | inner_table_name AS INNR2 LEFT JOIN inner_table_name AS INNR ON ( INNR2 . field_name arithmetic_operator INNR . field_name ); select_inner_one_row: select_inner LIMIT 1; outer_condition_top: outer_condition_bottom | ( outer_condition_bottom logical_operator outer_condition_bottom ) | outer_condition_bottom logical_operator outer_condition_bottom ; outer_condition_bottom: OUTR . field_name null_operator | OUTR . field_name arithmetic_operator value | OUTR . field_name arithmetic_operator OUTR . field_name; inner_condition_top: inner_condition_bottom | outer_condition_bottom | inner_condition_bottom logical_operator inner_condition_bottom | inner_condition_bottom logical_operator outer_condition_bottom ; inner_condition_bottom: INNR . field_name null_operator | INNR . field_name arithmetic_operator value | INNR . field_name arithmetic_operator INNR . field_name; INNR . field_name arithmetic_operator OUTR . field_name; null_operator: IS NULL | IS NOT NULL ; logical_operator: AND | OR | AND NOT ; arithmetic_operator: = | > | < | <> | >= | <= ; subquery_expression: EXISTS ( select_inner ) | NOT EXISTS ( select_inner ) | OUTR . field_name IN ( select_inner ) | ( OUTR . field_name , OUTR . field_name ) IN ( select_inner_two_cols ) | OUTR . field_name NOT IN ( select_inner ) | ( OUTR . field_name , OUTR . field_name ) NOT IN ( select_inner_two_cols ) | OUTR . field_name arithmetic_operator ( select_inner_one_row ) | OUTR . field_name arithmetic_operator subquery_word ( select_inner ) ; subquery_word: SOME | ANY | ALL ; field_name: `pk` | `int_key` | `int_nokey` | `date_key` | `date_nokey` | `time_key` | `time_nokey` | `datetime_key` | `datetime_nokey` ; outer_table_name: A | B | C ; inner_table_name: AA | BB | CC ; value: tinyint_unsigned | date | time | datetime ;