#1
⏱️ 134.26 мс
select "id" from "stores" where "is_active" = ? and "city_slug" = ?
Bindings:
[true,"beer-sheva"]
#2
⏱️ 305.67 мс
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","herbs_mushrooms",736,754,776,132,172,246,1169,1170,1206,1249,1271,1274,1279,1299,1307,369,44,93,113,120,160,151,164,165,181,271,441,465,473,490,1370,1400,350,true,736,754,776,132,172,246,1169,1170,1206,1249,1271,1274,1279,1299,1307,369,44,93,113,120,160,151,164,165,181,271,441,465,473,490,1370,1400,350,"produce"]
#3
⏱️ 177.7 мс
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","herbs_mushrooms",736,754,776,132,172,246,1169,1170,1206,1249,1271,1274,1279,1299,1307,369,44,93,113,120,160,151,164,165,181,271,441,465,473,490,1370,1400,350,true,736,754,776,132,172,246,1169,1170,1206,1249,1271,1274,1279,1299,1307,369,44,93,113,120,160,151,164,165,181,271,441,465,473,490,1370,1400,350,"produce"]
#4
⏱️ 8.33 мс
select * from "canonical_products" where "canonical_products"."id" in (40, 42, 215, 249)
#5
⏱️ 4.1 мс
select "id", "canonical_product_id" from "master_products" where "canonical_product_id" in (?, ?, ?, ?)
Bindings:
[249,215,40,42]
#6
⏱️ 51.75 мс
select * from "deals" where "master_product_id" in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) and "is_active" = ? and "store_id" in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Bindings:
[8775651,8775580,8775533,8775532,8775519,8775509,3887679,3875648,3123983,2984312,2931321,2843593,2812350,2710285,2671026,2670964,2666758,2666027,2664001,2647878,2641760,2636398,2633097,2631399,2606604,2604820,2566125,2564247,2562038,2562023,2561601,2561561,2561387,2561626,2561482,112366,162809,true,736,754,776,132,172,246,1169,1170,1206,1249,1271,1274,1279,1299,1307,369,44,93,113,120,160,151,164,165,181,271,441,465,473,490,1370,1400,350]
#7
⏱️ 2.69 мс
select * from "stores" where "stores"."id" in (736)
#8
⏱️ 13.67 мс
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 = 2561387 THEN 2564247 WHEN sp.master_product_id = 2564247 THEN 2564247 WHEN sp.master_product_id = 2561626 THEN 2562038 WHEN sp.master_product_id = 2562038 THEN 2562038 WHEN sp.master_product_id = 2561482 THEN 2562038 WHEN sp.master_product_id = 112366 THEN 2604820 WHEN sp.master_product_id = 2604820 THEN 2604820 WHEN sp.master_product_id = 2984312 THEN 2984312 WHEN sp.master_product_id = 162809 THEN 2984312 ELSE sp.master_product_id END limit 500
Bindings:
[8775651,8775580,8775533,8775532,8775519,8775509,3887679,3875648,3123983,2984312,2931321,2843593,2812350,2710285,2671026,2670964,2666758,2666027,2664001,2647878,2641760,2636398,2633097,2631399,2606604,2604820,2566125,2564247,2562038,2562023,2561601,2561561,2561387,2561626,2561482,112366,162809,0,736,754,776,132,172,246,1169,1170,1206,1249,1271,1274,1279,1299,1307,369,44,93,113,120,160,151,164,165,181,271,441,465,473,490,1370,1400,350]
#9
⏱️ 6.87 мс
select * from "store_prices" where "id" in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Bindings:
[4908495,4908532,4911227,4908419,4908331,4911460,2180127,2173395,2177201,2179673,2177443,2178905,2446351,2437264,2448685,2491880,2490595,2548270,3946747,1788729,1780271,1782283,1982537,1970754,1976641,1976668,1978616,1780286,1781189,1782939,1979600]
#10
⏱️ 2.38 мс
select * from "stores" where "stores"."id" in (172, 441, 465, 473, 490, 736, 754)
#11
⏱️ 2.56 мс
select * from "locations" where "city_slug" = ? limit 1
Bindings:
["beer-sheva"]
#12
⏱️ 0.93 мс
select * from "locations" where "is_popular" = ? order by "sort_order" asc
Bindings:
[true]
#13
⏱️ 3.02 мс
select * from "locations" where "is_active" = ? order by "is_popular" desc, "sort_order" asc
Bindings:
[true]