Professional Web Applications Themes

What does 'Init DB' mean in the log? - MySQL

Hi, this may sound like a stupid question, but I would like to know what 'Init DB' means in de log of MySQL. I have a very bad performing application (we bought it). When I log all mysql-queries I can see a lot of 'Init DB'-messages - sometimes after every query. I don't think this is /the/ mayor reason this app is not performing, but I would still like to know what this means and /if/ it could be the perfomance hog... anybody? (The reason I am worried about it is that when I perform queryies manually on this server, ...

  1. #1

    Default What does 'Init DB' mean in the log?

    Hi,

    this may sound like a stupid question, but I would like to know what
    'Init DB' means in de log of MySQL. I have a very bad performing
    application (we bought it). When I log all mysql-queries I can see a
    lot of 'Init DB'-messages - sometimes after every query. I don't think
    this is /the/ mayor reason this app is not performing, but I would
    still like to know what this means and /if/ it could be the perfomance
    hog... anybody?

    (The reason I am worried about it is that when I perform queryies
    manually on this server, the 'Init DB' allmost never shows up...)

    greetings,

    Paul

    profke Guest

  2. #2

    Default Re: What does 'Init DB' mean in the log?

    "profke" <com> wrote: 

    I guess you're talking about the general log of the MySQL server.
    'Init DB' is logged for the mysql_select_db() API call.

    Having 'Init DB' right *before* each normal query is typical for PHP
    applications using a database abstraction layer. This is done to
    overcome a bug^Wmisconception in the PHP mysql extension. By default
    PHP shares database connections that use the same (host, user, pass)
    tupel. So if you do

    <?php
    $con1= mysql_connect($host, $user, $pass);
    mysql_select_db('foo', $con1);
    $con2= mysql_connect($host, $user, $pass);
    mysql_select_db('bar', $con2);
    ?>

    then the second call to mysql_select_db() will change *both* $con1 and
    $con2. To overcome this problem, all database abstraction classes issue
    mysql_select_db() right before each query.


    Normally this is *no* problem, because MySQL executes mysql_select_db()
    really fast. In praxis it's just sending one TCP packet to the server
    and receiving one packet as answer.

    Probably there is more impact on the performance by enabling the
    general log than by having those mysql_select_db(). If you want to
    spot bad queries, turn on the slow query log:
    http://dev.mysql.com/doc/refman/5.0/en/slow-query-log.html


    HTH, XL
    --
    Axel Schwenke, Support Engineer, MySQL AB

    Online User Manual: http://dev.mysql.com/doc/refman/5.0/en/
    MySQL User Forums: http://forums.mysql.com/
    Axel Guest

  3. #3

    Default Re: What does 'Init DB' mean in the log?

    Hi Axel,
     

    That's right.
     

    Ah! Ok...
     

    I guest as much. Still, it is nice to know for sure! And I like to
    know what is happening om my servers, and, more importantly, for what
    reason. :-)

    Thank you for your elaborate answer!

    Paul

    profke Guest

Similar Threads

  1. Kernel panic: No init found. Try passing init = option to kernel
    By Liviu in forum Linux Setup, Configuration & Administration
    Replies: 2
    Last Post: October 31st, 03:56 PM
  2. tcltklib and not init'ing tk
    By Aamer Akhter in forum Ruby
    Replies: 12
    Last Post: October 16th, 03:58 PM
  3. init.d
    By Stojcevski Dejan in forum Sun Solaris
    Replies: 4
    Last Post: August 2nd, 02:40 PM
  4. XDM init file
    By Rus Foster in forum Debian
    Replies: 2
    Last Post: July 21st, 03:00 PM

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