| Bug #80922 | Number of warnings influences execution time of next query with stored function | ||
|---|---|---|---|
| Submitted: | 31 Mar 2016 11:39 | Modified: | 1 Jul 2016 16:44 |
| Reporter: | Andrii Nikitin | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Stored Routines | Severity: | S3 (Non-critical) |
| Version: | 5.6.28 | OS: | Any |
| Assigned to: | Andrii Nikitin | CPU Architecture: | Any |
[31 Mar 2016 12:22]
Andrii Nikitin
Cannot repeat in 5.1.60
[1 Jul 2016 16:44]
Paul DuBois
Posted by developer: Noted in 5.7.2 changelog. The execution time of a query involving a stored function was affected by the number of warnings generated by the previous statement in the same session.

Description: Execution time of query with stored function may be affected by number of warnings generated by previous command in the same connection. (If stored function exists in SELECT or WHERE clause - total execution time may increase in several times.) According to my tests the problem doesn't happen in 5.7.11 . How to repeat: 1. Create function: CREATE FUNCTION f1(a int) returns bool DETERMINISTIC return true; 2. If you run simple benchmark - it should show stable execution time: > do benchmark(500000, f1(1)); Query OK, 0 rows affected (0.43 sec) 3. Now generate many warnings, e.g. with: > do benchmark(10000, f1('aaa')); 4. Now execution time is much bigger: > do benchmark(500000, f1(1)); Query OK, 0 rows affected (3.76 sec) 5. Now reduce number of warnings, e.g. by executing: > do benchmark(1, f1('aaa')); 6. Observe execution time of the same benchmark is back to the same as in step #2 > do benchmark(500000, f1(1)); Query OK, 0 rows affected (0.62 sec) Suggested fix: Clear warning context properly