Skip to content

Instantly share code, notes, and snippets.

@Neokortex
Created November 20, 2017 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Neokortex/218463a50f57529d6e0caf9b82fc4aa9 to your computer and use it in GitHub Desktop.
Save Neokortex/218463a50f57529d6e0caf9b82fc4aa9 to your computer and use it in GitHub Desktop.
Doctrine slow select query with many left join and data
SELECT
f0_.id AS id_0,
f0_.external_id AS external_id_1,
f0_.begin AS begin_2,
f0_.hash AS hash_3,
f0_.visible AS visible_4,
f0_.position AS position_5,
f0_.type AS type_6,
f0_.rooms AS rooms_7,
f0_.price AS price_8,
f0_.area__full AS area__full_9,
f0_.area__kitchen AS area__kitchen_10,
f0_.area__living AS area__living_11,
f0_.floor AS floor_12,
f0_.house__floor AS house__floor_13,
f0_.house__type AS house__type_14,
f0_.house__new AS house__new_15,
f0_.house__year AS house__year_16,
f0_.house__fenced AS house__fenced_17,
f0_.house__parking AS house__parking_18,
f0_.repair AS repair_19,
f0_.restroom AS restroom_20,
f0_.elevator AS elevator_21,
f0_.balcony AS balcony_22,
f0_.height AS height_23,
f0_.windows AS windows_24,
f0_.heating AS heating_25,
f0_.gas AS gas_26,
f0_.apartments AS apartments_27,
f0_.rent__time AS rent__time_28,
f0_.rent__child AS rent__child_29,
f0_.rent__pet AS rent__pet_30,
f0_.furniture AS furniture_31,
f0_.furniture__kitchen AS furniture__kitchen_32,
f0_.fridge AS fridge_33,
f0_.washer AS washer_34,
f0_.internet AS internet_35,
f0_.tv AS tv_36,
f0_.conditioner AS conditioner_37,
f0_.dishwasher AS dishwasher_38,
f0_.phone AS phone_39,
f0_.bathroom AS bathroom_40,
f0_.description AS description_41,
f0_.description_adv AS description_adv_42,
f0_.prepay AS prepay_43,
f0_.commission AS commission_44,
f0_.garbage AS garbage_45,
f0_.tenant AS tenant_46,
f0_.rent__bills_included AS rent__bills_included_47,
f0_.last_update AS last_update_48,
f0_.vas AS vas_49,
f0_.deal_status AS deal_status_50,
f0_.mortgage AS mortgage_51,
f0_.rooms_type AS rooms_type_52,
f0_.open_plan AS open_plan_53,
f0_.quality AS quality_54,
f0_.views AS views_55,
f0_.export_to_avito AS export_to_avito_56,
f0_.export_to_yandex AS export_to_yandex_57,
f0_.deleted_at AS deleted_at_58,
f0_.youtube_video_link AS youtube_video_link_59,
f0_.latitude AS latitude_60,
f0_.longitude AS longitude_61,
f0_.closed AS closed_62,
a1_.id AS id_63,
a1_.data AS data_64,
a1_.code AS code_65,
a1_.text AS text_66,
a1_.latitude AS latitude_67,
a1_.longitude AS longitude_68,
a1_.flat AS flat_69,
a1_.city AS city_70,
a1_.city_district AS city_district_71,
a1_.street_with_type AS street_with_type_72,
a1_.house AS house_73,
a1_.city_fias_id AS city_fias_id_74,
f2_.id AS id_75,
f2_.name AS name_76,
f2_.original_name AS original_name_77,
f2_.size AS size_78,
f2_.description AS description_79,
f2_.type AS type_80,
f2_.time AS time_81,
f2_.position AS position_82,
r3_.id AS id_83,
r3_.name AS name_84,
r3_.deals AS deals_85,
r3_.sales AS sales_86,
r3_.description AS description_87,
r3_.work_from AS work_from_88,
o4_.id AS id_89,
o4_.name AS name_90,
o4_.code AS code_91,
o4_.color AS color_92,
o4_.description AS description_93,
o5_.id AS id_94,
o5_.name AS name_95,
f0_.create_by_user_id AS create_by_user_id_96,
f0_.realtor_id AS realtor_id_97,
f0_.update_by_user_id AS update_by_user_id_98,
f0_.building_id AS building_id_99,
f0_.district_id AS district_id_100,
f0_.address_id AS address_id_101,
f0_.tariff_id AS tariff_id_102,
r3_.user_id AS user_id_103,
r3_.file_id AS file_id_104,
r3_.photo_detail_id AS photo_detail_id_105,
r3_.post_id AS post_id_106
FROM
Flat f0_
LEFT JOIN Address a1_ ON f0_.address_id = a1_.id
LEFT JOIN FlatFiles f6_ ON f0_.id = f6_.flat_id
LEFT JOIN File f2_ ON f2_.id = f6_.file_id
LEFT JOIN Realtor r3_ ON f0_.realtor_id = r3_.id
LEFT JOIN FlatLabel f7_ ON f0_.id = f7_.flat_id
LEFT JOIN ObjectLabel o4_ ON o4_.id = f7_.label_id
LEFT JOIN FlatTag f8_ ON f0_.id = f8_.flat_id
LEFT JOIN ObjectTag o5_ ON o5_.id = f8_.tag_id
WHERE
f0_.id >= ?
AND f0_.deleted_at IS NULL
AND f0_.visible = ?
AND f0_.type = ?
AND f0_.price >= ?
AND f0_.price <= ?
ORDER BY
f0_.position DESC,
f0_.id DESC,
f2_.position ASC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment