[thelist] MySQL oddness

r937 rudy at r937.com
Tue Jan 29 12:27:42 CST 2008


> Specifying the exact columns you want actually causes
> the database to do MORE work than selecting all the columns.
>
> So, point is, I agree with your suggestion to avoid SELECT *,
> but I don't necessarily agree with your reasoning, as query
> execution time will increase.

the juxtaposition of these two paragraphs is unfortunate, because they are
unrelated

the first relates to parsing, and the second to execution

specifying SELECT * means the database has to go find out what columns are
in the table

specifying SELECT foo,nonsense,bar means the database still has to go find
out what columns are in the table, because it has to make sure that each
column you specified is actually a column in the table (if it isn't you will
get a syntax error)

that's the only difference in the parsing context, and the difference, in
terms of time required, is trivially minuscule

on the other hand, specifying SELECT * when you don't need all the columns
is what will increase query execution time, and the difference can be
substantial


rudy
http://r937.com/





More information about the thelist mailing list