Are subqueries cached by MySQL when used in a WHERE clause?

Viewed 2453

In the following query:

SELECT column_a, column_b FROM table_a WHERE
    column_b IN (SELECT b_id FROM table_b)

Is the subquery SELECT b_id FROM table_b cached by the SQL parser, or would it be faster to do the query beforehand, save it as a variable (in PHP, for example), and then pass those values in as a CSV string?

e.g.

SELECT column_a, column_b FROM table_a WHERE
    column_b IN (1,3,4,6,8,10,16,18)
1 Answers
Related