Mysql slow concurrent GROUP BY queries

I have a strange problem with mysql and GROUP BY queries. See below:

mysqlslap --concurrency=5 --iterations=1 --query=/root/test.sql --create-     schema=testd  -u root -p
Benchmark
        Average number of seconds to run all queries: 2.575 seconds
        Minimum number of seconds to run all queries: 2.575 seconds
        Maximum number of seconds to run all queries: 2.575 seconds
        Number of clients running queries: 5
        Average number of queries per client: 1

      

But when I only run one request it looks like this:

mysqlslap --concurrency=1 --iterations=1 --query=/root/test.sql --create-    schema=testd  -u root -p
Benchmark
        Average number of seconds to run all queries: 0.247 seconds
        Minimum number of seconds to run all queries: 0.247 seconds
        Maximum number of seconds to run all queries: 0.247 seconds
        Number of clients running queries: 1
        Average number of queries per client: 1

      

The test.sql file only includes one query:

SELECT SQL_NO_CACHE `name` FROM logs GROUP BY `name`;

      

When I remove the GROUP BY it executes just fine and doesn't slow down like it did before.

Mysql version is 5.5.43. The CPU is E5-1660v3 and there is 32GB of RAM. The default my.cnf file, except for these values:

key_buffer              = 256M
key_buffer_size         = 256M
sort_buffer_size    = 2M
read_rnd_buffer_size    = 1M
innodb_buffer_pool_size = 1G
max_allowed_packet      = 32M
thread_stack            = 192K
thread_cache_size       = 8
myisam-recover          = BACKUP
max_connections     = 300
table_cache     = 256M
query_cache_limit       = 1M
query_cache_size        = 16M

      

Any ideas what the problem might be?

0


source to share





All Articles