{
  "steps": [
    {
      "join_preparation": {
        "select_id": 1,
        "steps": [
          {
            "view": {
              "table": "example_view",
              "select_id": 2,
              "algorithm": "materialized"
            }
          },
          {
            "join_preparation": {
              "select_id": 2,
              "steps": [
                {
                  "expanded_query": "/* select#2 */ select cast_demo.example_data.x AS x,cast_demo.example_data.y AS y,sum(cast_demo.example_data.amount) AS total_amount from example_data group by cast_demo.example_data.x,cast_demo.example_data.y"
                }
              ]
            }
          },
          {
            "expanded_query": "/* select#1 */ select example_view.x AS x,example_view.y AS y,example_view.total_amount AS total_amount from example_view where example_view.x = cast('foo' as char charset utf8mb4) and example_view.y = cast('bar' as char charset utf8mb4)"
          }
        ]
      }
    },
    {
      "join_optimization": {
        "select_id": 1,
        "steps": [
          {
            "condition_processing": {
              "condition": "WHERE",
              "original_condition": "example_view.x = cast('foo' as char charset utf8mb4) and example_view.y = cast('bar' as char charset utf8mb4)",
              "steps": [
                {
                  "transformation": "equality_propagation",
                  "resulting_condition": "example_view.x = cast('foo' as char charset utf8mb4) and example_view.y = cast('bar' as char charset utf8mb4)"
                },
                {
                  "transformation": "constant_propagation",
                  "resulting_condition": "example_view.x = 'foo' and example_view.y = 'bar'"
                },
                {
                  "transformation": "trivial_condition_removal",
                  "resulting_condition": "example_view.x = 'foo' and example_view.y = 'bar'"
                }
              ]
            }
          },
          {
            "join_optimization": {
              "select_id": 2,
              "steps": [
                {
                  "condition_processing": {
                    "condition": "WHERE",
                    "original_condition": "cast_demo.example_data.x = 'foo' and cast_demo.example_data.y = 'bar'",
                    "steps": [
                      {
                        "transformation": "equality_propagation",
                        "resulting_condition": "cast_demo.example_data.x = 'foo' and cast_demo.example_data.y = 'bar'"
                      },
                      {
                        "transformation": "constant_propagation",
                        "resulting_condition": "cast_demo.example_data.x = 'foo' and cast_demo.example_data.y = 'bar'"
                      },
                      {
                        "transformation": "trivial_condition_removal",
                        "resulting_condition": "cast_demo.example_data.x = 'foo' and cast_demo.example_data.y = 'bar'"
                      }
                    ]
                  }
                },
                {
                  "table_dependencies": [
                    {
                      "table": "example_data",
                      "row_may_be_null": false,
                      "map_bit": 0,
                      "depends_on_map_bits": []
                    }
                  ]
                },
                {
                  "ref_optimizer_key_uses": [
                    {
                      "table": "example_data",
                      "index": "ix_xy",
                      "field": "x",
                      "equals": "'foo'",
                      "null_rejecting": false
                    },
                    {
                      "table": "example_data",
                      "index": "ix_xy",
                      "field": "y",
                      "equals": "'bar'",
                      "null_rejecting": false
                    }
                  ]
                },
                {
                  "rows_estimation": [
                    {
                      "table": "example_data",
                      "range_analysis": {
                        "table_scan": {
                          "rows": 100399,
                          "cost": 20370.8
                        },
                        "potential_range_indexes": [
                          {
                            "index": "PRIMARY",
                            "usable": false,
                            "cause": "not applicable"
                          },
                          {
                            "index": "ix_xy",
                            "usable": true,
                            "key_parts": ["x", "y", "id"]
                          }
                        ],
                        "setup_range_conditions": [],
                        "analyzing_range_alternatives": {
                          "range_scan_alternatives": [
                            {
                              "index": "ix_xy",
                              "ranges": ["(foo,bar) <= (x,y) <= (foo,bar)"],
                              "rowid_ordered": true,
                              "using_mrr": false,
                              "index_only": false,
                              "rows": 100,
                              "cost": 121.467246,
                              "chosen": true
                            }
                          ],
                          "analyzing_roworder_intersect": {
                            "cause": "too few roworder scans"
                          },
                          "analyzing_index_merge_union": []
                        },
                        "group_index_range": {
                          "chosen": false,
                          "cause": "no group by or distinct"
                        },
                        "chosen_range_access_summary": {
                          "range_access_plan": {
                            "type": "range_scan",
                            "index": "ix_xy",
                            "rows": 100,
                            "ranges": ["(foo,bar) <= (x,y) <= (foo,bar)"]
                          },
                          "rows_for_plan": 100,
                          "cost_for_plan": 121.467246,
                          "chosen": true
                        }
                      }
                    },
                    {
                      "table": "example_data",
                      "rowid_filters": [
                        {
                          "key": "ix_xy",
                          "build_cost": 6.552416143,
                          "rows": 100
                        }
                      ]
                    },
                    {
                      "selectivity_for_indexes": [
                        {
                          "index_name": "ix_xy",
                          "selectivity_from_index": 9.960259e-4
                        }
                      ],
                      "selectivity_for_columns": [],
                      "cond_selectivity": 9.960259e-4
                    }
                  ]
                },
                {
                  "considered_execution_plans": [
                    {
                      "plan_prefix": [],
                      "get_costs_for_tables": [
                        {
                          "best_access_path": {
                            "table": "example_data",
                            "considered_access_paths": [
                              {
                                "access_type": "ref",
                                "index": "ix_xy",
                                "used_range_estimates": true,
                                "rows": 100,
                                "cost": 101.447246,
                                "chosen": true
                              },
                              {
                                "type": "scan",
                                "chosen": false,
                                "cause": "cost"
                              }
                            ],
                            "chosen_access_method": {
                              "type": "ref",
                              "records": 100,
                              "cost": 101.447246,
                              "uses_join_buffering": false
                            }
                          }
                        }
                      ]
                    },
                    {
                      "plan_prefix": [],
                      "table": "example_data",
                      "rows_for_plan": 100,
                      "cost_for_plan": 121.447246
                    }
                  ]
                },
                {
                  "best_join_order": ["example_data"]
                },
                {
                  "substitute_best_equal": {
                    "condition": "WHERE",
                    "resulting_condition": "cast_demo.example_data.x = 'foo' and cast_demo.example_data.y = 'bar'"
                  }
                },
                {
                  "attaching_conditions_to_tables": {
                    "attached_conditions_computation": [],
                    "attached_conditions_summary": [
                      {
                        "table": "example_data",
                        "attached": "cast_demo.example_data.x = 'foo' and cast_demo.example_data.y = 'bar'"
                      }
                    ]
                  }
                },
                {
                  "prepare_sum_aggregators": {
                    "function": "sum(cast_demo.example_data.amount)",
                    "aggregator_type": "simple"
                  }
                }
              ]
            }
          },
          {
            "table_dependencies": [
              {
                "table": "<derived2>",
                "row_may_be_null": false,
                "map_bit": 0,
                "depends_on_map_bits": []
              }
            ]
          },
          {
            "ref_optimizer_key_uses": []
          },
          {
            "rows_estimation": [
              {
                "table": "<derived2>",
                "table_scan": {
                  "rows": 100,
                  "cost": 100
                }
              }
            ]
          },
          {
            "considered_execution_plans": [
              {
                "plan_prefix": [],
                "get_costs_for_tables": [
                  {
                    "best_access_path": {
                      "table": "<derived2>",
                      "considered_access_paths": [
                        {
                          "access_type": "scan",
                          "resulting_rows": 100,
                          "cost": 100,
                          "chosen": true
                        }
                      ],
                      "chosen_access_method": {
                        "type": "scan",
                        "records": 100,
                        "cost": 100,
                        "uses_join_buffering": false
                      }
                    }
                  }
                ]
              },
              {
                "plan_prefix": [],
                "table": "<derived2>",
                "rows_for_plan": 100,
                "cost_for_plan": 120
              }
            ]
          },
          {
            "best_join_order": ["<derived2>"]
          },
          {
            "substitute_best_equal": {
              "condition": "WHERE",
              "resulting_condition": "example_view.x = 'foo' and example_view.y = 'bar'"
            }
          },
          {
            "attaching_conditions_to_tables": {
              "attached_conditions_computation": [],
              "attached_conditions_summary": [
                {
                  "table": "<derived2>",
                  "attached": "example_view.x = 'foo' and example_view.y = 'bar'"
                }
              ]
            }
          }
        ]
      }
    },
    {
      "join_execution": {
        "select_id": 1,
        "steps": [
          {
            "join_execution": {
              "select_id": 2,
              "steps": []
            }
          }
        ]
      }
    }
  ]
}