Hi!
>>>>> "sasha" == sasha <sasha@stripped> writes:
sasha> Marc Peiser wrote:
>>
>> >The latest development version 3.23.9 can log slow queries into a separate
> log.
>> >
>> >Without the feature mentioned above, here is what I would do:
>> >
>> > a) in your application make sure that all the query calls go through a
> wrapper
>> >-- this is good practice even if you are not having problems, as it makes
> your
>> >code more manageble. I like to use safe_query() wrapper call in my code that
>> >will abort with an error if the query fails, so I never have to worry about
>> >error checking after queries once I've written the wrapper.
>> >
>> >b) in your query call wrapper, add a logging option, and time and log each
>> >query if the logging option is on.
>>
>> We are using ver 3.22.21 and to my knowledge, php can't run the querys
>> through a wrapper. Our machine runs fine with 0 slow_queries then in about
>> the space of about 5 min, it shoots up to 150. The load of the machine
>> goes from 0.2 to 35. Does anyone know how I can trace this problem?
>>
>> Cheers
The above sounds like you have a problem that some query locks a table
for a long time and during this you get a lot of new connection that
has to wait until this query is ready.
While this is happening, 'mysqladmin proc' should give you information
about the reason for this. One can usually fix this by prioritize the
used locks or by adding more indexes to make the slow query faster.
The MySQL manual has some information about this in the section:
'Table locking issues'
sasha> Sure it can:
sasha> function safe_query($query)
sasha> {
sasha> ($res = mysql_query($query)) || die ("Could not run $query");
sasha> return $res;
sasha> }
<cut>
sasha> As far as I know, we currently do not have any profiling options in
sasha> libmysqlclient, but I think it would be a good thing to have. Monty, what do
> you
sasha> think about adding it at least to mysql_query() in one of the next releases?
We shouldn't do this generally, but we could probably add an option
that one can enable with mysql_options() to do this.
The main question is what to profile that the 3.23 server doesn't
already do and where to log it.
Regards,
Monty