title: Should I turn off Query Cache in MySQL?
body: <p>I'm using a dedicated server with 32GB RAM and an 8-core server, using Maria DB 10.1 and most tables are InnoDB. Total DB size is less than 2GB but I think performance is slow.</p>
  
  <p>The following is the <code>my.cnf</code> file I'm using:</p>
  
  <pre><code>[mysqld]
  log-error=/home/MySQL_Server/mysql/dedi.server.co.err
  datadir=/home/MySQL_Server/mysql
  pid-file=/home/MySQL_Server/mysqlmysqld.pid
  innodb_file_per_table=1
  
  skip-name-resolve=1
  bind-address=127.0.0.1
  #skip-networking=1
  #query_cache_type=0
  query_cache_type=1
  innodb_file_per_table=1
  default-storage-engine=InnoDB
  
  #query_cache_size=0
  query_cache_size=128M
  query_cache_limit=256K
  query_cache_min_res_unit = 2k
  
  performance_schema=ON
  innodb_buffer_pool_size = 1536M
  innodb_log_file_size = 140M
  innodb_log_files_in_group=2
  
  sort_buffer_size=256k
  join_buffer_size=256k
  read_buffer_size=256k
  read_rnd_buffer_size=256k
  thread_stack=256k
  mrr_buffer_size=256k
  
  join_cache_level=8
  
  tmp_table_size=64M
  max_heap_table_size=64M
  
  table_open_cache=1024
  thread_cache_size=32
  
  innodb_buffer_pool_instances=1
  
  innodb_use_sys_malloc = 1
  
  max_connections=500
  wait_timeout=300
  interactive_timeout=360
  #tmpdir=/var/mysqltmp
  #max_allowed_packet=268435456
  </code></pre>
  
  <p>MySQL Tuner suggested the following:</p>
  
  <pre><code>General recommendations:
      Control warning line(s) into /home/MySQL_Server/mysql/dedi.niresh.co.err file
      Control error line(s) into /home/MySQL_Server/mysql/dedi.niresh.co.err file
      Increasing the query_cache size over 128M may reduce performance
      When making adjustments, make tmp_table_size/max_heap_table_size equal
      Reduce your SELECT DISTINCT queries which have no LIMIT clause
      Consider installing Sys schema from https://github.com/mysql/mysql-sys
  Variables to adjust:
      query_cache_size (=0)
      query_cache_type (=0)
      query_cache_size (&gt; 128M) [see warning above]
      tmp_table_size (&gt; 64M)
      max_heap_table_size (&gt; 64M)
      innodb_log_file_size should be (=192M) if possible, so InnoDB total log files size equals to 25% of buffer pool size.
  </code></pre>
  
  <p>Should I turn off the query cache?</p>
  
  <p>Is there any additional recommendation?</p>