From: Johan De Meersman Date: November 28 2012 9:02am Subject: Re: Still struggling witn like 'CTV%' over varchar.... I simple cannot understand.. List-Archive: http://lists.mysql.com/mysql/228737 Message-Id: <17034689.15872.1354093346731.JavaMail.root@tuxera.be> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable ----- Original Message ----- > From: "Andr=C3=A9s Tello" > > showed the usage of the index, then, some time later, it show, for > the same query, the usage of no index... Look at the "rows" field. It's obvious that this table is live and rather o= n the active side; and the data has changed in such a way that on the secon= d explain, the optimizer estimates that there would be little benefit from = using that key - most likely due to cardinality. Make a copy of the table so your data is static, and you'll get the same ex= plain every time. That will, however, apparently not simulate the real worl= d for you. If this is a MyISAM table you may need to run ANALYZE TABLE to update the s= tatistics; or you may just have to accept that the same query on different = data may benefit from a different execution plan - just as a different quer= y on the same data would. --=20 Linux Bier Wanderung 2012, now also available in Belgium! August, 12 to 19, Diksmuide, Belgium - http://lbw2012.tuxera.be