multiple meta key but get server load is very high

Complex meta queries with a large number of meta values to find can be slow. Each meta key you query for generates one more JOIN in the query, and if you have a large database, it can be slow. You can try few things:

  • Optimize your database tables, it is possible that you have a lot of orphaned data that can contribute to database query speed.
  • Try limiting the number of posts query returns, if you have a lot of records in the results set that can cause speed problems too.
  • Contact your hosting (or do it yourself if you have access) to check MySQL slow query log to see why the query is slow, and maybe do some optimization on the MySQL server settings for better caching.

Leave a Comment