{"id":480,"date":"2011-09-27T19:03:04","date_gmt":"2011-09-27T19:03:04","guid":{"rendered":"http:\/\/10sa.com\/sql_stories\/?p=480"},"modified":"2011-09-27T19:03:04","modified_gmt":"2011-09-27T19:03:04","slug":"mysql-queries-snapshot","status":"publish","type":"post","link":"http:\/\/10sa.com\/sql_stories\/?p=480","title":{"rendered":"MySQL queries snapshot"},"content":{"rendered":"<p>The gathering of the general logs would adversely affect the performance, it would take the significant space on your devices. The continuity of this log is neighter used. But sometimes it would be nice to see what is going on at runtime &#8211; I used to do the fallowing hack:<\/p>\n<pre lang=\"SQL\">\r\n# MySQL configuration file my.cnf\r\ngeneral_log=1\r\ngeneral_log_file=\/var\/log\/mysql\/general.log\r\n<\/pre>\n<p>Bash:<\/p>\n<pre lang=\"bash\">\r\nroot> \/etc\/init.d\/mysql.server stop\r\nroot> rm -f \/var\/log\/mysql\/general.log\r\nroot> ln -s \/dev\/null \/var\/log\/mysql\/general.log\r\nroot> \/etc\/init.d\/mysql.server start\r\n<\/pre>\n<p>In order to see content of logs you have to remove symbolic link and flush logs &#8211; in SQL mode:<\/p>\n<pre lang=\"bash\">\r\nroot> rm -f \/var\/log\/mysql\/general.log\r\n<\/pre>\n<p>The wonder thing is that when I read carefuly the manual I would know that I can do it at runtime with pure SQL:<\/p>\n<pre lang=\"SQL\">\r\nSET GLOBAL general_log = 'ON';\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The gathering of the general logs would adversely affect the performance, it would take the significant space on your devices. The continuity of this log is neighter used. But sometimes it would be nice to see what is going on at runtime &#8211; I used to do the fallowing hack: # MySQL configuration file my.cnf [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"http:\/\/10sa.com\/sql_stories\/index.php?rest_route=\/wp\/v2\/posts\/480"}],"collection":[{"href":"http:\/\/10sa.com\/sql_stories\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/10sa.com\/sql_stories\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/10sa.com\/sql_stories\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/10sa.com\/sql_stories\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=480"}],"version-history":[{"count":9,"href":"http:\/\/10sa.com\/sql_stories\/index.php?rest_route=\/wp\/v2\/posts\/480\/revisions"}],"predecessor-version":[{"id":489,"href":"http:\/\/10sa.com\/sql_stories\/index.php?rest_route=\/wp\/v2\/posts\/480\/revisions\/489"}],"wp:attachment":[{"href":"http:\/\/10sa.com\/sql_stories\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=480"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/10sa.com\/sql_stories\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=480"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/10sa.com\/sql_stories\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=480"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}