SELECT 
  cscart_bm_snapping.grid_id as grid_id, 
  cscart_bm_snapping.block_id as block_id, 
  IFNULL(
    dynamic_object_content.content, 
    default_content.content
  ) as content, 
  IFNULL(
    dynamic_object_content.object_id, 
    default_content.object_id
  ) AS object_id, 
  IFNULL(
    dynamic_object_content.object_type, 
    default_content.object_type
  ) AS object_type, 
  cscart_bm_block_statuses.object_ids as object_ids, 
  cscart_bm_snapping.*, 
  cscart_bm_blocks.*, 
  cscart_bm_blocks_descriptions.* 
FROM 
  cscart_bm_snapping 
  LEFT JOIN cscart_bm_blocks ON cscart_bm_blocks.block_id = cscart_bm_snapping.block_id 
  LEFT JOIN cscart_bm_block_statuses ON cscart_bm_snapping.snapping_id = cscart_bm_block_statuses.snapping_id 
  AND cscart_bm_block_statuses.object_type LIKE '' 
  LEFT JOIN cscart_bm_blocks_descriptions ON cscart_bm_blocks.block_id = cscart_bm_blocks_descriptions.block_id 
  LEFT JOIN cscart_bm_blocks_content AS default_content ON cscart_bm_blocks.block_id = default_content.block_id 
  AND cscart_bm_blocks_descriptions.lang_code = default_content.lang_code 
  AND default_content.snapping_id = 0 
  AND default_content.object_id = 0 
  AND default_content.object_type like '' 
  LEFT JOIN cscart_bm_blocks_content AS dynamic_object_content ON cscart_bm_blocks.block_id = dynamic_object_content.block_id 
  AND cscart_bm_blocks_descriptions.lang_code = dynamic_object_content.lang_code 
  AND dynamic_object_content.object_id = 0 
  AND dynamic_object_content.object_type like '' 
WHERE 
  cscart_bm_snapping.grid_id IN (567, 568) 
  AND cscart_bm_blocks_descriptions.lang_code = 'en' 
ORDER BY 
  cscart_bm_snapping.order, 
  cscart_bm_snapping.block_id

Query time 0.00079

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "177.48"
    },
    "ordering_operation": {
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "157.03"
      },
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_bm_snapping",
            "access_type": "range",
            "possible_keys": [
              "grid_id"
            ],
            "key": "grid_id",
            "used_key_parts": [
              "grid_id"
            ],
            "key_length": "4",
            "rows_examined_per_scan": 2,
            "rows_produced_per_join": 2,
            "filtered": "100.00",
            "index_condition": "(`nuie_scalesta_net`.`cscart_bm_snapping`.`grid_id` in (567,568))",
            "cost_info": {
              "read_cost": "1.21",
              "eval_cost": "0.20",
              "prefix_cost": "1.41",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "snapping_id",
              "block_id",
              "grid_id",
              "wrapper",
              "user_class",
              "order",
              "status"
            ]
          }
        },
        {
          "table": {
            "table_name": "cscart_bm_block_statuses",
            "access_type": "ref",
            "possible_keys": [
              "snapping_id"
            ],
            "key": "snapping_id",
            "used_key_parts": [
              "snapping_id"
            ],
            "key_length": "4",
            "ref": [
              "nuie_scalesta_net.cscart_bm_snapping.snapping_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 2,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.50",
              "eval_cost": "0.20",
              "prefix_cost": "2.11",
              "data_read_per_join": "240"
            },
            "used_columns": [
              "snapping_id",
              "object_ids",
              "object_type"
            ],
            "attached_condition": "<if>(is_not_null_compl(cscart_bm_block_statuses), ((`nuie_scalesta_net`.`cscart_bm_snapping`.`snapping_id` = `nuie_scalesta_net`.`cscart_bm_block_statuses`.`snapping_id`) and (`nuie_scalesta_net`.`cscart_bm_block_statuses`.`object_type` like '')), true)"
          }
        },
        {
          "table": {
            "table_name": "cscart_bm_blocks",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "block_id"
            ],
            "key_length": "4",
            "ref": [
              "nuie_scalesta_net.cscart_bm_snapping.block_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 2,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.50",
              "eval_cost": "0.20",
              "prefix_cost": "2.81",
              "data_read_per_join": "448"
            },
            "used_columns": [
              "block_id",
              "type",
              "properties",
              "company_id",
              "storefront_id"
            ]
          }
        },
        {
          "table": {
            "table_name": "cscart_bm_blocks_descriptions",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "block_id",
              "lang_code"
            ],
            "key_length": "10",
            "ref": [
              "nuie_scalesta_net.cscart_bm_snapping.block_id",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 2,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.50",
              "eval_cost": "0.20",
              "prefix_cost": "3.51",
              "data_read_per_join": "416"
            },
            "used_columns": [
              "block_id",
              "lang_code",
              "name"
            ]
          }
        },
        {
          "table": {
            "table_name": "default_content",
            "access_type": "ref",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "block_id",
              "snapping_id",
              "lang_code",
              "object_id"
            ],
            "key_length": "18",
            "ref": [
              "nuie_scalesta_net.cscart_bm_snapping.block_id",
              "const",
              "nuie_scalesta_net.cscart_bm_blocks_descriptions.lang_code",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 2,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.50",
              "eval_cost": "0.20",
              "prefix_cost": "4.21",
              "data_read_per_join": "448"
            },
            "used_columns": [
              "snapping_id",
              "object_id",
              "object_type",
              "block_id",
              "lang_code",
              "content"
            ],
            "attached_condition": "<if>(is_not_null_compl(default_content), (`nuie_scalesta_net`.`default_content`.`object_type` like ''), true)"
          }
        },
        {
          "table": {
            "table_name": "dynamic_object_content",
            "access_type": "ref",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "block_id"
            ],
            "key_length": "4",
            "ref": [
              "nuie_scalesta_net.cscart_bm_snapping.block_id"
            ],
            "rows_examined_per_scan": 78,
            "rows_produced_per_join": 157,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.54",
              "eval_cost": "15.70",
              "prefix_cost": "20.45",
              "data_read_per_join": "34K"
            },
            "used_columns": [
              "snapping_id",
              "object_id",
              "object_type",
              "block_id",
              "lang_code",
              "content"
            ],
            "attached_condition": "<if>(is_not_null_compl(dynamic_object_content), ((`nuie_scalesta_net`.`dynamic_object_content`.`object_id` = 0) and (`nuie_scalesta_net`.`dynamic_object_content`.`lang_code` = `nuie_scalesta_net`.`cscart_bm_blocks_descriptions`.`lang_code`) and (`nuie_scalesta_net`.`dynamic_object_content`.`object_type` like '')), true)"
          }
        }
      ]
    }
  }
}

