explain.depesz.com

PostgreSQL's explain analyze made readable

Result: en1R

Settings
# exclusive inclusive rows x rows loops node
1. 0.023 359.778 ↑ 1.0 1 1

GroupAggregate (cost=0.56..247,170.46 rows=1 width=170) (actual time=359.778..359.778 rows=1 loops=1)

  • Group Key: w.customer_id, w.restaurant_id
2. 281.716 281.716 ↑ 1.0 1 1

Index Scan using pk_week_created_at_customer_id_restaurant_id on order_customer_restaurant_week w (cost=0.56..192,808.30 rows=1 width=82) (actual time=269.586..281.716 rows=1 loops=1)

  • Index Cond: ((order_created_at > (now() - '7 days'::interval)) AND ((customer_id)::text = 'bf12d8f0-7416-455e-8688-fbd1c9ebca96'::text) AND ((restaurant_id)::text = '49365870-45f3-4a7e-ad65-1633dc50deb0'::text))
3.          

SubPlan (for GroupAggregate)

4. 0.013 6.297 ↑ 1.0 1 1

Aggregate (cost=736.21..736.31 rows=1 width=32) (actual time=6.297..6.297 rows=1 loops=1)

5. 6.284 6.284 ↓ 6.0 6 1

Index Scan using pk_hour_created_at_customer_id_restaurant_id on order_customer_restaurant_hour h (cost=0.56..736.21 rows=1 width=8) (actual time=4.060..6.284 rows=6 loops=1)

  • Index Cond: ((order_created_at > (now() - '01:00:00'::interval)) AND ((customer_id)::text = (w.customer_id)::text) AND ((restaurant_id)::text = (w.restaurant_id)::text))
6. 0.014 71.742 ↑ 1.0 1 1

Aggregate (cost=53,625.64..53,625.74 rows=1 width=32) (actual time=71.741..71.742 rows=1 loops=1)

7. 71.728 71.728 ↑ 1.0 1 1

Index Scan using pk_day_created_at_customer_id_restaurant_id on order_customer_restaurant_day d (cost=0.56..53,625.63 rows=1 width=8) (actual time=70.710..71.728 rows=1 loops=1)

  • Index Cond: ((order_created_at > (now() - '1 day'::interval)) AND ((customer_id)::text = (w.customer_id)::text) AND ((restaurant_id)::text = (w.restaurant_id)::text))
Planning time : 0.248 ms
Execution time : 359.836 ms