Friday, August 1, 2014

Long Query in Error Logs (WP Engine).

While going through the Error Log in your WP Admin Dashboard you may notice some entries that include a pre-fix of LONG QUERRY. These are provided by WP Engine.

EG :- 
[Thu Jul 31 16:05:21 2014] [error] [client 192.168.1.64] LONG QUERY (2421 characters long generated in /home/Projects/filename.php:271): SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN ('category', 'post_tag', 'post_format') AND tr.object_id IN (38800,.............. ) ORDER BY t.name ASC,..

WP Engine have included it in the log to signify that the length of the query, which would be over 1,024 characters, is a Long Query and may be able to be optimized. WP Engine did not take any action on this query, it is just a notice to the customers. These only apply to Select statements, and not any other type of statements.

Here is a simple fix for this. THIS IS NOT AN EXACT SOLUTION.

To prevent LONG QUERY limitations in WPEngine, add the following WPE_GOVERNOR to your wp-config.php

define( 'WPE_GOVERNOR', false );