-
-
Save davidstrauss/becb03fa75ecac046cafe6f05da9f869 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Query: | |
EXPLAIN SELECT paragraphs_item.revision_id AS revision_id, paragraphs_item.id AS id | |
FROM paragraphs_item | |
INNER JOIN paragraphs_item_field_data paragraphs_item_field_data ON paragraphs_item_field_data.id = paragraphs_item.id | |
WHERE (paragraphs_item_field_data.type IN ('carousel', 'latest_content_section', 'logo_callout', 'multiple_promo', 'people_promo', 'related_content_section', 'rich_text_block', 'vertical_content_listing', 'video')) AND (paragraphs_item_field_data.id IN ('483614', '76841')); | |
QUERY RESULTS: | |
On MariaDB 10.0 environments (query takes only milliseconds): | |
+------+-------------+----------------------------+--------+------------------------------------------------------------------------------------+---------+---------+----------------------------------------+------+-------------+ | |
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | | |
+------+-------------+----------------------------+--------+------------------------------------------------------------------------------------+---------+---------+----------------------------------------+------+-------------+ | |
| 1 | SIMPLE | paragraphs_item_field_data | range | PRIMARY,paragraph_field__type__target_id,paragraph__id__default_langcode__langcode | PRIMARY | 4 | NULL | 2 | Using where | | |
| 1 | SIMPLE | paragraphs_item | eq_ref | PRIMARY | PRIMARY | 4 | pantheon.paragraphs_item_field_data.id | 1 | | | |
+------+-------------+----------------------------+--------+------------------------------------------------------------------------------------+---------+---------+----------------------------------------+------+-------------+ | |
2 rows in set (0.02 sec) | |
On MariaDB 10.4 environments (also query takes a very long time, minutes): | |
+------+-------------+----------------------------+-------+------------------------------------------------------------------------------------+------------------------+---------+-----------------------------+----------+-------------+ | |
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | | |
+------+-------------+----------------------------+-------+------------------------------------------------------------------------------------+------------------------+---------+-----------------------------+----------+-------------+ | |
| 1 | SIMPLE | paragraphs_item | index | PRIMARY | paragraph__revision_id | 5 | NULL | 11950050 | Using index | | |
| 1 | SIMPLE | paragraphs_item_field_data | ref | PRIMARY,paragraph_field__type__target_id,paragraph__id__default_langcode__langcode | PRIMARY | 4 | pantheon.paragraphs_item.id | 1 | Using where | | |
+------+-------------+----------------------------+-------+------------------------------------------------------------------------------------+------------------------+---------+-----------------------------+----------+-------------+ | |
2 rows in set (0.03 sec) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"steps": [ | |
{ | |
"join_preparation": { | |
"select_id": 1, | |
"steps": [ | |
{ | |
"expanded_query": "select paragraphs_item.revision_id AS revision_id,paragraphs_item.`id` AS `id` from (paragraphs_item join paragraphs_item_field_data on(paragraphs_item_field_data.`id` = paragraphs_item.`id`)) where paragraphs_item_field_data.`type` in ('carousel','latest_content_section','logo_callout','multiple_promo','people_promo','related_content_section','rich_text_block','vertical_content_listing','video') and paragraphs_item_field_data.`id` in ('483614','76841')" | |
} | |
] | |
} | |
}, | |
{ | |
"join_optimization": { | |
"select_id": 1, | |
"steps": [ | |
{ | |
"condition_processing": { | |
"condition": "WHERE", | |
"original_condition": "paragraphs_item_field_data.`type` in ('carousel','latest_content_section','logo_callout','multiple_promo','people_promo','related_content_section','rich_text_block','vertical_content_listing','video') and paragraphs_item_field_data.`id` in ('483614','76841') and paragraphs_item_field_data.`id` = paragraphs_item.`id`", | |
"steps": [ | |
{ | |
"transformation": "equality_propagation", | |
"resulting_condition": "paragraphs_item_field_data.`type` in ('carousel','latest_content_section','logo_callout','multiple_promo','people_promo','related_content_section','rich_text_block','vertical_content_listing','video') and paragraphs_item_field_data.`id` in ('483614','76841') and multiple equal(paragraphs_item_field_data.`id`, paragraphs_item.`id`)" | |
}, | |
{ | |
"transformation": "constant_propagation", | |
"resulting_condition": "paragraphs_item_field_data.`type` in ('carousel','latest_content_section','logo_callout','multiple_promo','people_promo','related_content_section','rich_text_block','vertical_content_listing','video') and paragraphs_item_field_data.`id` in ('483614','76841') and multiple equal(paragraphs_item_field_data.`id`, paragraphs_item.`id`)" | |
}, | |
{ | |
"transformation": "trivial_condition_removal", | |
"resulting_condition": "paragraphs_item_field_data.`type` in ('carousel','latest_content_section','logo_callout','multiple_promo','people_promo','related_content_section','rich_text_block','vertical_content_listing','video') and paragraphs_item_field_data.`id` in ('483614','76841') and multiple equal(paragraphs_item_field_data.`id`, paragraphs_item.`id`)" | |
} | |
] | |
} | |
}, | |
{ | |
"table_dependencies": [ | |
{ | |
"table": "paragraphs_item", | |
"row_may_be_null": false, | |
"map_bit": 0, | |
"depends_on_map_bits": [] | |
}, | |
{ | |
"table": "paragraphs_item_field_data", | |
"row_may_be_null": false, | |
"map_bit": 1, | |
"depends_on_map_bits": [] | |
} | |
] | |
}, | |
{ | |
"ref_optimizer_key_uses": [ | |
{ | |
"table": "paragraphs_item", | |
"field": "id", | |
"equals": "paragraphs_item_field_data.`id`", | |
"null_rejecting": false | |
}, | |
{ | |
"table": "paragraphs_item_field_data", | |
"field": "id", | |
"equals": "paragraphs_item.`id`", | |
"null_rejecting": false | |
}, | |
{ | |
"table": "paragraphs_item_field_data", | |
"field": "id", | |
"equals": "paragraphs_item.`id`", | |
"null_rejecting": false | |
} | |
] | |
}, | |
{ | |
"rows_estimation": [ | |
{ | |
"table": "paragraphs_item", | |
"table_scan": { | |
"rows": 11558639, | |
"cost": 63296 | |
} | |
}, | |
{ | |
"table": "paragraphs_item_field_data", | |
"range_analysis": { | |
"table_scan": { | |
"rows": 11867358, | |
"cost": 2.45e6 | |
}, | |
"potential_range_indexes": [ | |
{ | |
"index": "PRIMARY", | |
"usable": true, | |
"key_parts": ["id", "langcode"] | |
}, | |
{ | |
"index": "paragraph_field__type__target_id", | |
"usable": true, | |
"key_parts": ["type", "id", "langcode"] | |
}, | |
{ | |
"index": "paragraph__id__default_langcode__langcode", | |
"usable": true, | |
"key_parts": ["id", "default_langcode", "langcode"] | |
}, | |
{ | |
"index": "paragraph__revision_id", | |
"usable": false, | |
"cause": "not applicable" | |
}, | |
{ | |
"index": "paragraph__status_type", | |
"usable": false, | |
"cause": "not applicable" | |
}, | |
{ | |
"index": "paragraphs__parent_fields", | |
"usable": false, | |
"cause": "not applicable" | |
} | |
], | |
"best_covering_index_scan": { | |
"index": "paragraph_field__type__target_id", | |
"cost": 679265, | |
"chosen": true | |
}, | |
"setup_range_conditions": [], | |
"group_index_range": { | |
"chosen": false, | |
"cause": "not single_table" | |
}, | |
"analyzing_range_alternatives": { | |
"range_scan_alternatives": [ | |
{ | |
"index": "PRIMARY", | |
"ranges": [ | |
"(76841) <= (id) <= (76841)", | |
"(483614) <= (id) <= (483614)" | |
], | |
"rowid_ordered": true, | |
"using_mrr": false, | |
"index_only": false, | |
"rows": 2, | |
"cost": 2.4125, | |
"chosen": true | |
}, | |
{ | |
"index": "paragraph_field__type__target_id", | |
"ranges": [ | |
"(carousel,76841) <= (type,id) <= (carousel,76841)", | |
"(carousel,483614) <= (type,id) <= (carousel,483614)", | |
"(latest_content_section,76841) <= (type,id) <= (latest_content_section,76841)", | |
"(latest_content_section,483614) <= (type,id) <= (latest_content_section,483614)", | |
"(logo_callout,76841) <= (type,id) <= (logo_callout,76841)", | |
"(logo_callout,483614) <= (type,id) <= (logo_callout,483614)", | |
"(multiple_promo,76841) <= (type,id) <= (multiple_promo,76841)", | |
"(multiple_promo,483614) <= (type,id) <= (multiple_promo,483614)", | |
"(people_promo,76841) <= (type,id) <= (people_promo,76841)", | |
"(people_promo,483614) <= (type,id) <= (people_promo,483614)", | |
"(related_content_section,76841) <= (type,id) <= (related_content_section,76841)", | |
"(related_content_section,483614) <= (type,id) <= (related_content_section,483614)", | |
"(rich_text_block,76841) <= (type,id) <= (rich_text_block,76841)", | |
"(rich_text_block,483614) <= (type,id) <= (rich_text_block,483614)", | |
"(vertical_content_listing,76841) <= (type,id) <= (vertical_content_listing,76841)", | |
"(vertical_content_listing,483614) <= (type,id) <= (vertical_content_listing,483614)", | |
"(video,76841) <= (type,id) <= (video,76841)", | |
"(video,483614) <= (type,id) <= (video,483614)" | |
], | |
"rowid_ordered": false, | |
"using_mrr": false, | |
"index_only": true, | |
"rows": 18, | |
"cost": 21.162, | |
"chosen": false, | |
"cause": "cost" | |
}, | |
{ | |
"index": "paragraph__id__default_langcode__langcode", | |
"ranges": [ | |
"(76841) <= (id) <= (76841)", | |
"(483614) <= (id) <= (483614)" | |
], | |
"rowid_ordered": false, | |
"using_mrr": false, | |
"index_only": false, | |
"rows": 2, | |
"cost": 4.7509, | |
"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": "PRIMARY", | |
"rows": 2, | |
"ranges": [ | |
"(76841) <= (id) <= (76841)", | |
"(483614) <= (id) <= (483614)" | |
] | |
}, | |
"rows_for_plan": 2, | |
"cost_for_plan": 2.4125, | |
"chosen": true | |
} | |
} | |
}, | |
{ | |
"table": "paragraphs_item_field_data", | |
"rowid_filters": [ | |
{ | |
"key": "paragraph__id__default_langcode__langcode", | |
"build_cost": 2.3748, | |
"rows": 2 | |
}, | |
{ | |
"key": "paragraph_field__type__target_id", | |
"build_cost": 21.772, | |
"rows": 18 | |
} | |
] | |
}, | |
{ | |
"selectivity_for_indexes": [ | |
{ | |
"index_name": "paragraph_field__type__target_id", | |
"selectivity_from_index": 1.5e-6 | |
} | |
], | |
"selectivity_for_columns": [], | |
"cond_selectivity": 1.5e-6 | |
} | |
] | |
}, | |
{ | |
"considered_execution_plans": [ | |
{ | |
"plan_prefix": [], | |
"table": "paragraphs_item_field_data", | |
"best_access_path": { | |
"considered_access_paths": [ | |
{ | |
"access_type": "range", | |
"resulting_rows": 18, | |
"cost": 2e308, | |
"chosen": true | |
} | |
], | |
"chosen_access_method": { | |
"type": "range", | |
"records": 18, | |
"cost": 2e308, | |
"uses_join_buffering": false | |
} | |
}, | |
"rows_for_plan": 18, | |
"cost_for_plan": 2e308, | |
"rest_of_plan": [ | |
{ | |
"plan_prefix": ["paragraphs_item_field_data"], | |
"table": "paragraphs_item", | |
"best_access_path": { | |
"considered_access_paths": [ | |
{ | |
"access_type": "eq_ref", | |
"index": "PRIMARY", | |
"rows": 1, | |
"cost": 18, | |
"chosen": true | |
}, | |
{ | |
"type": "scan", | |
"chosen": false, | |
"cause": "cost" | |
} | |
], | |
"chosen_access_method": { | |
"type": "eq_ref", | |
"records": 1, | |
"cost": 18, | |
"uses_join_buffering": false | |
} | |
}, | |
"rows_for_plan": 18, | |
"cost_for_plan": 2e308, | |
"estimated_join_cardinality": 18 | |
} | |
] | |
}, | |
{ | |
"plan_prefix": [], | |
"table": "paragraphs_item", | |
"best_access_path": { | |
"considered_access_paths": [ | |
{ | |
"access_type": "scan", | |
"resulting_rows": 1.16e7, | |
"cost": 63296, | |
"chosen": true | |
} | |
], | |
"chosen_access_method": { | |
"type": "scan", | |
"records": 1.16e7, | |
"cost": 63296, | |
"uses_join_buffering": false | |
} | |
}, | |
"rows_for_plan": 1.16e7, | |
"cost_for_plan": 2.38e6, | |
"rest_of_plan": [ | |
{ | |
"plan_prefix": ["paragraphs_item"], | |
"table": "paragraphs_item_field_data", | |
"best_access_path": { | |
"considered_access_paths": [ | |
{ | |
"access_type": "ref", | |
"index": "PRIMARY", | |
"rows": 1, | |
"cost": 1.16e7, | |
"chosen": true | |
}, | |
{ | |
"access_type": "ref", | |
"index": "paragraph__id__default_langcode__langcode", | |
"rowid_filter_key": "paragraph_field__type__target_id", | |
"rows": 1, | |
"cost": 1.19e7, | |
"chosen": false, | |
"cause": "cost" | |
}, | |
{ | |
"type": "scan", | |
"chosen": false, | |
"cause": "cost" | |
} | |
], | |
"chosen_access_method": { | |
"type": "ref", | |
"records": 1, | |
"cost": 1.16e7, | |
"uses_join_buffering": false | |
} | |
}, | |
"rows_for_plan": 1.16e7, | |
"cost_for_plan": 1.63e7, | |
"selectivity": 1.5e-6, | |
"estimated_join_cardinality": 17.532 | |
} | |
] | |
} | |
] | |
}, | |
{ | |
"best_join_order": ["paragraphs_item", "paragraphs_item_field_data"] | |
}, | |
{ | |
"attaching_conditions_to_tables": { | |
"original_condition": "paragraphs_item_field_data.`id` = paragraphs_item.`id` and paragraphs_item_field_data.`type` in ('carousel','latest_content_section','logo_callout','multiple_promo','people_promo','related_content_section','rich_text_block','vertical_content_listing','video') and paragraphs_item_field_data.`id` in ('483614','76841')", | |
"attached_conditions_computation": [], | |
"attached_conditions_summary": [ | |
{ | |
"table": "paragraphs_item", | |
"attached": null | |
}, | |
{ | |
"table": "paragraphs_item_field_data", | |
"attached": "paragraphs_item_field_data.`type` in ('carousel','latest_content_section','logo_callout','multiple_promo','people_promo','related_content_section','rich_text_block','vertical_content_listing','video') and paragraphs_item_field_data.`id` in ('483614','76841')" | |
} | |
] | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"join_execution": { | |
"select_id": 1, | |
"steps": [] | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment