The next thing is to flatten subselects, which means integrating them into the main query. By getting rid of subselects, a couple more options to optimize the query will appear.
Here is what the query will look such as after flattening the subselects:
SELECT * FROM a, b, c WHERE a.aid = c.cid AND aid = bid AND cid = 4;
It is now a normal join.
We could have rewritten this SQL on our own, but the planner will take care of those transformations for us anyway. The optimizer can now perform further optimizations.