mysql explain format = json 查看sql执行效率

查询结果:{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "8.42"
    },
    "table": {
      "table_name": "td",
      "access_type": "range",
      "possible_keys": [
        "PRIMARY"
      ],
      "key": "PRIMARY",
      "used_key_parts": [
        "id"
      ],
      "key_length": "4",
      "rows_examined_per_scan": 6,
      "rows_produced_per_join": 6,
      "filtered": "100.00",
      "cost_info": {
        "read_cost": "7.22",
        "eval_cost": "1.20",
        "prefix_cost": "8.42",
        "data_read_per_join": "1K"
      },
      "used_columns": [
        "id",
        "name"
      ],
      "attached_condition": "(`gourd`.`td`.`id` in (1,2,3,4,5,6))"
    }
  }

}


query_cost:查询花费的成本

access_type:用到哪种类型的索引

其他的就不一一解释了。

你可能感兴趣的:(mysql,sql)