There's an absurdly slow query to fetch the meta key names that don't begin with underscores. That list of names is used to populate the custom field user-interface on the order page.
Add a cache to hold the results of that query, so it doesn't have to be repeated.
Add code to update that cache as needed when a new order appears, or when an order is changed.
There's an absurdly slow query to fetch the meta key names that don't begin with underscores. That list of names is used to populate the custom field user-interface on the order page.
Add a cache to hold the results of that query, so it doesn't have to be repeated.
Add code to update that cache as needed when a new order appears, or when an order is changed.