{
  "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 = 'foo' and example_view.y = 'bar'"
          }
        ]
      }
    },
    {
      "join_optimization": {
        "select_id": 1,
        "steps": [
          {
            "condition_processing": {
              "condition": "WHERE",
              "original_condition": "example_view.x = 'foo' and example_view.y = 'bar'",
              "steps": [
                {
                  "transformation": "equality_propagation",
                  "resulting_condition": "example_view.x = 'foo' and example_view.y = 'bar'"
                },
                {
                  "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": [
                {
                  "table_dependencies": [
                    {
                      "table": "example_data",
                      "row_may_be_null": false,
                      "map_bit": 0,
                      "depends_on_map_bits": []
                    }
                  ]
                },
                {
                  "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"]
                          }
                        ],
                        "group_index_range": {
                          "chosen": false,
                          "cause": "not applicable aggregate function"
                        }
                      }
                    }
                  ]
                },
                {
                  "considered_execution_plans": [
                    {
                      "plan_prefix": [],
                      "get_costs_for_tables": [
                        {
                          "best_access_path": {
                            "table": "example_data",
                            "considered_access_paths": [
                              {
                                "access_type": "scan",
                                "resulting_rows": 100399,
                                "cost": 289,
                                "chosen": true,
                                "use_tmp_table": true
                              }
                            ],
                            "chosen_access_method": {
                              "type": "scan",
                              "records": 100399,
                              "cost": 289,
                              "uses_join_buffering": false
                            }
                          }
                        }
                      ]
                    },
                    {
                      "plan_prefix": [],
                      "table": "example_data",
                      "rows_for_plan": 100399,
                      "cost_for_plan": 20368.8,
                      "cost_for_sorting": 100399
                    }
                  ]
                },
                {
                  "check_split_materialized": {
                    "split_candidates": [
                      "cast_demo.example_data.x",
                      "cast_demo.example_data.y"
                    ]
                  }
                }
              ]
            }
          },
          {
            "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": 100399,
                  "cost": 100399
                }
              }
            ]
          },
          {
            "considered_execution_plans": [
              {
                "plan_prefix": [],
                "get_costs_for_tables": [
                  {
                    "best_access_path": {
                      "table": "<derived2>",
                      "considered_access_paths": [
                        {
                          "access_type": "scan",
                          "resulting_rows": 100399,
                          "cost": 100399,
                          "chosen": true
                        }
                      ],
                      "chosen_access_method": {
                        "type": "scan",
                        "records": 100399,
                        "cost": 100399,
                        "uses_join_buffering": false
                      }
                    }
                  }
                ]
              },
              {
                "plan_prefix": [],
                "table": "<derived2>",
                "rows_for_plan": 100399,
                "cost_for_plan": 120478.8
              }
            ]
          },
          {
            "best_join_order": ["<derived2>"]
          },
          {
            "best_join_order": ["example_data"]
          },
          {
            "attaching_conditions_to_tables": {
              "attached_conditions_computation": [],
              "attached_conditions_summary": [
                {
                  "table": "example_data",
                  "attached": null
                }
              ]
            }
          },
          {
            "test_if_skip_sort_order": [
              {
                "reconsidering_access_paths_for_index_ordering": {
                  "clause": "GROUP BY",
                  "fanout": 1,
                  "read_time": 289.001,
                  "table": "example_data",
                  "rows_estimation": 100399,
                  "possible_keys": [
                    {
                      "index": "PRIMARY",
                      "can_resolve_order": false,
                      "cause": "not usable index for the query"
                    },
                    {
                      "index": "ix_xy",
                      "can_resolve_order": true,
                      "direction": 1,
                      "updated_limit": 100399,
                      "index_scan_time": 47644.18883,
                      "records": 100399,
                      "chosen": true
                    }
                  ]
                }
              }
            ]
          },
          {
            "prepare_sum_aggregators": {
              "function": "sum(cast_demo.example_data.amount)",
              "aggregator_type": "simple"
            }
          },
          {
            "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": []
            }
          }
        ]
      }
    }
  ]
}