Result

grid_id block_id content object_id object_type object_ids snapping_id wrapper user_class order status type properties company_id storefront_id lang_code name
568 92 0 577 blocks/wrappers/mainbox_general.tpl 0 A main 0 1 en Main Content
567 95 a:1:{s:7:"content";s:2132:"<a href="index.php" title="Generation Z"> <svg class="tor-logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 845.13 115"> <g class="tor-logo__color-primary"> <path d="M28,51.08H52.68V86.73c0,18-9,28.27-26.34,28.27S0,104.72,0,86.73V28.27C0,10.28,9,0,26.34,0S52.68,10.28,52.68,28.27V39.19H36v-12c0-8-3.54-11.08-9.16-11.08s-9.15,3.05-9.15,11.08V87.86c0,8,3.53,10.92,9.15,10.92S36,95.89,36,87.86V67.14H28Z"></path> <path d="M171.05,32.28v81.43h-15.9V1.29h22.16l18.15,67.29V1.29H211.2V113.71H193.05Z"></path> <path d="M352.06,113.71c-1-2.89-1.61-4.65-1.61-13.81V82.23c0-10.44-3.53-14.29-11.56-14.29h-6.11v45.77H315.12V1.29h26.66C360.09,1.29,368,9.8,368,27.14V36c0,11.56-3.7,19.11-11.57,22.81,8.84,3.69,11.73,12.2,11.73,23.93v17.34c0,5.46.16,9.48,1.93,13.65ZM332.78,17.35V51.88h6.91c6.59,0,10.6-2.89,10.6-11.89V28.91c0-8-2.73-11.56-9-11.56Z"></path> <path d="M452.92,113.71H435.09l-3-20.39H410.36l-3.05,20.39H391.08l18-112.42h25.86ZM412.61,78.06h17L421.12,21.2Z"></path> <path d="M465.93,1.29h54.61V17.35H502.07v96.36H484.4V17.35H465.93Z"></path> <path d="M544.31,1.29H562V113.71H544.31Z"></path> <path d="M589.44,28.27c0-18,9.47-28.27,26.82-28.27s26.82,10.28,26.82,28.27V86.73c0,18-9.47,28.27-26.82,28.27s-26.82-10.28-26.82-28.27ZM607.1,87.86c0,8,3.54,11.08,9.16,11.08s9.16-3,9.16-11.08V27.14c0-8-3.54-11.08-9.16-11.08s-9.16,3.05-9.16,11.08Z"></path> <path d="M686.29,32.28v81.43H670.38V1.29h22.17L710.7,68.58V1.29h15.74V113.71H708.29Z"></path> <path d="M845.13,1.29V17L811.56,97.65h33.57v16.06H793.41V98L827,17.35H795V1.29Z"></path> <rect x="80.14" y="97.66" width="48.18" height="16.06"></rect> <rect x="80.14" y="48.66" width="48.18" height="16.06"></rect> <rect x="80.14" y="1.29" width="48.18" height="16.06"></rect> <rect x="239.95" y="97.66" width="48.18" height="16.06"></rect> <rect x="239.95" y="48.66" width="48.18" height="16.06"></rect> <rect x="239.95" y="1.29" width="48.18" height="16.06"></rect> </g> </svg> </a> ";} 0 576 0 D html_block a:1:{s:8:"template";s:21:"blocks/html_block.tpl";} 0 1 en Theme logo [Inversion]