Answer the question
In order to leave comments, you need to log in
How to optimize sql query? And how to determine which request is better?
Good afternoon, please tell me how to optimize this query
SELECT terms.name, terms.slug, tags_meta.id_tags FROM terms
LEFT OUTER JOIN term_taxonomy ON terms.term_id = term_taxonomy.term_id AND term_taxonomy.taxonomy = 'post_tag'
LEFT OUTER JOIN term_relationships ON term_taxonomy.term_taxonomy_id = term_relationships.term_taxonomy_id
LEFT OUTER JOIN tags_meta ON tags_meta.id_tags = terms.term_id
WHERE term_relationships.object_id = $param1 AND tags_meta.id_tags != ''
Answer the question
In order to leave comments, you need to log in
The select involves fields from the terms and tags_meta tables, hence the question why left join term_taxonomy and term_relationships. Describe what is in which table and what you want to get as an output.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question