Devart Blog

Questions About Debugger for MySQL

Posted by on November 26th, 2008

Introduction

As it is known MySQL database server doesn’t have its own stored procedure debugging engine. Devart company implemented custom mysql debug solution in dbForge for MySQL product line for debugging mysql procedures, mysql functions etc. And for new users it’s not always clear how it works. So we feel we need to clarify some aspects of implementation of debugger tool.

Here are common questions about mysql 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 debugger.

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 sql debugging. These trace calls are not displayed when you edit procedure in internal editor of dbForge Studio for MySQL (dbForge Fusion for MySQL).

Does debugger for mysql 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 MySQL 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 sql debug information from stored routine’s code. If it does not contain code 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.

  1. Go to Database Explorer window
  2. Open Procedures (Functions, Triggers) branch of your database subtree
  3. Select all procedures (functions, triggers) using Shift + Left Mouse Click
  4. Open popup menu and execute Compile command

How can I remove debug engine from MySQL 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.

Debugging of stored procedures is available in dbForge Studio for MySQL Standard and Professional Edition!

See also
  • No related posts
  • Leave a Reply