Here's the optimizer trace that indicates that MySQL thinks that the cost for the index scan is higher than the cost for a full table scan. This is of course wrong. { "steps": [ { "join_preparation": { "select#": 1, "steps": [ { "expanded_query": "/* select#1 */ select `BIG_STORAGE_TOKU`.`EXPIRE_DATE` AS `EXPIRE_DATE` from `BIG_STORAGE_TOKU` where (`BIG_STORAGE_TOKU`.`HASH_ID` = sha2('70164',256))" } ] } }, { "join_optimization": { "select#": 1, "steps": [ { "condition_processing": { "condition": "WHERE", "original_condition": "(`BIG_STORAGE_TOKU`.`HASH_ID` = sha2('70164',256))", "steps": [ { "transformation": "equality_propagation", "resulting_condition": "multiple equal(sha2('70164',256), `BIG_STORAGE_TOKU`.`HASH_ID`)" }, { "transformation": "constant_propagation", "resulting_condition": "multiple equal(sha2('70164',256), `BIG_STORAGE_TOKU`.`HASH_ID`)" }, { "transformation": "trivial_condition_removal", "resulting_condition": "multiple equal(sha2('70164',256), `BIG_STORAGE_TOKU`.`HASH_ID`)" } ] } }, { "table_dependencies": [ { "table": "`BIG_STORAGE_TOKU`", "row_may_be_null": false, "map_bit": 0, "depends_on_map_bits": [ ] } ] }, { "ref_optimizer_key_uses": [ { "table": "`BIG_STORAGE_TOKU`", "field": "HASH_ID", "equals": "sha2('70164',256)", "null_rejecting": false } ] }, { "rows_estimation": [ { "table": "`BIG_STORAGE_TOKU`", "range_analysis": { "table_scan": { "rows": 100030, "cost": 53351 }, "potential_range_indices": [ { "index": "HASH_ID_IX", "usable": true, "key_parts": [ "HASH_ID" ] }, { "index": "EXPIRE_DATE_IX", "usable": false, "cause": "not_applicable" } ], "setup_range_conditions": [ ], "group_index_range": { "chosen": false, "cause": "not_group_by_or_distinct" }, "analyzing_range_alternatives": { "range_scan_alternatives": [ { "index": "HASH_ID_IX", "ranges": [ "ffff925a44dfc908915841bdafe81d3ee3b5238610e4901d0d806e4740881084 <= HASH_ID <= ffff925a44dfc908915841bdafe81d3ee3b5238610e4901d0d806e4740881084" ], "index_dives_for_eq_ranges": true, "rowid_ordered": true, "using_mrr": false, "index_only": false, "rows": 239680, "cost": 287617, "chosen": false, "cause": "cost" } ], "analyzing_roworder_intersect": { "usable": false, "cause": "too_few_roworder_scans" } } } } ] }, { "considered_execution_plans": [ { "plan_prefix": [ ], "table": "`BIG_STORAGE_TOKU`", "best_access_path": { "considered_access_paths": [ { "access_type": "ref", "index": "HASH_ID_IX", "rows": 239680, "cost": 57939, "chosen": true }, { "access_type": "scan", "rows": 75023, "cost": 53349, "chosen": true } ] }, "cost_for_plan": 53349, "rows_for_plan": 75023, "chosen": true } ] }, { "attaching_conditions_to_tables": { "original_condition": "(`BIG_STORAGE_TOKU`.`HASH_ID` = sha2('70164',256))", "attached_conditions_computation": [ ], "attached_conditions_summary": [ { "table": "`BIG_STORAGE_TOKU`", "attached": "(`BIG_STORAGE_TOKU`.`HASH_ID` = sha2('70164',256))" } ] } }, { "refine_plan": [ { "table": "`BIG_STORAGE_TOKU`", "access_type": "table_scan" } ] } ] } }, { "join_execution": { "select#": 1, "steps": [ ] } } ] }