Has anyone ever told you that SELECT * FROM table is bad, and did
they give you a reason?
Let me give you two;
-
- If someone were to add column level privileges and then lock
you out of a column, your query will start failing.
- There are certain cases where MySQL can satisfy all of your
query just by reading an index. This is much faster than reading
the index, then the data.
An example:
CREATE TABLE index_test_no_data (
id INT NOT NULL PRIMARY KEY auto_increment,
a char(32),
b char(255),
c char(255),
d char(255),
e char(255),
f char(255),
g char(255),
h char(255),
i char(255),
j char(255),
k char(255),
l char(255),
m char(255),
n char(255),
o char(255),
p char(255),
q char(255),
r char(255),
s char(255),
t char(255),
u char(255),
v char(255),
w char(255),
x char(255),
y char(255),
z char(255),
empty tinyint, …
[Read more]