explain.depesz.com

PostgreSQL's explain analyze made readable

Result: yEHH

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=9.98..10.14 rows=1 width=109) (actual rows= loops=)

  • Group Key: u.id, (date_part('epoch'::text, date_trunc('day'::text, timezone('UTC'::text, to_timestamp(("order".created_at)::double precision)))))
2. 0.000 0.000 ↓ 0.0

Sort (cost=9.98..9.98 rows=1 width=65) (actual rows= loops=)

  • Sort Key: u.id, (date_part('epoch'::text, date_trunc('day'::text, timezone('UTC'::text, to_timestamp(("order".created_at)::double precision)))))
3. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=9.09..9.97 rows=1 width=65) (actual rows= loops=)

  • Filter: ((((auth_assignment.item_name)::text = ANY ('{operator,senior_operator}'::text[])) AND (u.status = ANY ('{0,4}'::integer[]))) OR (u.id IS NULL))
4. 0.000 0.000 ↓ 0.0

Merge Join (cost=8.95..9.46 rows=1 width=65) (actual rows= loops=)

  • Merge Cond: (order_log.user_id = user_country.user_id)
  • Join Filter: (order_log.order_id = "order".id)
5. 0.000 0.000 ↓ 0.0

Merge Join (cost=3.57..45.02 rows=690,054 width=57) (actual rows= loops=)

  • Merge Cond: (order_log.user_id = u.id)
6. 0.000 0.000 ↓ 0.0

Index Scan using idx_order_log_user_id on order_log (cost=0.43..213,143.70 rows=690,054 width=40) (actual rows= loops=)

  • Filter: ((field)::text = 'status'::text)
7. 0.000 0.000 ↓ 0.0

Sort (cost=3.04..3.11 rows=30 width=17) (actual rows= loops=)

  • Sort Key: u.id
8. 0.000 0.000 ↓ 0.0

Seq Scan on "user" u (cost=0.00..2.30 rows=30 width=17) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

Sort (cost=5.38..5.39 rows=4 width=20) (actual rows= loops=)

  • Sort Key: user_country.user_id
10. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..5.34 rows=4 width=20) (actual rows= loops=)

11. 0.000 0.000 ↓ 0.0

Index Scan using idx_order_created_at on "order" (cost=0.42..3.45 rows=1 width=16) (actual rows= loops=)

  • Index Cond: ((created_at >= 1,585,094,400) AND (created_at <= 1,585,180,799))
  • Filter: ((country_id = 3) AND (partner_id = ANY ('{2,1,4,5}'::integer[])))
12. 0.000 0.000 ↓ 0.0

Seq Scan on user_country (cost=0.00..1.85 rows=4 width=4) (actual rows= loops=)

  • Filter: (country_id = 3)
13. 0.000 0.000 ↓ 0.0

Index Only Scan using auth_assignment_pkey on auth_assignment (cost=0.14..0.48 rows=1 width=150) (actual rows= loops=)

  • Index Cond: (user_id = u.id)