[MDEV-4171] Long recall procedures Created: 2013-02-13 Updated: 2018-07-17 Resolved: 2018-07-17 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.0.1, 5.5.29, 5.3.12, 5.5, 10.0 |
| Fix Version/s: | 5.5.61, 10.0.36 |
| Type: | Bug | Priority: | Major |
| Reporter: | Polyatykin Aleksey | Assignee: | Oleksandr Byelkin |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | upstream-fixed | ||
| Attachments: |
|
| Description |
|
http://bugs.mysql.com/bug.php?id=68350 second time next time How to repeat: USE `dekanat`$$ DROP PROCEDURE IF EXISTS `rozklad`$$ CREATE DEFINER=`root`@`localhost` PROCEDURE `rozklad`(IN iRik YEAR)
LEFT JOIN DELIMITER ; ------------------------------------------------------------------------ |
| Comments |
| Comment by Elena Stepanova [ 2013-02-13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Aleksey, Would it be possible to provide a dump of the database (preferably with data, but if it's strictly confidential, at least the table structures)? Please also attach output of SHOW VARIABLES from the session where you observe the described problem. Thank you. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2013-02-14 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
As expected, the problem is not reproducible on empty tables. I will try to generate some artificial data, but it will take some time since there are many tables participating in the query, and they have join conditions so the data cannot be purely random. Aleksey, The whole procedure in question is just one SELECT. What happens if you execute the SELECT outside the procedure, do you also observe a slow down on the 2nd and further executions? If so, could you please run EXPLAIN on the first and the second execution and paste its result here? If you don't observe the problem outside the procedure, can you modify the procedure so that it runs EXPLAIN SELECT before the SELECT, and, again, paste the result of the first and second EXPLAIN here? If it so happens that the problem disappears after you add EXPLAIN, could you please give any idea on how big the tables are (hundreds, thousands or records) – in some cases I can make a reasonable guess based on the table name, but not always; also, approximately how many rows does the query from the procedure produce? Thanks. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2013-02-17 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Shane created a good test case for MySQL, but it doesn't reproduce the bug on MariaDB 10.0.1 (at least not with default settings), so we still need to work on it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2013-02-20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I've created synthetic data for the reporter's schema which allows to reproduce the problem. I've also simplified the query a bit, and removed unnecessary structures. The procedure now looks like this: CREATE PROCEDURE pr(in iRik year) To reproduce,
Result: MariaDB [test]> call pr(2012);
----------
---------- Query OK, 0 rows affected (3.12 sec) MariaDB [test]> call pr(2012);
----------
---------- ANALYZE or FLUSH TABLES doesn't change anything. -----
-----
-----
However, SHOW STATUS reveals a difference.
---------------------------
--------------------------- FLUSH STATUS, second execution of the procedure:
---------------------------
--------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2013-02-20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Sanja, I switched priority to Minor for now, because there are still chances it's the upstream bug #68350, in which case it might make sense to wait for the fix to see if it's appropriate and applicable. However, I'm not sure it will be the case, since the test case from #68350 does not reproduce the issue on MariaDB. If you think it needs to be fixed independently in MariaDB, please feel free to change the priority to whatever you find suitable. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2013-02-21 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
here is the difference in explainn of 2 executions: the full explain for both calls is here: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2013-02-21 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The test suite to see explain difference (needs mysqltest recompile) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2013-02-25 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
To the t3 which loose "Using index" added alias (t33) to catch it in setup_table_map(), then set watchpoint on its covering_keys->map, then on the second execution appaared that this table has alias just t3 and so GROUP_CONCAT fix_fields drop covering_keys->map (i.e. table was used in the derived table). I can't explain (yet) how it happened) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2013-02-26 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
covering_keys is part of TABLE so it is no surprize that it does not stay after reopen. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Patryk Pomykalski [ 2013-06-23 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I couldn't reproduce it on latest 5.5 and 10.0-base. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Polyatykin Aleksey [ 2013-09-21 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2014-11-09 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Still reproducible on the current 5.5 and 10.0 (revno 4471). The upstream bug was fixed in 5.6.12, so there is no point waiting any longer:
Please consider either merging the fix if applicable or fixing it independently. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2018-07-17 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Yes. It looks like a fixed. But inability to make tests automatically prevent me to find what commit did it. |