Re: why must i specify an index in query?
When would the optimizer not use an index?
http://mysql.rjweb.org/doc.php/index_cookbook_mysql#flags_and_low_cardinality
says
INDEX(flag) is almost never useful if `flag` has very few values. More specifically, when you say WHERE flag = 1 and "1" occurs more than 20% of the time, such an index will be shunned. The Optimizer would prefer to scan the table instead of bouncing back and forth between the index and the data for more than 20% of the rows.
("20%" is really somewhere between 10% and 30%, depending on the phase of the moon.)
Subject
Views
Written By
Posted
1751
July 02, 2015 10:31AM
885
July 02, 2015 11:46AM
1539
July 02, 2015 12:46PM
995
July 02, 2015 01:58PM
1018
July 02, 2015 02:49PM
938
July 02, 2015 09:47PM
906
July 02, 2015 10:36PM
1047
July 03, 2015 08:10AM
937
July 03, 2015 03:06PM
Re: why must i specify an index in query?
903
July 03, 2015 09:12PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.