By fernando | January 26, 2010

how to prevent explain from executing subqueries

Here’s a quick tip for using explain:
You may know this already, but mysql will actually execute some subqueries when you invoke explain.  Here’s an example:
mysql> explain select id from projects where id = (select max(id) from projects where name like ‘en%’);
+—-+————-+———-+——-+—————+———+———+——-+——-+————-+
| id | select_type | table | type | possible_keys | [...]

RSS my ohloh journal

Events

O'Reilly MySQL Conference & Expo 2010