summaryrefslogtreecommitdiff
path: root/sql/sql_yacc.yy
diff options
context:
space:
mode:
authorunknown <timour@askmonty.org>2012-03-11 14:39:20 +0200
committerunknown <timour@askmonty.org>2012-03-11 14:39:20 +0200
commit8aebd44e0ea9c4ae6f573f1ece27b276452122b8 (patch)
treee2907ea46e4680c18b85dace99b5ea00d5735043 /sql/sql_yacc.yy
parentf92cfdb8a9ff7f8287239c39ce4735789a23e3df (diff)
downloadmariadb-git-8aebd44e0ea9c4ae6f573f1ece27b276452122b8.tar.gz
Implementation of MDEV-28 LIMIT ROWS EXAMINED
https://mariadb.atlassian.net/browse/MDEV-28 This task implements a new clause LIMIT ROWS EXAMINED <num> as an extention to the ANSI LIMIT clause. This extension allows to limit the number of rows and/or keys a query would access (read and/or write) during query execution.
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r--sql/sql_yacc.yy15
1 files changed, 15 insertions, 0 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 084314ff23f..6e383fedf71 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -865,6 +865,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token EVENTS_SYM
%token EVENT_SYM
%token EVERY_SYM /* SQL-2003-N */
+%token EXAMINED_SYM
%token EXECUTE_SYM /* SQL-2003-R */
%token EXISTS /* SQL-2003-R */
%token EXIT_SYM
@@ -9620,6 +9621,7 @@ opt_limit_clause_init:
SELECT_LEX *sel= lex->current_select;
sel->offset_limit= 0;
sel->select_limit= 0;
+ lex->limit_rows_examined= 0;
}
| limit_clause {}
;
@@ -9631,6 +9633,8 @@ opt_limit_clause:
limit_clause:
LIMIT limit_options {}
+ | LIMIT limit_options ROWS_SYM EXAMINED_SYM limit_rows_option {}
+ | LIMIT ROWS_SYM EXAMINED_SYM limit_rows_option {}
;
limit_options:
@@ -9682,6 +9686,13 @@ limit_option:
}
;
+limit_rows_option:
+ limit_option
+ {
+ LEX *lex=Lex;
+ lex->limit_rows_examined= $1;
+ }
+
delete_limit_clause:
/* empty */
{
@@ -9694,6 +9705,8 @@ delete_limit_clause:
sel->select_limit= $2;
sel->explicit_limit= 1;
}
+ | LIMIT ROWS_SYM EXAMINED_SYM { my_parse_error(ER(ER_SYNTAX_ERROR)); MYSQL_YYABORT; }
+ | LIMIT limit_option ROWS_SYM EXAMINED_SYM { my_parse_error(ER(ER_SYNTAX_ERROR)); MYSQL_YYABORT; }
;
int_num:
@@ -12131,6 +12144,7 @@ keyword:
| DO_SYM {}
| END {}
| EXECUTE_SYM {}
+ | EXAMINED_SYM {}
| FLUSH_SYM {}
| HANDLER_SYM {}
| HELP_SYM {}
@@ -13011,6 +13025,7 @@ handler:
MYSQL_YYABORT;
lex->current_select->select_limit= one;
lex->current_select->offset_limit= 0;
+ lex->limit_rows_examined= 0;
if (!lex->current_select->add_table_to_list(lex->thd, $2, 0, 0))
MYSQL_YYABORT;
}