facebook twitter youtube
Replication Query Optimization DB Tuning Server Load and Query Locking Linux Download Interview Questions Basic DB Commands Mysql
in Mysql - 13 Feb, 2014
by Zafar Malik - no comments
How Partial Index works in mysql

Suppose there is a title varchar(250) column and there is an index on it as per below

Alter table mytable add index (title(16));

Case 1:

select id, title from mytable where title=”This is my Title”;

Here query will use index as searching string contains 16 character and our index also take care 16 characters.

 

Case 2:

select id, title from mytable where title=”This is not my Title but it is yours”;

Here searching string size is greater than index size, so query will go for table scan instead of index usage.

Leave a Reply