1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
| { "steps": [ { # 第一步: perpare准备阶段 "join_preparation": { "select#": 1, "steps": [ { # 进行SQL语句格式化操作 "expanded_query": "/* select#1 */ select `dicom_image_info`.`id` AS `id`,`dicom_image_info`.`patient_id` AS `patient_id`,`dicom_image_info`.`study_instance_uid` AS `study_instance_uid`,`dicom_image_info`.`series_instance_uid` AS `series_instance_uid`,`dicom_image_info`.`sop_instance_uid` AS `sop_instance_uid`,`dicom_image_info`.`instance_number` AS `instance_number`,`dicom_image_info`.`created_time` AS `created_time`,`dicom_image_info`.`updated_time` AS `updated_time` from `dicom_image_info` where (`dicom_image_info`.`patient_id` = '3583925')" } ] } }, { # 第二步: SQL优化阶段 "join_optimization": { "select#": 1, "steps": [ { # 判断条件优化 "condition_processing": { # 条件类型是where条件类型,也可能是having条件类型 "condition": "WHERE", # original_condition是原始条件类型 "original_condition": "(`dicom_image_info`.`patient_id` = '3583925')", "steps": [ { # 第一步优化: 等值优化 "transformation": "equality_propagation", # 优化之后的输出结果 "resulting_condition": "multiple equal('3583925', `dicom_image_info`.`patient_id`)" }, { # 第二步优化: 常量比较优化 "transformation": "constant_propagation", # 优化之后的输出结果 "resulting_condition": "multiple equal('3583925', `dicom_image_info`.`patient_id`)" }, { # 第三步优化: 条件移除优化,去挑一些不必要的条件 "transformation": "trivial_condition_removal", "resulting_condition": "multiple equal('3583925', `dicom_image_info`.`patient_id`)" } ] } }, { "substitute_generated_columns": { } }, { # 表依赖分析 "table_dependencies": [ { # 表名 "table": "`dicom_image_info`", # 判断行记录是否有可能为空, 在left join 连接的被驱动表上会显示为true "row_may_be_null": false, # 当前的记录位: 0 "map_bit": 0, # 依赖的前置记录位 "depends_on_map_bits": [ ] } ] }, { # 使用的优化的索引 "ref_optimizer_key_uses": [ { "table": "`dicom_image_info`", "field": "patient_id", "equals": "'3583925'", "null_rejecting": true } ] }, { # 扫描表的行记录的一个性能评估 "rows_estimation": [ { "table": "`dicom_image_info`", # 数据扫描分析 "range_analysis": { "table_scan": { # 扫描的记录数 "rows": 6474, # cost的成本值 "cost": 673.75 }, # 表的索引分析 "potential_range_indexes": [ { # 主键索引 "index": "PRIMARY", "usable": false, "cause": "not_applicable" }, { # 普通索引 "index": "patient_id", "usable": true, # 索引的部分 "key_parts": [ "patient_id", "study_instance_uid", "series_instance_uid", "sop_instance_uid" ] } ], "setup_range_conditions": [ ], # 分组索引范围 "group_index_range": { "chosen": false, # 没有分组和去重操作 "cause": "not_group_by_or_distinct" }, "skip_scan_range": { "potential_skip_scan_indexes": [ { "index": "patient_id", "usable": false, "cause": "query_references_nonkey_column" } ] }, # 分析索引的使用成本 "analyzing_range_alternatives": { # range 扫描分析 "range_scan_alternatives": [ { # 索引名称 "index": "patient_id", # 扫描范围 "ranges": [ "3583925 <= patient_id <= 3583925" ], # 选择一种计算更准确的方式 "index_dives_for_eq_ranges": true, # rowId是否有序 "rowid_ordered": false, # 是否使用了mrr优化 "using_mrr": false, # 是否只查询索引数据 "index_only": false, # 返回的行数 "rows": 2388, # 预估的成本 "cost": 836.06, # 是否选择 "chosen": false, "cause": "cost" } ], # 分析是否使用了索引合并 "analyzing_roworder_intersect": { "usable": false, "cause": "too_few_roworder_scans" } } } } ] }, { # 最后的索引选择方案 "considered_execution_plans": [ { # 前置的依赖执行计划 "plan_prefix": [ ], "table": "`dicom_image_info`", # 最优的访问路径 "best_access_path": { "considered_access_paths": [ { # 使用索引的方式 "access_type": "ref", "index": "patient_id", "rows": 2388, "cost": 311.55, "chosen": true }, { # 扫描表的方式 "rows_to_scan": 6474, "filtering_effect": [ ], "final_filtering_effect": 0.36886, "access_type": "scan", "resulting_rows": 2388, "cost": 671.65, "chosen": false } ] }, # 最终选择的方案 "condition_filtering_pct": 100, "rows_for_plan": 2388, "cost_for_plan": 311.55, "chosen": true } ] }, { # 优化原来的where条件 "attaching_conditions_to_tables": { "original_condition": "(`dicom_image_info`.`patient_id` = '3583925')", "attached_conditions_computation": [ ], "attached_conditions_summary": [ { "table": "`dicom_image_info`", "attached": "(`dicom_image_info`.`patient_id` = '3583925')" } ] } }, { "finalizing_table_conditions": [ { "table": "`dicom_image_info`", "original_table_condition": "(`dicom_image_info`.`patient_id` = '3583925')", "final_table_condition ": null } ] }, { # 改善执行计划 "refine_plan": [ { "table": "`dicom_image_info`" } ] } ] } }, { "join_explain": { "select#": 1, "steps": [ ] } } ] }
|