title: Using SELECT within SELECT in mysql query
body: <p>It is common to use <code>SELECT</code> within <code>SELECT</code> to reduce the number of queries; but as I examined this leads to slow query (which is obviously harmful for mysql performance). I had a simple query as</p>
  
  <pre><code>SELECT something
   FROM posts
   WHERE id IN (
    SELECT tag_map.id
    FROM tag_map
    INNER JOIN tags
    ON tags.tag_id=tag_map.tag_id
    WHERE tag IN ('tag1', 'tag2', 'tag3', 'tag4', 'tag5', 'tag6')
    )
  </code></pre>
  
  <p>This leads to slow queries of "query time 3-4s; lock time about 0.000090s; with about 200 rows examined".</p>
  
  <p>If I split the <code>SELECT</code> queries, each of them will be quite fast; but this will increase the number of queries which is not good at high concurrency.</p>
  
  <p>Is it the usual situation, or something is wrong with my coding?</p>