List:General Discussion« Previous MessageNext Message »
From:Andrés Tello Date:November 28 2012 2:47am
Subject:Still struggling witn like 'CTV%' over varchar.... I simple cannot understand..
View as plain text  
mysql> explain select * from cuenta where rutaCuenta like 'CTV%';
+----+-------------+--------+-------+---------------+------------+---------+------+--------+-------------+
| id | select_type | table  | type  | possible_keys | key        | key_len
| ref  | rows   | Extra       |
+----+-------------+--------+-------+---------------+------------+---------+------+--------+-------------+
|  1 | SIMPLE      | cuenta | range | rutaCuenta    | rutaCuenta | 258
| NULL | 876824 | Using where |
+----+-------------+--------+-------+---------------+------------+---------+------+--------+-------------+
1 row in set (0.00 sec)

mysql> explain select * from cuenta where rutaCuenta like 'CTV%';
+----+-------------+--------+------+---------------+------+---------+------+---------+-------------+
| id | select_type | table  | type | possible_keys | key  | key_len | ref
| rows    | Extra       |
+----+-------------+--------+------+---------------+------+---------+------+---------+-------------+
|  1 | SIMPLE      | cuenta | ALL  | rutaCuenta    | NULL | NULL    | NULL
| 5274306 | Using where |
+----+-------------+--------+------+---------------+------+---------+------+---------+-------------+
1 row in set (0.00 sec)

Any ideas? I'm creating running a process which populates the rutaCuenta
field with some codification to retrieve some hierarchical  based in that
field... I did the explain meanwhile doing the populating process, and it
showed the usage of the index, then, some time later, it show, for the same
query, the usage of no index...

Why?

I really appreciate some guidance... I find no logic at all...

Thread
Still struggling witn like 'CTV%' over varchar.... I simple cannot understand..Andrés Tello28 Nov
  • Re: Still struggling witn like 'CTV%' over varchar.... I simplecannot understand..Johan De Meersman28 Nov