Advertisement
Guest User

Optimizer Trace

a guest
Feb 13th, 2014
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.98 KB | None | 0 0
  1. {
  2. "steps": [
  3. {
  4. "join_preparation": {
  5. "select#": 1,
  6. "steps": [
  7. {
  8. "expanded_query":
  9. "/* select#1 */ select `departments`.`dept_no` AS `dept_no`
  10. from (`departments` join `dept_manager`
  11. on((`departments`.`dept_no` = `dept_manager`.`dept_no`)))
  12. where (`dept_manager`.`to_date` > now())
  13. group by `departments`.`dept_no`
  14. having (count(`dept_manager`.`emp_no`) > 1)
  15. limit 0,1000"
  16. }
  17. ]
  18. }
  19. },
  20. {
  21. "join_optimization": {
  22. "select#": 1,
  23. "steps": [
  24. {
  25. "transformations_to_nested_joins": {
  26. "transformations": [
  27. "JOIN_condition_to_WHERE",
  28. "parenthesis_removal"
  29. ],
  30. "expanded_query": "/* select#1 */ select `departments`.`dept_no` AS `dept_no` from `departments` join `dept_manager` where ((`dept_manager`.`to_date` > now()) and (`departments`.`dept_no` = `dept_manager`.`dept_no`)) group by `departments`.`dept_no` having (count(`dept_manager`.`emp_no`) > 1) limit 0,1000"
  31. }
  32. },
  33. {
  34. "condition_processing": {
  35. "condition": "WHERE",
  36. "original_condition": "((`dept_manager`.`to_date` > now()) and (`departments`.`dept_no` = `dept_manager`.`dept_no`))",
  37. "steps": [
  38. {
  39. "transformation": "equality_propagation",
  40. "resulting_condition": "((`dept_manager`.`to_date` > now()) and multiple equal(`departments`.`dept_no`, `dept_manager`.`dept_no`))"
  41. },
  42. {
  43. "transformation": "constant_propagation",
  44. "resulting_condition": "((`dept_manager`.`to_date` > now()) and multiple equal(`departments`.`dept_no`, `dept_manager`.`dept_no`))"
  45. },
  46. {
  47. "transformation": "trivial_condition_removal",
  48. "resulting_condition": "((`dept_manager`.`to_date` > now()) and multiple equal(`departments`.`dept_no`, `dept_manager`.`dept_no`))"
  49. }
  50. ]
  51. }
  52. },
  53. {
  54. "condition_processing": {
  55. "condition": "HAVING",
  56. "original_condition": "(count(`dept_manager`.`emp_no`) > 1)",
  57. "steps": [
  58. {
  59. "transformation": "constant_propagation",
  60. "resulting_condition": "(count(`dept_manager`.`emp_no`) > 1)"
  61. },
  62. {
  63. "transformation": "trivial_condition_removal",
  64. "resulting_condition": "(count(`dept_manager`.`emp_no`) > 1)"
  65. }
  66. ]
  67. }
  68. },
  69. {
  70. "table_dependencies": [
  71. {
  72. "table": "`departments`",
  73. "row_may_be_null": false,
  74. "map_bit": 0,
  75. "depends_on_map_bits": [
  76. ]
  77. },
  78. {
  79. "table": "`dept_manager`",
  80. "row_may_be_null": false,
  81. "map_bit": 1,
  82. "depends_on_map_bits": [
  83. ]
  84. }
  85. ]
  86. },
  87. {
  88. "ref_optimizer_key_uses": [
  89. {
  90. "table": "`departments`",
  91. "field": "dept_no",
  92. "equals": "`dept_manager`.`dept_no`",
  93. "null_rejecting": false
  94. },
  95. {
  96. "table": "`dept_manager`",
  97. "field": "dept_no",
  98. "equals": "`departments`.`dept_no`",
  99. "null_rejecting": false
  100. }
  101. ]
  102. },
  103. {
  104. "rows_estimation": [
  105. {
  106. "table": "`departments`",
  107. "const_keys_added": {
  108. "keys": [
  109. "PRIMARY",
  110. "dept_name"
  111. ],
  112. "cause": "group_by"
  113. },
  114. "range_analysis": {
  115. "table_scan": {
  116. "rows": 9,
  117. "cost": 4.9
  118. },
  119. "potential_range_indices": [
  120. {
  121. "index": "PRIMARY",
  122. "usable": true,
  123. "key_parts": [
  124. "dept_no"
  125. ]
  126. },
  127. {
  128. "index": "dept_name",
  129. "usable": true,
  130. "key_parts": [
  131. "dept_name"
  132. ]
  133. }
  134. ],
  135. "best_covering_index_scan": {
  136. "index": "dept_name",
  137. "cost": 2.929,
  138. "chosen": true
  139. },
  140. "setup_range_conditions": [
  141. ],
  142. "group_index_range": {
  143. "chosen": false,
  144. "cause": "not_single_table"
  145. }
  146. }
  147. },
  148. {
  149. "table": "`dept_manager`",
  150. "table_scan": {
  151. "rows": 24,
  152. "cost": 1
  153. }
  154. }
  155. ]
  156. },
  157. {
  158. "considered_execution_plans": [
  159. {
  160. "plan_prefix": [
  161. ],
  162. "table": "`departments`",
  163. "best_access_path": {
  164. "considered_access_paths": [
  165. {
  166. "access_type": "ref",
  167. "index": "PRIMARY",
  168. "usable": false,
  169. "chosen": false
  170. },
  171. {
  172. "access_type": "scan",
  173. "rows": 9,
  174. "cost": 2.8,
  175. "chosen": true,
  176. "use_tmp_table": true
  177. }
  178. ]
  179. },
  180. "cost_for_plan": 2.8,
  181. "rows_for_plan": 9,
  182. "rest_of_plan": [
  183. {
  184. "plan_prefix": [
  185. "`departments`"
  186. ],
  187. "table": "`dept_manager`",
  188. "best_access_path": {
  189. "considered_access_paths": [
  190. {
  191. "access_type": "ref",
  192. "index": "dept_no",
  193. "rows": 1,
  194. "cost": 9.2,
  195. "chosen": true
  196. },
  197. {
  198. "access_type": "scan",
  199. "using_join_cache": true,
  200. "rows": 18,
  201. "cost": 34.6,
  202. "chosen": false
  203. }
  204. ]
  205. },
  206. "cost_for_plan": 13.6,
  207. "rows_for_plan": 9,
  208. "sort_cost": 9,
  209. "new_cost_for_plan": 22.6,
  210. "chosen": true
  211. }
  212. ]
  213. },
  214. {
  215. "plan_prefix": [
  216. ],
  217. "table": "`dept_manager`",
  218. "best_access_path": {
  219. "considered_access_paths": [
  220. {
  221. "access_type": "ref",
  222. "index": "dept_no",
  223. "usable": false,
  224. "chosen": false
  225. },
  226. {
  227. "access_type": "scan",
  228. "rows": 24,
  229. "cost": 5.8,
  230. "chosen": true
  231. }
  232. ]
  233. },
  234. "cost_for_plan": 5.8,
  235. "rows_for_plan": 24,
  236. "rest_of_plan": [
  237. {
  238. "plan_prefix": [
  239. "`dept_manager`"
  240. ],
  241. "table": "`departments`",
  242. "best_access_path": {
  243. "considered_access_paths": [
  244. {
  245. "access_type": "ref",
  246. "index": "PRIMARY",
  247. "rows": 1,
  248. "cost": 24.2,
  249. "chosen": true
  250. },
  251. {
  252. "access_type": "scan",
  253. "cause": "covering_index_better_than_full_scan",
  254. "chosen": false
  255. }
  256. ]
  257. },
  258. "cost_for_plan": 34.6,
  259. "rows_for_plan": 24,
  260. "pruned_by_cost": true
  261. }
  262. ]
  263. }
  264. ]
  265. },
  266. {
  267. "attaching_conditions_to_tables": {
  268. "original_condition": "((`dept_manager`.`dept_no` = `departments`.`dept_no`) and (`dept_manager`.`to_date` > now()))",
  269. "attached_conditions_computation": [
  270. ],
  271. "attached_conditions_summary": [
  272. {
  273. "table": "`departments`",
  274. "attached": null
  275. },
  276. {
  277. "table": "`dept_manager`",
  278. "attached": "(`dept_manager`.`to_date` > now())"
  279. }
  280. ]
  281. }
  282. },
  283. {
  284. "clause_processing": {
  285. "clause": "GROUP BY",
  286. "original_clause": "`departments`.`dept_no`",
  287. "items": [
  288. {
  289. "item": "`departments`.`dept_no`"
  290. }
  291. ],
  292. "resulting_clause_is_simple": true,
  293. "resulting_clause": "`departments`.`dept_no`"
  294. }
  295. },
  296. {
  297. "refine_plan": [
  298. {
  299. "table": "`departments`",
  300. "access_type": "index_scan"
  301. },
  302. {
  303. "table": "`dept_manager`"
  304. }
  305. ]
  306. },
  307. {
  308. "reconsidering_access_paths_for_index_ordering": {
  309. "clause": "GROUP BY",
  310. "index_order_summary": {
  311. "table": "`departments`",
  312. "index_provides_order": true,
  313. "order_direction": "asc",
  314. "index": "PRIMARY",
  315. "plan_changed": true,
  316. "access_type": "index_scan"
  317. }
  318. }
  319. }
  320. ]
  321. }
  322. },
  323. {
  324. "join_execution": {
  325. "select#": 1,
  326. "steps": [
  327. ]
  328. }
  329. }
  330. ]
  331. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement