|[B]silent-ion wrote on Tue, 09 November 2010 21:22[/B]|
I have a strange website, which do a lot of queries of the same type:
select * from table where a=’$variable’
Do you have an index on the "a" column?
If you look at the create table statement (the output from SHOW CREATE TABLE tablename). Do you have a row that says something like:
… [PRIMARY] KEY ‘something’ ( ‘a’ ),…
If you don’t then it means you don’t have an index and that MySQL needs to scan the entire table to find records matching your condition.
You can create an index with something like:
ALTER TABLE table ADD INDEX table_ix_a(a);
That will create an index on the a column (withing the parenthesis), the table_ix_a is just a name of the index that you are creating.