Trying to follow the instructions here, https://wiki.toolserver.org/view/Database_access#Slow_queries_and_the_query_... I do the following ina shell script, run from cronie:
echo "select /* SLOW_OK LIMIT:1800 */ 'pl.wikipedia', count(*), ..." | mysql ...
I run such queries for a large number of languages, and most of them run on time, and give good results. The string constant selected as the first column is to facilitate fault searching.
Yet, occasionally I receive an email from Query-Killer that says:
-----
Hello la2, a MySQL-query of yours was killed because you didn't mark it as SLOW_OK and it have run for 645 seconds which was longer than allowed. You can find the query below. Please have also a look at [1] to find information how you can avoid killings of your queries. Maybe you can optimze the query too? The replication lag at kill-time was 39s.
Sincerly, Query-Killer. This eMail was sent automaticaly, please don't reply.
select 'pl.wikipedia', count(*), ...
----
As can be seen, the query in the e-mail has a double space after select but no comment. Somebody cut out the comment and my SLOW_OK was not respected. Is it the "mysql" command that does this? Is there a better way?
Hi,
As can be seen, the query in the e-mail has a double space after select but no comment. Somebody cut out the comment and my SLOW_OK was not respected. Is it the "mysql" command that does this? Is there a better way?
MySQL's command line default option is to strip comments from statements before committing them to the server. Adding a --comments or -C changes this behavior, see [1].
Greeting, Steef
[1] http://dev.mysql.com/doc/refman/5.1/en/mysql-command-options.html#option_mysql_comments
On 13 February 2012 09:16, Steef389 steefy389@googlemail.com wrote:
MySQL's command line default option is to strip comments from statements before committing them to the server.
Didn't MySQL's default behaviour get changed? Ref: http://lists.wikimedia.org/pipermail/toolserver-l/2011-August/004336.html
Cheers, Morten
toolserver-l@lists.wikimedia.org