"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/
Bookmarks