atulbansal
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Mysql – problem with the new versionSelect count (distinct id) FROM
This query is incomplete. For me it started happening when I changed the main query and removed the DISTINCT and GROUP BY to increase the performance.
I checked the template-functions-link.php. It has
posts_nav_link function towards the end.
An echo on $fromwhere variable returned nothing.
Replacing this line
preg_match(‘#FROM\s(.*)\sGROUP BY#siU’, $request, $matches);
By this
preg_match(‘#FROM\s(.*)\s#siU’, $request, $matches);
fixed it.
It was trying to get table name by parsing the initial query and since I had removed the group by from it, it could not parse it properly.
Atul Bansal
Forum: Fixing WordPress
In reply to: Performance problemsI have over 16000 posts and hosting it on Yahoo. Had the same issue but found this solution. I would request the wordpress authors to validate the following.
You will have to edit [wp-includes/classes.php] file
Look for the line
$request = ” SELECT $distinct * FROM $wpdb->posts $join WHERE 1=1″ . $where . ” GROUP BY ” . $groupby . ” ORDER BY ” . $orderby . ” $limits”;
And replace it by
$request = ” SELECT * FROM $wpdb->posts $join WHERE 1=1″ . $where . ” ORDER BY ” . $orderby . ” $limits”;
Atul Bansal (www.sahihai.com)
Forum: Fixing WordPress
In reply to: Need very fast WordPress performancesumocomputers,
I have been facing the same issue with over 16000 posts and have seen the performance of my site degrade. But I just put in a solution that did the trick. My initial load query is down from 6.8s to 0.4 seconds and the heaviest category lookup has come down from 4.3 seconds to .4 seconds as well.
You will have to edit [wp-includes/classes.php] file
Look for the line
$request = ” SELECT $distinct * FROM $wpdb->posts $join WHERE 1=1″ . $where . ” GROUP BY ” . $groupby . ” ORDER BY ” . $orderby . ” $limits”;
And replace it by
$request = ” SELECT * FROM $wpdb->posts $join WHERE 1=1″ . $where . ” ORDER BY ” . $orderby . ” $limits”;
That basically removes the unnecessary DISTINCT on ID which is a primary key in wp_posts table anyway and cannot be duplicated. The distinct and group by are the real killers.
Atul Bansal (http://www.sahihai.com)