Fix MariaDB query cache efficiency underreporting#928
Draft
Copilot wants to merge 2 commits into
Draft
Conversation
On MariaDB, Com_select already includes Qcache_hits, so the correct
efficiency formula is Qcache_hits / Com_select rather than the MySQL
formula Qcache_hits / (Com_select + Qcache_hits).
- In calculations(): use the already-computed $is_mariadb variable
(detected before the version string is stripped) and store it in
$mycalc{'is_mariadb'} for downstream use
- In mysql_stats(): use $mycalc{'is_mariadb'} to select the correct
denominator in the display string
- Add tests/issue_927.t to verify both the MariaDB and MySQL formulas
Copilot
AI
changed the title
[WIP] Fix reported efficiency of MariaDB query cache
Fix MariaDB query cache efficiency underreporting
Jun 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On MariaDB,
Com_selectalready includesQcache_hits(verified:Qcache_hits + Qcache_inserts + Qcache_not_cached ≈ Com_select). The old MySQL formulaQcache_hits / (Com_select + Qcache_hits)double-counts hits in the denominator, producing ~45% where the real hit ratio is ~84%.Changes
calculations(): UseQcache_hits / Com_selectfor MariaDB; keepQcache_hits / (Com_select + Qcache_hits)for MySQL. Uses the existing$is_mariadblocal variable (computed before the function strips the-MariaDBsuffix from$myvar{'version'}). Stores result in$mycalc{'is_mariadb'}for downstream use.mysql_stats(): Use$mycalc{'is_mariadb'}to display the correct denominator (Com_selectvsCom_select + Qcache_hits).tests/issue_927.t: New test asserting the MariaDB formula yields ~84.4% and the MySQL formula is unchanged for non-MariaDB versions.