MariaDB [lizardo]> select * from information_schema.optimizer_trace\G *************************** 1. row *************************** QUERY: analyze format=json select * from t1 where nm like '$a' AND fl2 = 0 TRACE: { "steps": [ { "join_preparation": { "select_id": 1, "steps": [ { "expanded_query": "select t1.pk AS pk,t1.nm AS nm,t1.fl1 AS fl1,t1.fl2 AS fl2 from t1 where t1.nm like '$a' and t1.fl2 = 0" } ] } }, { "join_optimization": { "select_id": 1, "steps": [ { "condition_processing": { "condition": "WHERE", "original_condition": "t1.nm like '$a' and t1.fl2 = 0", "steps": [ { "transformation": "equality_propagation", "resulting_condition": "t1.nm like '$a' and multiple equal(0, t1.fl2)" }, { "transformation": "constant_propagation", "resulting_condition": "t1.nm like '$a' and multiple equal(0, t1.fl2)" }, { "transformation": "trivial_condition_removal", "resulting_condition": "t1.nm like '$a' and multiple equal(0, t1.fl2)" } ] } }, { "table_dependencies": [ { "table": "t1", "row_may_be_null": false, "map_bit": 0, "depends_on_map_bits": [] } ] }, { "ref_optimizer_key_uses": [ { "table": "t1", "field": "fl2", "equals": "0", "null_rejecting": true } ] }, { "rows_estimation": [ { "table": "t1", "range_analysis": { "table_scan": { "rows": 1000, "cost": 208.98 }, "potential_range_indexes": [ { "index": "PRIMARY", "usable": false, "cause": "not applicable" }, { "index": "idx1", "usable": true, "key_parts": ["nm", "fl1"] }, { "index": "idx2", "usable": true, "key_parts": ["fl2"] } ], "setup_range_conditions": [], "group_index_range": { "chosen": false, "cause": "no group by or distinct" }, "analyzing_range_alternatives": { "range_scan_alternatives": [ { "index": "idx1", "ranges": ["($a) <= (nm) <= ($a)"], "rowid_ordered": false, "using_mrr": false, "index_only": false, "rows": 1, "cost": 2.3834, "chosen": true }, { "index": "idx2", "ranges": ["(0) <= (fl2) <= (0)"], "rowid_ordered": true, "using_mrr": false, "index_only": false, "rows": 492, "cost": 621.89, "chosen": false, "cause": "cost" } ], "analyzing_roworder_intersect": { "cause": "too few roworder scans" }, "analyzing_index_merge_union": [] }, "chosen_range_access_summary": { "range_access_plan": { "type": "range_scan", "index": "idx1", "rows": 1, "ranges": ["($a) <= (nm) <= ($a)"] }, "rows_for_plan": 1, "cost_for_plan": 2.3834, "chosen": true } } }, { "selectivity_for_indexes": [ { "index_name": "idx1", "selectivity_from_index": 0.001 }, { "index_name": "idx2", "selectivity_from_index": 0.492 } ], "selectivity_for_columns": [], "cond_selectivity": 4.9e-4 } ] }, { "considered_execution_plans": [ { "plan_prefix": [], "table": "t1", "best_access_path": { "considered_access_paths": [ { "access_type": "ref", "index": "idx2", "used_range_estimates": true, "rows": 492, "cost": 21, "chosen": true }, { "access_type": "range", "resulting_rows": 0.492, "cost": 2.485, "chosen": true } ], "chosen_access_method": { "type": "range", "records": 0.492, "cost": 2.485, "uses_join_buffering": false } }, "rows_for_plan": 0.492, "cost_for_plan": 2.5834, "estimated_join_cardinality": 0.492 } ] }, { "best_join_order": ["t1"] }, { "attaching_conditions_to_tables": { "original_condition": "t1.fl2 = 0 and t1.nm like '$a'", "attached_conditions_computation": [], "attached_conditions_summary": [ { "table": "t1", "attached": "t1.fl2 = 0 and t1.nm like '$a'" } ] } } ] } }, { "join_execution": { "select_id": 1, "steps": [] } } ] } MISSING_BYTES_BEYOND_MAX_MEM_SIZE: 0 INSUFFICIENT_PRIVILEGES: 0 1 row in set (0.001 sec)