SELECT 
  cscart_discussion_posts.*, 
  cscart_discussion_messages.message, 
  cscart_discussion_rating.rating_value 
FROM 
  cscart_discussion_posts 
  LEFT JOIN cscart_discussion_messages ON cscart_discussion_messages.post_id = cscart_discussion_posts.post_id 
  LEFT JOIN cscart_discussion_rating ON cscart_discussion_rating.post_id = cscart_discussion_posts.post_id 
WHERE 
  cscart_discussion_posts.thread_id IN (159171) 
  AND cscart_discussion_posts.status = 'A' 
ORDER BY 
  cscart_discussion_posts.timestamp DESC 
LIMIT 
  0, 10

Query time 0.00033

JSON explain

{
  "query_block": {
    "select_id": 1,
    "read_sorted_file": {
      "filesort": {
        "sort_key": "cscart_discussion_posts.`timestamp` desc",
        "table": {
          "table_name": "cscart_discussion_posts",
          "access_type": "ref",
          "possible_keys": ["thread_id", "thread_id_2"],
          "key": "thread_id_2",
          "key_length": "6",
          "used_key_parts": ["thread_id", "status"],
          "ref": ["const", "const"],
          "rows": 1,
          "filtered": 100,
          "index_condition": "cscart_discussion_posts.`status` = 'A'",
          "attached_condition": "cscart_discussion_posts.thread_id <=> 159171 and cscart_discussion_posts.`status` <=> 'A'"
        }
      }
    },
    "table": {
      "table_name": "cscart_discussion_messages",
      "access_type": "eq_ref",
      "possible_keys": ["PRIMARY"],
      "key": "PRIMARY",
      "key_length": "3",
      "used_key_parts": ["post_id"],
      "ref": ["cscart_migrate.cscart_discussion_posts.post_id"],
      "rows": 1,
      "filtered": 100
    },
    "table": {
      "table_name": "cscart_discussion_rating",
      "access_type": "eq_ref",
      "possible_keys": ["PRIMARY"],
      "key": "PRIMARY",
      "key_length": "3",
      "used_key_parts": ["post_id"],
      "ref": ["cscart_migrate.cscart_discussion_posts.post_id"],
      "rows": 1,
      "filtered": 100
    }
  }
}

Result

post_id thread_id name timestamp user_id ip_address status email message rating_value
125760 159171 Googans Galley 1696425540 0 498ffb4c A kimberly@googansgalley.com These lights showed up beyond expectation! After scouring the internet and looking at dozens of various iterations of gooseneck lighting I settled on Barn Light and the Fire Chief sign lighting due to the voluminous options to customize, craftsmanship and American made. It did not disappoint! While the pricing may have been a bit more than my original budget, the quality made up for it and I know I'll never have to worry about replacing them. Everything came out exactly as I had hoped for and gave my storefront the final touches with beautiful nighttime illumination. 5