Using Oracle, having constant values in a query can affect the execution plan the database devises. In Oracle, I would always get an execution plan for a query that included placeholders
In MySQL, I get an error if I have placeholders in a query I try to EXPLAIN
:
mysql> explain select * from runs where run_id = ?;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 1
Similarly, I can't find any way of getting an execution plan for a prepared query.
If having constant values in a query does effect the execution plan, I need to know how I can get an execution plan for a query with placeholders.
Alternatively, can someone explain (or point to documentation explaining) why this would affect the plan?