Fix test cases to remove hardcoded expected number for 'handler_next_read'
status variable. Apparently, number of rows in I_S.routines depends on
whether or not 'sys' schema is loaded, and this depends on whether or not
perfschema is compiled in.
For queries like
"SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
WHERE SPECIFIC_NAME='proc_name'"
and
"SELECT * FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_NAME='proc_name'"
there is a possibility to avoid loading of the stored procedure code
and parsing it to retrieve parameters.
If the name of the procedure/function is specified explicitly then
it is possible to filter out routines that do not match at
an early stage.
Queries to INFORMATION_SCHEMA.PARAMETERS and ROUTINES tables are always
performed using full index scan of the mysql.proc primary key
on fields (`db`,`name`,`type`). This can be done in a much more effective
way if `db` and `name` field values can be derived from the WHERE statement,
like here:
SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
WHERE SPECIFIC_SCHEMA = 'test' AND SPECIFIC_NAME = 'my_func'
or here:
SELECT * FROM information_schema.ROUTINES
WHERE ROUTINE_SCHEMA='test' AND ROUTINE_NAME='my_func'.
In such cases index range scan may be employed instead of full index
scan. This commit makes the server retrieve lookup field values from
the SQL statement and perform index range scan instead of full index
scan if possible.