#2
⏱️ 570.9 мс
select count(*) as "aggregate" from "master_products" where "barcode" is not null and "category_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",127,true,127,"produce"]
#3
⏱️ 270.31 мс
select * from "master_products" where "barcode" is not null and "category_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",127,true,127,"produce"]
#5
⏱️ 14.84 мс
select "id", "canonical_product_id" from "master_products" where "canonical_product_id" in (?, ?, ?, ?, ?)
Bindings:
[80,79,266,82,185]
#6
⏱️ 23.49 мс
select * from "deals" where "master_product_id" in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) and "is_active" = ? and "store_id" in (?)
Bindings:
[2257916,2190661,2190128,2151263,2136438,2045870,1879673,1879254,1453435,1223337,959071,639411,598059,499851,497990,496502,496460,409780,392630,365009,364725,364409,364407,364405,364403,327734,327732,311485,241898,240947,156536,133053,97564,109889,109243,134681,150736,190899,100365,97295,364246,true,127]
#8
⏱️ 8.07 мс
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 = 2190128 THEN 2190128 WHEN sp.master_product_id = 97564 THEN 2190128 WHEN sp.master_product_id = 2190661 THEN 2190661 WHEN sp.master_product_id = 109889 THEN 2190661 WHEN sp.master_product_id = 109243 THEN 496502 WHEN sp.master_product_id = 496502 THEN 496502 WHEN sp.master_product_id = 134681 THEN 496502 WHEN sp.master_product_id = 150736 THEN 496502 WHEN sp.master_product_id = 190899 THEN 496502 WHEN sp.master_product_id = 364403 THEN 364403 WHEN sp.master_product_id = 100365 THEN 364403 WHEN sp.master_product_id = 97295 THEN 364403 WHEN sp.master_product_id = 364246 THEN 959071 WHEN sp.master_product_id = 959071 THEN 959071 ELSE sp.master_product_id END limit 500
Bindings:
[2257916,2190661,2190128,2151263,2136438,2045870,1879673,1879254,1453435,1223337,959071,639411,598059,499851,497990,496502,496460,409780,392630,365009,364725,364409,364407,364405,364403,327734,327732,311485,241898,240947,156536,133053,97564,109889,109243,134681,150736,190899,100365,97295,364246,0,127]
#9
⏱️ 14.7 мс
select * from "store_prices" where "id" in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Bindings:
[6209933,6207229,6205228,6208857,6209974,6209977,6211194,6211386,6203558,6211193,6211156,6215993,6205230,6209868,48147930,6205242,6203593,6205243,6209711,80228558]