*************************** 1. row ***************************
                            QUERY: select
distinct svc.idService,
svc.deviceUID,
svc.driverId,
svc.lineId,
svc.subLineId,
svc.initDateTime,
svc.endDateTime,
svc.originStopId,
svc.reinforcement,
sd.hardwareId as vehicleIdentificationNumber
from
iots.Service svc
inner join iots.ServiceData sd on
svc.idService = sd.idService
and svc.deviceUID = sd.deviceUID
inner join drivers.drivers d on
d.code = svc.driverId
where
((svc.initDateTime between '2025-02-11' and '2025-02-12')
or (svc.endDateTime between '2025-02-11' and '2025-02-12'))
and d.company_id in (51)
                            TRACE: {
  "steps": [
    {
      "join_preparation": {
        "select_id": 1,
        "steps": [
          {
            "expanded_query": "select distinct svc.idService AS idService,svc.deviceUID AS deviceUID,svc.driverId AS driverId,svc.lineId AS lineId,svc.subLineId AS subLineId,svc.initDateTime AS initDateTime,svc.endDateTime AS endDateTime,svc.originStopId AS originStopId,svc.reinforcement AS reinforcement,sd.hardwareId AS vehicleIdentificationNumber from ((Service svc join ServiceData sd on(svc.idService = sd.idService and svc.deviceUID = sd.deviceUID)) join drivers d on(drivers.d.`code` = svc.driverId)) where (svc.initDateTime between <cache>('2025-02-11') and <cache>('2025-02-12') or svc.endDateTime between <cache>('2025-02-11') and <cache>('2025-02-12')) and drivers.d.company_id = 51"
          }
        ]
      }
    },
    {
      "join_optimization": {
        "select_id": 1,
        "steps": [
          {
            "condition_processing": {
              "condition": "WHERE",
              "original_condition": "(svc.initDateTime between <cache>('2025-02-11') and <cache>('2025-02-12') or svc.endDateTime between <cache>('2025-02-11') and <cache>('2025-02-12')) and drivers.d.company_id = 51 and drivers.d.`code` = svc.driverId and svc.idService = sd.idService and svc.deviceUID = sd.deviceUID",
              "steps": [
                {
                  "transformation": "equality_propagation",
                  "resulting_condition": "(svc.initDateTime between <cache>('2025-02-11') and <cache>('2025-02-12') or svc.endDateTime between <cache>('2025-02-11') and <cache>('2025-02-12')) and drivers.d.`code` = svc.driverId and svc.deviceUID = sd.deviceUID and multiple equal(51, drivers.d.company_id) and multiple equal(svc.idService, sd.idService)"
                },
                {
                  "transformation": "constant_propagation",
                  "resulting_condition": "(svc.initDateTime between <cache>('2025-02-11') and <cache>('2025-02-12') or svc.endDateTime between <cache>('2025-02-11') and <cache>('2025-02-12')) and drivers.d.`code` = svc.driverId and svc.deviceUID = sd.deviceUID and multiple equal(51, drivers.d.company_id) and multiple equal(svc.idService, sd.idService)"
                },
                {
                  "transformation": "trivial_condition_removal",
                  "resulting_condition": "(svc.initDateTime between <cache>('2025-02-11') and <cache>('2025-02-12') or svc.endDateTime between <cache>('2025-02-11') and <cache>('2025-02-12')) and drivers.d.`code` = svc.driverId and svc.deviceUID = sd.deviceUID and multiple equal(51, drivers.d.company_id) and multiple equal(svc.idService, sd.idService)"
                }
              ]
            }
          },
          {
            "table_dependencies": [
              {
                "table": "svc",
                "row_may_be_null": false,
                "map_bit": 0,
                "depends_on_map_bits": []
              },
              {
                "table": "sd",
                "row_may_be_null": false,
                "map_bit": 1,
                "depends_on_map_bits": []
              },
              {
                "table": "d",
                "row_may_be_null": false,
                "map_bit": 2,
                "depends_on_map_bits": []
              }
            ]
          },
          {
            "ref_optimizer_key_uses": [
              {
                "table": "svc",
                "field": "idService",
                "equals": "sd.idService",
                "null_rejecting": false
              },
              {
                "table": "svc",
                "field": "deviceUID",
                "equals": "sd.deviceUID",
                "null_rejecting": false
              },
              {
                "table": "sd",
                "field": "idService",
                "equals": "svc.idService",
                "null_rejecting": false
              },
              {
                "table": "sd",
                "field": "deviceUID",
                "equals": "svc.deviceUID",
                "null_rejecting": false
              },
              {
                "table": "d",
                "field": "company_id",
                "equals": "51",
                "null_rejecting": false
              },
              {
                "table": "d",
                "field": "company_id",
                "equals": "51",
                "null_rejecting": false
              }
            ]
          },
          {
            "rows_estimation": [
              {
                "table": "svc",
                "range_analysis": {
                  "table_scan": {
                    "rows": 2383168,
                    "cost": 488398.6
                  },
                  "potential_range_indexes": [
                    {
                      "index": "PRIMARY",
                      "usable": false,
                      "cause": "not applicable"
                    },
                    {
                      "index": "IDX_init_Service",
                      "usable": true,
                      "key_parts": ["initDateTime", "idService", "deviceUID"]
                    },
                    {
                      "index": "IDX_end_Service",
                      "usable": true,
                      "key_parts": ["endDateTime", "idService", "deviceUID"]
                    }
                  ],
                  "setup_range_conditions": [],
                  "analyzing_range_alternatives": {
                    "range_scan_alternatives": [],
                    "analyzing_roworder_intersect": {
                      "cause": "too few roworder scans"
                    },
                    "analyzing_index_merge_union": [
                      {
                        "indexes_to_merge": [
                          {
                            "range_scan_alternatives": [
                              {
                                "index": "IDX_init_Service",
                                "ranges": [
                                  "(2025-02-11 00:00:00) <= (initDateTime) <= (2025-02-12 00:00:00)"
                                ],
                                "rowid_ordered": false,
                                "using_mrr": false,
                                "index_only": true,
                                "rows": 1367,
                                "cost": 277.2958697,
                                "chosen": true
                              }
                            ],
                            "index_to_merge": "IDX_init_Service",
                            "cumulated_cost": 277.2958697
                          },
                          {
                            "range_scan_alternatives": [
                              {
                                "index": "IDX_end_Service",
                                "ranges": [
                                  "(2025-02-11 00:00:00) <= (endDateTime) <= (2025-02-12 00:00:00)"
                                ],
                                "rowid_ordered": false,
                                "using_mrr": false,
                                "index_only": true,
                                "rows": 1368,
                                "cost": 277.496419,
                                "chosen": true
                              }
                            ],
                            "index_to_merge": "IDX_end_Service",
                            "cumulated_cost": 554.7922887
                          }
                        ],
                        "cost_of_reading_ranges": 554.7922887,
                        "cost_sort_rowid_and_read_disk": 2739.979896,
                        "cost_duplicate_removal": 109.1962621,
                        "total_cost": 3403.968447
                      }
                    ]
                  },
                  "group_index_range": {
                    "chosen": false,
                    "cause": "not single_table"
                  },
                  "chosen_range_access_summary": {
                    "range_access_plan": {
                      "type": "index_merge",
                      "index_merge_of": [
                        {
                          "type": "range_scan",
                          "index": "IDX_init_Service",
                          "rows": 1367,
                          "ranges": [
                            "(2025-02-11 00:00:00) <= (initDateTime) <= (2025-02-12 00:00:00)"
                          ]
                        },
                        {
                          "type": "range_scan",
                          "index": "IDX_end_Service",
                          "rows": 1368,
                          "ranges": [
                            "(2025-02-11 00:00:00) <= (endDateTime) <= (2025-02-12 00:00:00)"
                          ]
                        }
                      ]
                    },
                    "rows_for_plan": 2735,
                    "cost_for_plan": 3403.968447,
                    "chosen": true
                  }
                }
              },
              {
                "selectivity_for_indexes": [],
                "selectivity_for_columns": [],
                "cond_selectivity": 0.001147632
              },
              {
                "table": "sd",
                "table_scan": {
                  "rows": 2383155,
                  "cost": 6891
                }
              },
              {
                "table": "d",
                "range_analysis": {
                  "table_scan": {
                    "rows": 3143,
                    "cost": 652.6
                  },
                  "potential_range_indexes": [
                    {
                      "index": "PRIMARY",
                      "usable": false,
                      "cause": "not applicable"
                    },
                    {
                      "index": "unique_driver_document",
                      "usable": true,
                      "key_parts": ["company_id", "doc_number"]
                    },
                    {
                      "index": "IDX_companyId_drivers",
                      "usable": true,
                      "key_parts": ["company_id", "code"]
                    }
                  ],
                  "best_covering_index_scan": {
                    "index": "IDX_companyId_drivers",
                    "cost": 641.1093317,
                    "chosen": true
                  },
                  "setup_range_conditions": [],
                  "analyzing_range_alternatives": {
                    "range_scan_alternatives": [
                      {
                        "index": "unique_driver_document",
                        "ranges": ["(51) <= (company_id) <= (51)"],
                        "rowid_ordered": false,
                        "using_mrr": false,
                        "index_only": true,
                        "rows": 408,
                        "cost": 82.04380989,
                        "chosen": true
                      },
                      {
                        "index": "IDX_companyId_drivers",
                        "ranges": ["(51) <= (company_id) <= (51)"],
                        "rowid_ordered": true,
                        "using_mrr": false,
                        "index_only": true,
                        "rows": 408,
                        "cost": 81.93424626,
                        "chosen": true
                      }
                    ],
                    "analyzing_roworder_intersect": {
                      "cause": "too few roworder scans"
                    },
                    "analyzing_index_merge_union": []
                  },
                  "group_index_range": {
                    "chosen": false,
                    "cause": "not single_table"
                  },
                  "chosen_range_access_summary": {
                    "range_access_plan": {
                      "type": "range_scan",
                      "index": "IDX_companyId_drivers",
                      "rows": 408,
                      "ranges": ["(51) <= (company_id) <= (51)"]
                    },
                    "rows_for_plan": 408,
                    "cost_for_plan": 81.93424626,
                    "chosen": true
                  }
                }
              },
              {
                "table": "d",
                "rowid_filters": [
                  {
                    "key": "IDX_companyId_drivers",
                    "build_cost": 26.88021633,
                    "rows": 408
                  },
                  {
                    "key": "IDX_companyId_drivers",
                    "build_cost": 26.88021633,
                    "rows": 408
                  }
                ]
              },
              {
                "selectivity_for_indexes": [
                  {
                    "index_name": "unique_driver_document",
                    "selectivity_from_index": 0.129812281
                  }
                ],
                "selectivity_for_columns": [],
                "cond_selectivity": 0.129812281
              }
            ]
          },
          {
            "considered_execution_plans": [
              {
                "plan_prefix": [],
                "table": "d",
                "best_access_path": {
                  "considered_access_paths": [
                    {
                      "access_type": "ref",
                      "index": "unique_driver_document",
                      "used_range_estimates": true,
                      "rowid_filter_skipped": "worst/max seeks clipping",
                      "rows": 408,
                      "cost": 0.423809887,
                      "chosen": true
                    },
                    {
                      "access_type": "ref",
                      "index": "IDX_companyId_drivers",
                      "used_range_estimates": true,
                      "rowid_filter_skipped": "worst/max seeks clipping",
                      "rows": 408,
                      "cost": 0.314246262,
                      "chosen": true
                    },
                    {
                      "type": "scan",
                      "chosen": false,
                      "cause": "cost"
                    }
                  ],
                  "chosen_access_method": {
                    "type": "ref",
                    "records": 408,
                    "cost": 0.314246262,
                    "uses_join_buffering": false
                  }
                },
                "rows_for_plan": 408,
                "cost_for_plan": 81.91424626,
                "rest_of_plan": [
                  {
                    "plan_prefix": ["d"],
                    "table": "svc",
                    "best_access_path": {
                      "considered_access_paths": [
                        {
                          "access_type": "index_merge",
                          "resulting_rows": 2735,
                          "cost": 1388819.126,
                          "chosen": true
                        }
                      ],
                      "chosen_access_method": {
                        "type": "index_merge",
                        "records": 2735,
                        "cost": 1388819.126,
                        "uses_join_buffering": true
                      }
                    },
                    "rows_for_plan": 1115880,
                    "cost_for_plan": 1612077.04,
                    "rest_of_plan": [
                      {
                        "plan_prefix": ["d", "svc"],
                        "table": "sd",
                        "best_access_path": {
                          "considered_access_paths": [
                            {
                              "access_type": "eq_ref",
                              "index": "PRIMARY",
                              "rows": 1,
                              "cost": 2735,
                              "chosen": true
                            },
                            {
                              "type": "scan",
                              "chosen": false,
                              "cause": "cost"
                            }
                          ],
                          "chosen_access_method": {
                            "type": "eq_ref",
                            "records": 1,
                            "cost": 2735,
                            "uses_join_buffering": false
                          }
                        },
                        "rows_for_plan": 1115880,
                        "cost_for_plan": 1837988.04,
                        "estimated_join_cardinality": 1115880
                      }
                    ]
                  },
                  {
                    "plan_prefix": ["d"],
                    "table": "sd",
                    "best_access_path": {
                      "considered_access_paths": [
                        {
                          "access_type": "scan",
                          "resulting_rows": 2383155,
                          "cost": 6891,
                          "chosen": true
                        }
                      ],
                      "chosen_access_method": {
                        "type": "scan",
                        "records": 2383155,
                        "cost": 6891,
                        "uses_join_buffering": true
                      }
                    },
                    "rows_for_plan": 972327240,
                    "cost_for_plan": 194472420.9,
                    "pruned_by_cost": true
                  }
                ]
              },
              {
                "plan_prefix": [],
                "table": "svc",
                "best_access_path": {
                  "considered_access_paths": [
                    {
                      "access_type": "index_merge",
                      "resulting_rows": 2735,
                      "cost": 3403.968447,
                      "chosen": true
                    }
                  ],
                  "chosen_access_method": {
                    "type": "index_merge",
                    "records": 2735,
                    "cost": 3403.968447,
                    "uses_join_buffering": false
                  }
                },
                "rows_for_plan": 2735,
                "cost_for_plan": 3950.968447,
                "rest_of_plan": [
                  {
                    "plan_prefix": ["svc"],
                    "table": "d",
                    "best_access_path": {
                      "considered_access_paths": [
                        {
                          "access_type": "ref",
                          "index": "unique_driver_document",
                          "used_range_estimates": true,
                          "rowid_filter_skipped": "worst/max seeks clipping",
                          "rows": 408,
                          "cost": 1159.120041,
                          "chosen": true
                        },
                        {
                          "access_type": "ref",
                          "index": "IDX_companyId_drivers",
                          "used_range_estimates": true,
                          "rowid_filter_skipped": "worst/max seeks clipping",
                          "rows": 408,
                          "cost": 859.4635261,
                          "chosen": true
                        },
                        {
                          "type": "scan",
                          "chosen": false,
                          "cause": "cost"
                        }
                      ],
                      "chosen_access_method": {
                        "type": "ref",
                        "records": 408,
                        "cost": 859.4635261,
                        "uses_join_buffering": false
                      }
                    },
                    "rows_for_plan": 1115880,
                    "cost_for_plan": 227986.432,
                    "rest_of_plan": [
                      {
                        "plan_prefix": ["svc", "d"],
                        "table": "sd",
                        "best_access_path": {
                          "considered_access_paths": [
                            {
                              "access_type": "eq_ref",
                              "index": "PRIMARY",
                              "rows": 1,
                              "cost": 2735,
                              "chosen": true
                            },
                            {
                              "type": "scan",
                              "chosen": false,
                              "cause": "cost"
                            }
                          ],
                          "chosen_access_method": {
                            "type": "eq_ref",
                            "records": 1,
                            "cost": 2735,
                            "uses_join_buffering": false
                          }
                        },
                        "rows_for_plan": 1115880,
                        "cost_for_plan": 453897.432,
                        "estimated_join_cardinality": 1115880
                      }
                    ]
                  },
                  {
                    "plan_prefix": ["svc"],
                    "table": "sd",
                    "best_access_path": {
                      "considered_access_paths": [
                        {
                          "access_type": "eq_ref",
                          "index": "PRIMARY",
                          "rows": 1,
                          "cost": 2735,
                          "chosen": true
                        },
                        {
                          "type": "scan",
                          "chosen": false,
                          "cause": "cost"
                        }
                      ],
                      "chosen_access_method": {
                        "type": "eq_ref",
                        "records": 1,
                        "cost": 2735,
                        "uses_join_buffering": false
                      }
                    },
                    "rows_for_plan": 2735,
                    "cost_for_plan": 7232.968447,
                    "rest_of_plan": [
                      {
                        "plan_prefix": ["svc", "sd"],
                        "table": "d",
                        "best_access_path": {
                          "considered_access_paths": [
                            {
                              "access_type": "ref",
                              "index": "unique_driver_document",
                              "used_range_estimates": true,
                              "rowid_filter_skipped": "worst/max seeks clipping",
                              "rows": 408,
                              "cost": 1159.120041,
                              "chosen": true
                            },
                            {
                              "access_type": "ref",
                              "index": "IDX_companyId_drivers",
                              "used_range_estimates": true,
                              "rowid_filter_skipped": "worst/max seeks clipping",
                              "rows": 408,
                              "cost": 859.4635261,
                              "chosen": true
                            },
                            {
                              "type": "scan",
                              "chosen": false,
                              "cause": "cost"
                            }
                          ],
                          "chosen_access_method": {
                            "type": "ref",
                            "records": 408,
                            "cost": 859.4635261,
                            "uses_join_buffering": false
                          }
                        },
                        "rows_for_plan": 1115880,
                        "cost_for_plan": 231268.432,
                        "estimated_join_cardinality": 1115880
                      }
                    ]
                  }
                ]
              },
              {
                "plan_prefix": [],
                "table": "sd",
                "best_access_path": {
                  "considered_access_paths": [
                    {
                      "access_type": "scan",
                      "resulting_rows": 2383155,
                      "cost": 6891,
                      "chosen": true
                    }
                  ],
                  "chosen_access_method": {
                    "type": "scan",
                    "records": 2383155,
                    "cost": 6891,
                    "uses_join_buffering": false
                  }
                },
                "rows_for_plan": 2383155,
                "cost_for_plan": 483522,
                "pruned_by_cost": true
              }
            ]
          },
          {
            "best_join_order": ["svc", "sd", "d"]
          },
          {
            "attaching_conditions_to_tables": {
              "original_condition": "drivers.d.company_id = 51 and sd.idService = svc.idService and (svc.initDateTime between '2025-02-11 00:00:00.000000' and '2025-02-12 00:00:00.000000' or svc.endDateTime between '2025-02-11 00:00:00.000000' and '2025-02-12 00:00:00.000000') and drivers.d.`code` = svc.driverId and svc.deviceUID = sd.deviceUID",
              "attached_conditions_computation": [],
              "attached_conditions_summary": [
                {
                  "table": "svc",
                  "attached": "svc.initDateTime between '2025-02-11 00:00:00.000000' and '2025-02-12 00:00:00.000000' or svc.endDateTime between '2025-02-11 00:00:00.000000' and '2025-02-12 00:00:00.000000'"
                },
                {
                  "table": "sd",
                  "attached": "svc.deviceUID = sd.deviceUID"
                },
                {
                  "table": "d",
                  "attached": "drivers.d.`code` = svc.driverId"
                }
              ]
            }
          }
        ]
      }
    },
    {
      "join_execution": {
        "select_id": 1,
        "steps": []
      }
    }
  ]
}
MISSING_BYTES_BEYOND_MAX_MEM_SIZE: 0
          INSUFFICIENT_PRIVILEGES: 0