Repository navigation
Labels
bugSomething isn't working
Description
What happened?
Environment
- OS: macOS
- TablePro Version: Latest
- Database Engine: MySQL 5.6.51 (legacy)
- Schema Context: Server hosting multiple databases with a high volume of Stored Procedures and Functions.
Description
When connected to a MySQL database that contains a large number of Stored Procedures and Functions, clicking on or attempting to expand/search the Routines (SPs/Functions) section causes TablePro to hang or freeze indefinitely. The list of routines never loads, and the application becomes unresponsive.
Other clients (such as Navicat or DBeaver) are able to inspect the schema without freezing because they use lightweight metadata queries and lazy loading.
Steps to reproduce
Steps to Reproduce
- Establish a connection to a MySQL instance (e.g., MySQL 5.6.x) containing a database with several hundred Stored Procedures and Functions.
- Select or enter the specific database.
- Attempt to expand the Stored Procedures / Functions list in the sidebar or search routines.
- Result: The UI enters a perpetual loading state or freezes completely; routines are never returned.
Expected behavior
Expected Behavior
- The schema browser should quickly display the routine names and types (e.g., in a virtualized list).
- Routine bodies/definitions should only be fetched on demand (lazy loaded) when the user clicks to open or edit a specific procedure.
- The UI thread should remain responsive while metadata queries are being executed in the background.
Actual Behavior
- The application freezes/locks up completely, likely due to an unindexed, heavy query on
information_schema.ROUTINESpulling full routine definitions, or an unhandled client socket timeout while waiting for massive metadata payloads.
Root Cause Analysis & Technical Context
- Eager fetching of
ROUTINE_DEFINITION:
Many database clients runSELECT * FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = '...'. In MySQL 5.6, this forces the engine to compile and serialize the entire routine body for every single procedure into memory/disk temp tables, causing high latency and packet payload bloat. - Missing Lazy Loading:
Clients that handle this smoothly (like Navicat) separate the discovery phase from the definition fetch:- For listing: they only request lightweight headers (e.g.,
SHOW PROCEDURE STATUS WHERE Db = '...'orSELECT ROUTINE_NAME, ROUTINE_TYPE FROM information_schema.ROUTINES). - For editing: they run
SHOW CREATE PROCEDURE <name>only when a specific routine is opened.
- For listing: they only request lightweight headers (e.g.,
- UI Virtualization:
Rendering thousands of routine nodes directly in the DOM/tree without virtualization can lock the main process thread.
Suggested Fix
- Omit routine body on tree load: Only fetch
ROUTINE_NAME,ROUTINE_TYPE,DEFINER, andLAST_ALTEREDwhen populating the sidebar tree. - Fetch DDL on demand: Execute
SHOW CREATE PROCEDURE / FUNCTION <name>only upon user interaction. - Fallback/alternative for legacy MySQL: For MySQL 5.1–5.6, consider querying
SHOW PROCEDURE STATUS WHERE Db = DATABASE()or reading lightweight columns frommysql.procto avoidinformation_schemalocks.
Database type
MySQL / MariaDB
TablePro version
0.82.2
Platform
macOS
OS version & hardware
macOS Golgen Gate 27.0.1
Installed from (Linux)
None
Debugging information (Linux)
Screenshots / Logs

Activity
J2TeamNNL commentedon Oct 26, 2026
Reproduced slow routine discovery on MySQL 5.6.51 and opened #3839.
The listing already avoids ROUTINE_DEFINITION and fetches DDL with SHOW CREATE on demand. The measured bottleneck is the correlated information_schema.PARAMETERS subquery: it repeats parameter-catalog work for each routine.
With three databases and 503 routines in the selected database, three runs measured:
The actual Swift merge returned the same metadata for every row, including no-argument routines and same-name procedures/functions. Byte grouping also keeps parameter signatures separate for case-distinct schema names. A native smoke test of the rebuilt plugin fetched 503 routines in 84 ms; its server log shows two catalog reads and SHOW CREATE only on explicit request. This reproduces the slow database query, not an indefinite UI freeze. Timings include Docker CLI overhead.
The PR keeps the catalogs separate rather than using a derived-table join, following the driver's existing foreign-key compatibility path for ShardingSphere-Proxy. It preserves the legacy path without a PARAMETERS catalog and leaves DDL loading on demand. Two queries add a round trip; a small 9-routine dataset was slower (0.147–0.174 s versus 0.080–0.100 s).
The PR includes regression tests, the reason in code comments, and a self-cleaning probe:
python3 apple/scripts/probes/check-mysql-routine-listing.py --base c8512d092Local MySQLDriver build, lint and 136 isolated MySQLCore tests pass. Full verification limits and CI status are recorded in the PR.