Getting slow query. What column should I index and what type of index?

50 Views Asked by At

I'm new to MySQL. I'm getting this slow query below.

# Query_time: 3.357236  Lock_time: 0.000054  Rows_sent: 1  Rows_examined: 107494
# Rows_affected: 0  Bytes_sent: 67
SET timestamp=1652612113;
SELECT COUNT(*) FROM et_term_relationships, et_posts WHERE et_posts.ID = et_term_relationships.object_id AND post_status IN ('publish') AND post_type IN ('acadp_listings') AND term_taxonomy_id = 15;

What index (with what columns) should I create and what type of index should I use (PRIMARY KEY, UNIQUE, INDEX, FULLTEXT)?

Any help is appreciated.

0

There are 0 best solutions below