Introduction
As it is known MySQL database server doesn’t have its own stored procedure debugging engine. Our company implemented custom debugging solution in dbForge for MySQL product line. And for new users it’s not always clear how it works. So we feel we need to clarify some aspects of implementation.
Here are common questions about debugging engine and answers to them.
What does ‘Deploy Debug Engine’ command do exactly?
Deploy Debug Engine command creates database named cr_debug with a set of stored procedures, functions and tables required for debugging.
To deploy debug engine your account needs to have PROCESS global privilege and the following privileges on cr_debug database (or global ones):
- SELECT
- CREATE
- DROP
- CREATE ROUTINE
What happens with procedure after executing ‘Compile for Debugging’ command?
When user invokes Compile for Debugging command application inserts special trace calls (referencing cr_debug database) into procedure code. They are required to perform step-by-step debugging. These trace calls are not displayed when you edit procedure in internal editor of dbForge Studio for MySQL (dbForge Fusion for MySQL).
Does debug engine slow down the server?
Debug engine does not affect server performance unless you start debugging session.
Debugging session (started when you step in into specific procedure), indeed, can slow down the server. This happens because executing trace calls from stored routine’s code within debugging session puts addition workload onto the server.
Stored routine with debug information when invoked outside the debugging session executes slightly slower because trace calls are still performed though they actually do nothing.
MySQL does not perform any sort of stored code compilation, so what does ‘Compile’ command do?
Compile command removes debug information from stored routine’s code. If it does not contain debug information compilation does nothing.
How can I remove debug information from all procedures in my database at once?
To remove debug information from stored procedures you need to do following.
- Go to Database Explorer window
- Open Procedures (Functions, Triggers) branch of your database subtree
- Select all procedures (functions, triggers) using Shift + Left Mouse Click
- Open popup menu and execute Compile command
How can I remove debug engine from server for production?
Debug engine itself does not affect other databases on server. To remove it you need to drop cr_debug database.
Important Note: If you drop cr_debug database without removing debug information from procedures you debugged you won’t be able to execute them until you clear debug information.