Subqueries come in several flavors, and they have different optimization potential. First, note that subqueries can be either “correlated” or “uncorrelated”. Correlated means that they depend on some value from outside the subquery. This generally implies that the subquery must be re-evaluated for each outer value.

This correlated subquery is often pretty good. Note: It must return at most 1 value. It is often useful as an alternative to, though not necessarily faster than, a LEFT JOIN.

SELECT a, b, ( SELECT ... FROM t WHERE t.x = u.x ) AS c
    FROM u ...
SELECT a, b, ( SELECT MAX(x) ... ) AS c
    FROM u ...
SELECT a, b, ( SELECT x FROM t ORDER BY ... LIMIT 1 ) AS c
    FROM u ...

This is usually uncorrelated:

SELECT ...
    FROM ( SELECT ... ) AS a
    JOIN b ON ...

Notes on the FROM-SELECT: