3 ms·
Sometimes it's not that big of a deal. The idea is if you specify only the columns you need, sometimes those columns can be satisfied directly from the index (
by spudlyo 16y ago
Sometimes it's not that big of a deal. The idea is if you specify only the columns you need, sometimes those columns can be satisfied directly from the index (what's known as a covering index) and you don't need to seek around to the various data pages to pull the rest of the columns.
InnoDB though uses a clustered indexing scheme, where the rest of the columns are stored in the leaf nodes, so if you query by primary key, all the data is right there -- no extra seeking.
Anyway, obviously it's better to only ask for what you need, but it's not the stupidest thing in the world to SELECT with wildcard.
- gaius 16y agoWell, also that you're not physically moving data you don't need across the connection. I have literally seen "programmers" simply select like that and filter out the rows they want, or sort the entire table (and then filter out the rows), in their own code. Madness.