#2
⏱️ 491.38 мс
select count(*) as "aggregate" from "master_products" where "barcode" is not null and "category_slug" = ? and "subcategory_slug" = ? and (exists (select 1 from "store_prices" where "store_prices"."master_product_id" = "master_products"."id" and "store_prices"."store_id" in (?, ?, ?, ?)) or exists (select 1 from "deals" where "deals"."master_product_id" = "master_products"."id" and "deals"."is_active" = ? and "deals"."store_id" in (?, ?, ?, ?))) and master_products.id IN (
SELECT DISTINCT ON (COALESCE(canonical_product_id, -id)) id
FROM master_products
WHERE category_slug = ?
ORDER BY COALESCE(canonical_product_id, -id),
CASE WHEN image_url IS NOT NULL AND image_url != '' THEN 0 ELSE 1 END,
id DESC
)
Bindings:
["produce","vegetables",738,469,155,342,true,738,469,155,342,"produce"]
#3
⏱️ 296.09 мс
select * from "master_products" where "barcode" is not null and "category_slug" = ? and "subcategory_slug" = ? and (exists (select 1 from "store_prices" where "store_prices"."master_product_id" = "master_products"."id" and "store_prices"."store_id" in (?, ?, ?, ?)) or exists (select 1 from "deals" where "deals"."master_product_id" = "master_products"."id" and "deals"."is_active" = ? and "deals"."store_id" in (?, ?, ?, ?))) and master_products.id IN (
SELECT DISTINCT ON (COALESCE(canonical_product_id, -id)) id
FROM master_products
WHERE category_slug = ?
ORDER BY COALESCE(canonical_product_id, -id),
CASE WHEN image_url IS NOT NULL AND image_url != '' THEN 0 ELSE 1 END,
id DESC
) order by CASE WHEN master_products.image_url IS NOT NULL AND master_products.image_url != '' THEN 0 ELSE 1 END, "master_products"."id" desc limit 32 offset 0
Bindings:
["produce","vegetables",738,469,155,342,true,738,469,155,342,"produce"]
#6
⏱️ 69.59 мс
select * from "deals" where "master_product_id" in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) and "is_active" = ? and "store_id" in (?, ?, ?, ?)
Bindings:
[8775782,8775713,8775546,8775528,5130389,4987518,2986223,2984315,2975667,2842852,2835680,2702341,2685471,2678023,2671354,2664339,2661254,2660155,2658613,2642320,2634528,2631143,2630188,2615066,2609674,2609137,2608279,2606582,1907417,1879265,1879254,1457225,7471561,2608090,112925,110719,2657391,2657025,2676233,8775708,8775709,8775712,8775707,8775710,8775711,2609947,115658,111499,114703,115686,8775781,1463382,199293,150781,95650,97351,107092,1915898,1455029,1986966,1907936,190894,2637094,133463,109313,98238,113731,109373,109847,true,738,469,155,342]
#8
⏱️ 20.84 мс
select min(sp.id) as best_sp_id from "store_prices" as "sp" where "sp"."master_product_id" in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) and "sp"."price" > ? and "sp"."store_id" in (?, ?, ?, ?) group by sp.store_id, CASE WHEN sp.master_product_id = 8775528 THEN 8775528 WHEN sp.master_product_id = 7471561 THEN 8775528 WHEN sp.master_product_id = 2608090 THEN 2609674 WHEN sp.master_product_id = 2609674 THEN 2609674 WHEN sp.master_product_id = 112925 THEN 2609674 WHEN sp.master_product_id = 110719 THEN 2609674 WHEN sp.master_product_id = 2657391 THEN 2702341 WHEN sp.master_product_id = 2657025 THEN 2702341 WHEN sp.master_product_id = 2676233 THEN 2702341 WHEN sp.master_product_id = 2702341 THEN 2702341 WHEN sp.master_product_id = 8775708 THEN 8775713 WHEN sp.master_product_id = 8775709 THEN 8775713 WHEN sp.master_product_id = 8775712 THEN 8775713 WHEN sp.master_product_id = 8775707 THEN 8775713 WHEN sp.master_product_id = 8775710 THEN 8775713 WHEN sp.master_product_id = 8775711 THEN 8775713 WHEN sp.master_product_id = 2609947 THEN 8775713 WHEN sp.master_product_id = 115658 THEN 8775713 WHEN sp.master_product_id = 8775713 THEN 8775713 WHEN sp.master_product_id = 111499 THEN 8775713 WHEN sp.master_product_id = 114703 THEN 8775713 WHEN sp.master_product_id = 115686 THEN 8775713 WHEN sp.master_product_id = 8775781 THEN 8775782 WHEN sp.master_product_id = 8775782 THEN 8775782 WHEN sp.master_product_id = 1879265 THEN 1879265 WHEN sp.master_product_id = 1463382 THEN 1879265 WHEN sp.master_product_id = 199293 THEN 1879265 WHEN sp.master_product_id = 150781 THEN 1879265 WHEN sp.master_product_id = 95650 THEN 2986223 WHEN sp.master_product_id = 97351 THEN 2986223 WHEN sp.master_product_id = 2986223 THEN 2986223 WHEN sp.master_product_id = 107092 THEN 2986223 WHEN sp.master_product_id = 1915898 THEN 2986223 WHEN sp.master_product_id = 1455029 THEN 2986223 WHEN sp.master_product_id = 1986966 THEN 2986223 WHEN sp.master_product_id = 1907936 THEN 2986223 WHEN sp.master_product_id = 190894 THEN 2986223 WHEN sp.master_product_id = 2637094 THEN 2986223 WHEN sp.master_product_id = 133463 THEN 2986223 WHEN sp.master_product_id = 109313 THEN 2986223 WHEN sp.master_product_id = 98238 THEN 2986223 WHEN sp.master_product_id = 2615066 THEN 2615066 WHEN sp.master_product_id = 113731 THEN 2615066 WHEN sp.master_product_id = 2630188 THEN 2630188 WHEN sp.master_product_id = 109373 THEN 2630188 WHEN sp.master_product_id = 2658613 THEN 2658613 WHEN sp.master_product_id = 109847 THEN 2658613 ELSE sp.master_product_id END limit 500
Bindings:
[8775782,8775713,8775546,8775528,5130389,4987518,2986223,2984315,2975667,2842852,2835680,2702341,2685471,2678023,2671354,2664339,2661254,2660155,2658613,2642320,2634528,2631143,2630188,2615066,2609674,2609137,2608279,2606582,1907417,1879265,1879254,1457225,7471561,2608090,112925,110719,2657391,2657025,2676233,8775708,8775709,8775712,8775707,8775710,8775711,2609947,115658,111499,114703,115686,8775781,1463382,199293,150781,95650,97351,107092,1915898,1455029,1986966,1907936,190894,2637094,133463,109313,98238,113731,109373,109847,0,738,469,155,342]
#9
⏱️ 22.32 мс
select * from "store_prices" where "id" in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Bindings:
[5421471,5421482,5421487,1842735,1832603,1832845,1842039,1832538,1834525,1838448,1836848,1841010,1836215,1833004,1838992,1832177,1844959,1832548,1833276,1843053,1842661,4025826,4025310,4025353,4066590,4116470,3881002,3891064,3879669,4024837,4066676]