Bug #76281 possible false positive for "Prepared Statements Not Being Closed"
Submitted: 12 Mar 2015 9:27 Modified: 12 Mar 2015 9:38
Reporter: Daniël van Eeden (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Enterprise Monitor: Advisors/Rules Severity:S3 (Non-critical)
Version:3.0.20 OS:Any
Assigned to: CPU Architecture:Any
Tags: false postive, prepared statements

[12 Mar 2015 9:27] Daniël van Eeden
Description:
This advisor creates a warning in this situation:
Com_stmt_prepare = 2
Com_stmt_close = 1

Expression
(%Com_stmt_prepare% > 1) && ((100 * (%Com_stmt_close% / %Com_stmt_prepare%)) < THRESHOLD) 

Evaluated Expression
(2 > 1) && ((100 * (1 / 2)) < 60)

(3 > 2) && ((100 * (1 / 3)) < 60)

How to repeat:
See description.

Suggested fix:
Make sure Com_stmt_prepare is greater than 2:

(%Com_stmt_prepare% > 2) && ((100 * (%Com_stmt_close% / %Com_stmt_prepare%)) < THRESHOLD)

Alternative: Make sure there are 2 more prepare's than closes:
(%Com_stmt_prepare% > 1) && (%Com_stmt_prepare% > %Com_stmt_close% + 1) && ((100 * (%Com_stmt_close% / %Com_stmt_prepare%)) < THRESHOLD)
[12 Mar 2015 9:38] MySQL Verification Team
Hello Daniël,

Thank you for the report.

Thanks,
Umesh