Skip to content
Advertisement

query monitor in wordpress shows slow query

I have a slow query on a wordpress site. I believe it’s my subquery inside it for the ‘abbreviation’. How can I rewrite this to make it faster? I’m not having much luck. The query takes about 0.8959 seconds I have both the query and the explain below, my goal is to modify this query to make it execute faster, thanks.

This is the query:

This is the EXPLAIN:

Advertisement

Answer

well I tried to optimize the query a little bit as below , make sure I have not changed any logic ( I can’t test since I have no sample data)

also make sure you have index on afx_postmeta table on used columns (meta_value, post_id, meta_key). I’m saving the record I want from afx_postmeta in a cte so I won’t hit that table 3times later

let us know how that improved your performance.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement