Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
12.2
-
None
-
Can result in unexpected behaviour
Description
CREATE OR REPLACE TABLE t1 (a INT); |
CREATE OR REPLACE TABLE t2 (a INT); |
DELIMITER $$
|
CREATE OR REPLACE PROCEDURE p1() |
BEGIN
|
DECLARE c CURSOR FOR SELECT COUNT(a), SLEEP(0.05) FROM t2; |
OPEN c; |
CLOSE c; |
SELECT COUNT(a), SLEEP(0.05) FROM t1; |
END; |
$$
|
DELIMITER ;
|
|
SET GLOBAL slow_query_log=ON; |
SET SESSION authorization root@localhost; |
SET SESSION log_slow_verbosity='explain'; |
SET log_slow_disabled_statements=admin; |
SET long_query_time=0.01; |
USE test; |
CALL p1();
|
# User@Host: root[root] @ localhost []
|
# Thread_id: 3 Schema: test QC_hit: No
|
# Query_time: 0.100438 Lock_time: 0.050300 Rows_sent: 1 Rows_examined: 0
|
# Rows_affected: 0 Bytes_sent: 105
|
# Stored_routine: test.p1
|
SET timestamp=1768974530;
|
SELECT COUNT(a), SLEEP(0.05) FROM t1;
|
# User@Host: root[root] @ localhost []
|
# Thread_id: 3 Schema: test QC_hit: No
|
# Query_time: 0.100488 Lock_time: 0.000012 Rows_sent: 1 Rows_examined: 0
|
# Rows_affected: 0 Bytes_sent: 116
|
SET timestamp=1768974530;
|
CALL p1();
|
Problems:
- The slow log record for the SELECT FROM t1 statement has an entry in the log, while the cursor OPEN statement does not.
- The Query_time in the slow log entry for the SELECT FROM t1 does not look correct. It likely includes the time spent on the OPEN statement.
Note, there is also a problem that the SELECT FROM t1 statement does not have an Explain entry. This is reported in a separate issue MDEV-38611.
Attachments
Issue Links
- relates to
-
MDEV-33830 Support for cursors on prepared statements
-
- Approved
-
-
MDEV-38611 Procedure statements do not write Explain entries to the slow log
-
- Open
-
-
MDEV-38614 Procedure statements write wrong Query_time into slow log
-
- Open
-