Professional Web Applications Themes

How to trace statements executed in a procedure called by a client? - MySQL

Hi, My question is related to MySQL administration, where I don't have any particular experience. I would to trace every SQL statement executed inside a procedure that is called by a client: CREATE PROCEDURE foo() NOT DETERMINISTIC MODIFIES SQL DATA COMMENT 'Generate the required number of random battles' BEGIN <statement 1> <statement 2> <statement 3> END; The problem is that the mysql-slow.log file only contains a trace of the call to the procedure; it does not provide any trace of every subsequent statement executed by the procedure itself: # Time: 070607 1:23:04 # UserHost: dbo[dbo] localhost [] # Query_time: 0 ...

  1. #1

    Default How to trace statements executed in a procedure called by a client?

    Hi,

    My question is related to MySQL administration, where I don't have any
    particular experience. I would to trace every SQL statement executed
    inside a procedure that is called by a client:

    CREATE PROCEDURE foo()
    NOT DETERMINISTIC
    MODIFIES SQL DATA
    COMMENT 'Generate the required number of random battles'
    BEGIN
    <statement 1>

    <statement 2>

    <statement 3>
    END;

    The problem is that the mysql-slow.log file only contains a trace of
    the call to the procedure; it does not provide any trace of every
    subsequent statement executed by the procedure itself:

    # Time: 070607 1:23:04
    # UserHost: dbo[dbo] localhost []
    # Query_time: 0 Lock_time: 0 Rows_sent: 0 Rows_examined: 2 SET
    last_insert_id=27274; CALL foo();

    Is there any way to configure mysqld to trace every statement executed
    by MySQL? For information, my current configuration is the following:

    [mysqld]
    user = mysql
    pid-file = /var/run/mysqld/mysqld.pid
    socket = /var/run/mysqld/mysqld.sock
    port = 3306
    basedir = /usr
    datadir = /var/lib/mysql
    tmpdir = /tmp
    language = /usr/share/mysql/english
    long_query_time = 1
    log-queries-not-using-indexes
    skip-external-locking
    verbose
    log_bin_trust_function_creators = 1

    Thanks a lot!

    --
    Daniel

    Daniel Guest

  2. #2

    Default Re: How to trace statements executed in a procedure called by a client?

    Daniel vi t: 

    My MySQL configuration file also contains the following lines:

    log = /var/log/mysql/mysql.log
    log-long-format
    log-slow-queries = /var/log/mysql/mysql-slow.log


    However the mysql.log file just contains the stored procedure call:

    12 Query CALL foo()

    I though that the SQL engine was also logging every query that it
    executes.


    --
    Daniel

    Daniel Guest

Similar Threads

  1. Omitting Trace Statements
    By Jaxim in forum Macromedia Flex General Discussion
    Replies: 2
    Last Post: October 1st, 02:49 PM
  2. Help: stored procedure getting executed twice
    By Bill S. in forum ASP Database
    Replies: 1
    Last Post: November 4th, 11:27 PM
  3. Trace statements executed by ASPs
    By Raymond Du in forum Microsoft SQL / MS SQL Server
    Replies: 3
    Last Post: July 7th, 07:43 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139