Bug #97496 SQL not record in ps when useCursorFetch or useServerPrepStmts is true
Submitted: 5 Nov 2019 15:31 Modified: 22 Jul 2021 15:52
Reporter: 镇熙 林 Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:5.1.48, 8.0.18 OS:Any
Assigned to: CPU Architecture:Any
Tags: events_statements_summary_by_digest, performance_schema, useCursorFetch, useServerPrepStmts

[5 Nov 2019 15:31] 镇熙 林
Description:
In case of useCursorFetch=true or useServerPrepStmts=true, and SQL with binding variable (?), SQL would not record in performance_schema.events_statements_summary_by_digest.

useCursorFetch	useServerPrepStmts	setFetchSize	select+const	select+variable	insert+const	insert+variable
------------------------------------------------------------------------
0	0	0	Y	Y	Y	Y
0	0	1	Y	Y	Y	Y
0	1	0	Y	N	Y	N	
0	1	1	Y	N	Y	N
1	0	0	Y	N	Y	N
1	0	1	N	N	N	N
1	1	0	Y	N	Y	N
1	1	1	N	N	Y	N

How to repeat:
I ran demo by <useprep.sh> and <TestUsePrep.java> and got result <useprep.sh.log>.
[5 Nov 2019 15:32] 镇熙 林
demo for java

Attachment: TestUsePrep.java (application/octet-stream, text), 2.18 KiB.

[5 Nov 2019 15:33] 镇熙 林
demo for shell script

Attachment: useprep.sh (application/octet-stream, text), 3.85 KiB.

[5 Nov 2019 15:33] 镇熙 林
demo result

Attachment: useprep.sh.log (text/plain), 27.89 KiB.

[14 Nov 2019 11:46] MySQL Verification Team
Hello!

Thank you for the report and test case.

regards,
Umesh
[22 Jul 2021 15:52] Alexander Soklakov
Posted by developer:
 
Hello,

This is not a c/J bug, but a known limitation on the server side. Prepared statements are not tracked by performance_schema.events_statements_summary_by_digest.

Thanks,
Alex