Indexes and the queries that need them
Cleanup alone does not fix a query that does a full scan of wp_postmeta on meta_value. WordPress core does not index that column, because it is LONGTEXT, so any plugin that filters by meta value at scale is slow by design. We identify those queries from the slow log and fix them at the right level: sometimes with a prefix index, sometimes by moving the data into a custom table with proper columns, and sometimes by rewriting the plugin code that generates the query. For WooCommerce stores we make sure High-Performance Order Storage is enabled and synchronised, because it moves orders out of wp_posts into the indexed wp_wc_orders tables. Slow checkout is often a database problem too, which is why this work overlaps with our service to fix WooCommerce checkout page slow loading. Old MyISAM tables are converted to InnoDB so they support row-level locking and survive crashes.