Custom Query Alterations
The optimisations in the Query Speed tab are deliberately conservative. They’re written to apply where they’re safe and to leave everything else alone, because the last thing you want is a query rewrite changing results on a page where it matters. That works for the common cases, but occasionally you’ll have a specific slow query on your site, often from a theme or a third-party plugin, that you know could be optimised but which Scalability Pro doesn’t touch by default.
Custom Query Alterations, at the bottom of the Query Speed tab, let you apply Scalability Pro’s optimisations to your own chosen part of a page load. This is an advanced feature, so it helps to understand how your slow query is triggered before you use it.
For each alteration you define a start hook and an end hook, each with a priority. Scalability Pro switches the optimisation on when the start hook fires and off again when the end hook fires, so the rewrite only applies to queries that run between those two points. You then choose which optimisations to apply in that window: remove SQL_CALC_FOUND_ROWS, remove the sort, change joins to EXISTS, remove the CAST on meta values, optimise the GROUP BY, remove the private items check, or force a post type.
That means you can target a single widget or a single plugin’s query without affecting the rest of the site. Because it’s precise, it’s also possible to get it wrong, so test the affected page carefully after adding an alteration, and check that results and pagination still look right.
In short: Custom Query Alterations let advanced users apply Scalability Pro’s query optimisations to a specific part of a page load, bounded by a start and end hook, for slow queries the built-in options don’t cover. Use it carefully and test the result.