Optimize queries: Do not retrieve known key used in the condition.
Review Request #121310 - Created Dec. 1, 2014 and submitted
There is no point in doing a select like:
SELECT foo, bar FROM table WHERE foo = needle;
That can be rewritten to say
SELECT bar FROM table WHERE foo = needle;
This reduces the data traffic with the mysql server.
I'm willing to bet that DBs can optimize these cases internally, so the only benefit would really be less data transmitted between DB and application.
But won't the fact, that each column has to be stored in a new variable cause the code to actually be slower than transmitting few more bytes to and from DB? The patch itself is OK, but I'm just wondering if there's actually any gain?