SELECT 
  vi_discussion_posts.*, 
  vi_discussion_messages.message, 
  vi_discussion_rating.rating_value 
FROM 
  vi_discussion_posts 
  LEFT JOIN vi_discussion_messages ON vi_discussion_messages.post_id = vi_discussion_posts.post_id 
  LEFT JOIN vi_discussion_rating ON vi_discussion_rating.post_id = vi_discussion_posts.post_id 
WHERE 
  vi_discussion_posts.thread_id = 25 
  AND vi_discussion_posts.status = 'A' 
ORDER BY 
  vi_discussion_posts.timestamp DESC 
LIMIT 
  0, 10

Query time 0.00016

JSON explain

{
  "query_block": {
    "select_id": 1,
    "nested_loop": [
      {
        "read_sorted_file": {
          "filesort": {
            "sort_key": "vi_discussion_posts.`timestamp` desc",
            "table": {
              "table_name": "vi_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": "vi_discussion_posts.`status` = 'A'",
              "attached_condition": "vi_discussion_posts.thread_id <=> 25 and vi_discussion_posts.`status` <=> 'A'"
            }
          }
        }
      },
      {
        "table": {
          "table_name": "vi_discussion_messages",
          "access_type": "eq_ref",
          "possible_keys": ["PRIMARY"],
          "key": "PRIMARY",
          "key_length": "3",
          "used_key_parts": ["post_id"],
          "ref": ["devvipiriscom.vi_discussion_posts.post_id"],
          "rows": 1,
          "filtered": 100
        }
      },
      {
        "table": {
          "table_name": "vi_discussion_rating",
          "access_type": "eq_ref",
          "possible_keys": ["PRIMARY"],
          "key": "PRIMARY",
          "key_length": "3",
          "used_key_parts": ["post_id"],
          "ref": ["devvipiriscom.vi_discussion_posts.post_id"],
          "rows": 1,
          "filtered": 100
        }
      }
    ]
  }
}

Result

post_id thread_id name timestamp user_id ip_address status message rating_value
17 25 John 1383914729 0 10.7.7.93 A I’ve been using an iPhone 5 daily for the past year, and the iPhone 5s seems to feel exactly the same: the same curved edges, same dimensions, same everything. It's only an updated Home button and the new camera flash which make you realize that this is not an iPhone 5. Many people think that releasing the same design twice is bad, and there are others who realize that sometimes there's no need for change. Apple might want to understand that the competition is strong, and it needs to stay relevant. 3