So, what impact does enabling the slow query log have on MySQL?
I decided to run some numbers. I’m using my laptop, as we all
know the currently most-deployed database servers have mulitple
cores, SSDs and many GB of RAM. For the curious: Intel(R)
Core(TM) i7-2620M CPU @ 2.70GHz
The benchmark is going to be:
mysqlslap -u root test -S var/tmp/mysqld.1.sock -q 'select
1;' --number-of-queries=1000000 --concurrency=64
--create-schema=test
Which is pretty much “run a whole bunch of nothing, excluding all
the overhead of storage engines, optimizer… and focus on
logging”.
My first run was going to be with the slow query log on. I’ll
start the server with mysql-test-run.pl as it’s just easy:
eatmydata ./mysql-test-run.pl --start-and-exit
--mysqld=--slow-query-log --mysqld=--long-query-time=0
The results? It took 18 seconds.
How long without …
[Read more]