Title: Optimizing some queries
Last modified: August 21, 2016

---

# Optimizing some queries

 *  [heddo](https://wordpress.org/support/users/heddo/)
 * (@heddo)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/optimizing-some-queries/)
 * Hello,
 * My hosting company is asking frequently to optimize my website which is using
   WordPress because it’s “overloading” the server. If I won’t fix this issue, they
   will have to put it on a “quarantine server”. I’m checking everyday my slow logs
   and I’m having always the same thing (I guess). I removed from the DB all tables
   created by uninstalled plugins. I removed also all the plugin that are overloading
   the server with queries. I’m also using a cache plugin. These steps were good
   but not that enough since I still have some slow queries in the log file. Anyway,
   here the slowlog:
 *     ```
       # Time: 131205 22:35:33
       # User@Host: XXXXXX[XXXXXX] @ XXXXXX [XXXXXX]
       # Query_time: 6.183516  Lock_time: 0.000159 Rows_sent: 379  Rows_examined: 421
       use XXXXXX;
       SET timestamp=1386279333;
       SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes';
       # Time: 131205 22:36:33
       # User@Host: XXXXXX[XXXXXX] @ XXXXXX [XXXXXX]
       # Query_time: 61.768671  Lock_time: 0.000000 Rows_sent: 0  Rows_examined: 0
       use XXXXXX;
       SET timestamp=1386279393;
       SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes';
       # Time: 131205 22:37:03
       # User@Host: XXXXXX[XXXXXX] @ XXXXXX [XXXXXX]
       # Query_time: 93.286015  Lock_time: 0.000000 Rows_sent: 0  Rows_examined: 0
       use XXXXXX;
       SET timestamp=1386279423;
       SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes';
       # Time: 131205 22:37:03
       # User@Host: XXXXXX[XXXXXX] @ XXXXXX [XXXXXX]
       # Query_time: 95.438348  Lock_time: 5.071881 Rows_sent: 0  Rows_examined: 1
       SET timestamp=1386279423;
       DELETE FROM wp_options WHERE option_name = 'rewrite_rules';
       # Time: 131205 22:37:15
       # User@Host: XXXXXX[XXXXXX] @ XXXXXX [XXXXXX]
       # Query_time: 32.109220  Lock_time: 20.174740 Rows_sent: 378  Rows_examined: 420
       use XXXXXX;
       SET timestamp=1386279435;
       SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes';
       ```
   
 * Can someone help me figure out what’s going wrong and what is taking so much 
   time to be done?
    Thanks guys!

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/optimizing-some-queries/#post-4386315)
 * Have you tried:
 * – deactivating **all** plugins to see if this resolves the problem. If this works,
   re-activate the plugins one by one until you find the problematic plugin(s).
 * – switching to the default theme to rule out any theme-specific problems.
 * – [resetting the plugins folder](http://codex.wordpress.org/FAQ_Troubleshooting#How_to_deactivate_all_plugins_when_not_able_to_access_the_administrative_menus.3F)
   by FTP or PhpMyAdmin. Sometimes, an apparently inactive plugin can still cause
   problems.
 *  Thread Starter [heddo](https://wordpress.org/support/users/heddo/)
 * (@heddo)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/optimizing-some-queries/#post-4386408)
 * Hello esmi,
 * Thanks for the reply.
    When I deactivate all the plugins, how much time I should
   wait to see if this resolves the problem? Is there any plugin to check if the
   theme is causing this? Turning my site to the default will ruin it and it’s busy
   these days on my site :/ Thanks again.
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/optimizing-some-queries/#post-4386447)
 * There is no magic bullet in these situations. This is just the start of basic
   troubleshooting and is a process of elimination deliberately designed to locate
   the root cause as quickly as possible by first removing the most obvious and 
   common culprits via a series of (often) temporary steps.
 * Your theme & plugin settings are saved in your database and should be retained
   for future use.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Optimizing some queries’ is closed to new replies.

## Tags

 * [SQL queries](https://wordpress.org/support/topic-tag/sql-queries/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [esmi](https://wordpress.org/support/users/esmi/)
 * Last activity: [12 years, 5 months ago](https://wordpress.org/support/topic/optimizing-some-queries/#post-4386447)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
