Skip to content

fix(plugin-mysql): avoid repeated routine parameter catalog scans - #3839

Closed
J2TeamNNL wants to merge 3 commits into
TableProApp:mainfrom
J2TeamNNL:codex/fix-mysql-routine-listing-3835
Closed

J2TeamNNL wants to merge 3 commits into
TableProApp:mainfrom
J2TeamNNL:codex/fix-mysql-routine-listing-3835

Conversation

@J2TeamNNL

@J2TeamNNL J2TeamNNL commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Fix slow MySQL routine discovery by reading routine headers and grouped parameter lists once per schema, then merging in Swift by schema, name and routine kind. Definitions still load through SHOW CREATE on demand.
  • The old correlated PARAMETERS subquery repeats catalog work for every routine on MySQL 5.6. Two separate reads also avoid adding a catalog join, following the existing foreign-key path's ShardingSphere-Proxy compatibility constraint.
  • Preserve empty argument lists, same-name procedures/functions and the pre-5.5.3 path without a PARAMETERS catalog. Group catalog names as bytes so case-distinct schemas cannot share signatures. Add regression tests and an isolated Docker probe.

Test plan

  • MySQL 5.6.51, three databases, 503 routines in the selected database, three rounds using the actual Swift builders and merge:

    Query Time
    MySQL 5.6.51, previous query 9.55–10.38 s
    MySQL 5.6.51, two reads 0.215–0.249 s
    MariaDB 10.11.18, previous query 4.33–4.66 s
    MariaDB 10.11.18, two reads 0.126–0.144 s

    All 503 rows match on both servers, including no-argument routines and same-name procedures/functions. A separate fixture checks case-distinct schema signatures. MariaDB used the same probe with its image/platform/readiness marker substituted. With 9 routines, the extra read costs more: 0.147–0.174 s versus 0.080–0.100 s. Timings include Docker CLI overhead, not UI rendering.

  • Reproduce: python3 apple/scripts/probes/check-mysql-routine-listing.py --base c8512d092. It removes its container and volume.

  • 136 MySQLCore tests pass in an isolated SwiftPM harness using the repository's module sources, test sources and compiler settings. The catalog regression test fails with the old routineList implementation restored in a separate copy.

  • MySQLDriver unsigned build and lint pass. A native plugin smoke test fetched 503 routines in 84 ms; the server log records exactly two catalog reads, then one SHOW CREATE only when explicitly requested. Independent Codex review found no remaining actionable issues.

  • Local Xcode 26.3: the normal package test command stops before tests at unchanged TabularSorter.swift:168; full app build lacks upstream signing profiles. AllPlugins stops at unchanged SQLitePlugin.swift:190–192 (closure captures backend before declaration). No claim of reproducing an indefinite UI freeze.

Fixes #3835

@J2TeamNNL

Copy link
Copy Markdown
Contributor Author

Closing in favor of #3840, which covers the same routine-listing performance fix and also addresses long parameter signatures, case-sensitive schema filtering, and MariaDB package filtering. The measurements and reproduction notes here remain available as supporting evidence. Keeping the branch and commits for reference.

@J2TeamNNL J2TeamNNL closed this Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport release/0.82 Merged into main; pick onto release/0.82 backport release/0.83 Merged into main; pick onto release/0.83

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug/Performance] App freezes indefinitely when listing Stored Procedures & Functions on MySQL instances with many routines

1 participant