Possible Duplicate:
Sql wildcard: performance overhead?
Studying my applications preformance, I realized that the query:
SELECT * FROM (`static_cache`) WHERE `combined_name` = 'base'
Takes about 0.0052s to run. Sure, it might not be a lot, but a few of these querys quickly add up to a bit of loading time. Experimenting, I tried to select only the fields that I actually needed in the query instead (logical optimization), yielding the query:
SELECT `combined_name`, `timestamp`, `type`, `checksum` FROM (`static_cache`)
WHERE `combined_name` = 'base'
This query, however, takes as little as 0.0005s to run. That's 10 times faster, and the only field and I am not selecting is the id-column. A speed increase was expected, but not by 10 times. Yes, I tested it repetitively.
How can the change in this query possibly decrease the running time by so much?