infodigger
asked on
Question regarding mysql index
Hello,
I have a table with the following structure:
id (int, auto increment), text1, lang
I also have created an index on text1,lang.
When I run the following query:
select * from mytable where name like 'cre%' I get 2500 records back.
and when I run
select * from mytable where name like 'cre%' and lang='en' I get 25 records back.
However if I run:
explain select * from mytable where name like 'cre%' and lang='en' I see that 2500 records are scanned.
Is that correct, since I have created the index on those two columns? My assumption was that only 25 records should be scanned.
Thanks a lot!
I have a table with the following structure:
id (int, auto increment), text1, lang
I also have created an index on text1,lang.
When I run the following query:
select * from mytable where name like 'cre%' I get 2500 records back.
and when I run
select * from mytable where name like 'cre%' and lang='en' I get 25 records back.
However if I run:
explain select * from mytable where name like 'cre%' and lang='en' I see that 2500 records are scanned.
Is that correct, since I have created the index on those two columns? My assumption was that only 25 records should be scanned.
Thanks a lot!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What output do you get from your EXPLAIN statement