explain.depesz.com

PostgreSQL's explain analyze made readable

Result: rc9t

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

HashAggregate (cost=2,619,184.44..2,627,220.19 rows=292,209 width=158) (actual rows= loops=)

  • Group Key: accs.id, accs.balance, accs.account_type, accs.account_reg_date, accs.currency_id, pu.country_id
  • Filter: (sum(COALESCE(stat.commission, '0'::numeric)) >= '0'::numeric)
2. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=2,537,102.26..2,611,148.69 rows=292,209 width=158) (actual rows= loops=)

  • Hash Cond: (accs.id = stat.server_account_number)
3. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=2,405,571.61..2,477,967.06 rows=292,209 width=30) (actual rows= loops=)

  • Hash Cond: (accs.user_id = pu.id)
4. 0.000 0.000 ↓ 0.0

Subquery Scan on accs (cost=1,788,596.62..1,794,440.80 rows=292,209 width=30) (actual rows= loops=)

5. 0.000 0.000 ↓ 0.0

HashAggregate (cost=1,788,596.62..1,791,518.71 rows=292,209 width=34) (actual rows= loops=)

  • Group Key: a_mt4.server_account_number, a_mt4.currency_id, a.user_id, a.created_dt, a_t.name, a.balance, a.platform_id
6. 0.000 0.000 ↓ 0.0

Hash Join (cost=306,647.99..1,783,482.96 rows=292,209 width=34) (actual rows= loops=)

  • Hash Cond: (a_mt4.type_id = a_t.id)
7. 0.000 0.000 ↓ 0.0

Nested Loop (cost=306,646.45..1,779,463.55 rows=292,209 width=31) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Hash Join (cost=306,645.89..1,474,790.02 rows=387,020 width=23) (actual rows= loops=)

  • Hash Cond: (a.platform_id = ap.id)
9. 0.000 0.000 ↓ 0.0

Nested Loop (cost=306,644.52..1,469,363.46 rows=414,664 width=23) (actual rows= loops=)

10. 0.000 0.000 ↓ 0.0

Hash Join (cost=306,643.96..322,275.65 rows=112,276 width=16) (actual rows= loops=)

  • Hash Cond: (ah.client_id = u.id)
11. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on partner_attachment_history ah (cost=4,460.71..18,886.63 rows=224,553 width=12) (actual rows= loops=)

  • Recheck Cond: (partner_id = 359,091)
12. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on partner_attachment_history_idx_partner_id (cost=0.00..4,404.57 rows=224,553 width=0) (actual rows= loops=)

  • Index Cond: (partner_id = 359,091)
13. 0.000 0.000 ↓ 0.0

Hash (cost=298,549.44..298,549.44 rows=290,705 width=4) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

HashAggregate (cost=292,735.34..295,642.39 rows=290,705 width=4) (actual rows= loops=)

  • Group Key: u.id
15. 0.000 0.000 ↓ 0.0

Append (cost=6,709.72..292,008.57 rows=290,705 width=4) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on "user" u (cost=6,709.72..268,436.89 rows=235,005 width=4) (actual rows= loops=)

  • Recheck Cond: (partner_id = 359,091)
17. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on user_partner_id (cost=0.00..6,650.97 rows=235,005 width=0) (actual rows= loops=)

  • Index Cond: (partner_id = 359,091)
18. 0.000 0.000 ↓ 0.0

HashAggregate (cost=20,107.63..20,664.63 rows=55,700 width=4) (actual rows= loops=)

  • Group Key: ph.client_id
19. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on partner_attachment_history ph (cost=4,418.61..19,967.29 rows=56,138 width=4) (actual rows= loops=)

  • Recheck Cond: (partner_id = 359,091)
  • Filter: (CASE WHEN (detached_at IS NOT NULL) THEN (detached_at >= '2020-02-01 00:00:00'::timestamp without time zone) ELSE true END AND CASE WHEN (attached_at IS NOT NULL) THEN (attached_at <= '2020-02-12 23:59:59'::timestamp without time zone) ELSE true END)
20. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on partner_attachment_history_idx_partner_id (cost=0.00..4,404.57 rows=224,553 width=0) (actual rows= loops=)

  • Index Cond: (partner_id = 359,091)
21. 0.000 0.000 ↓ 0.0

Index Scan using account_user_id_idx on account a (cost=0.56..10.18 rows=4 width=23) (actual rows= loops=)

  • Index Cond: (user_id = ah.client_id)
  • Filter: CASE WHEN (ah.detached_at IS NOT NULL) THEN (created_dt <= ah.detached_at) ELSE true END
22. 0.000 0.000 ↓ 0.0

Hash (cost=1.19..1.19 rows=14 width=4) (actual rows= loops=)

23. 0.000 0.000 ↓ 0.0

Seq Scan on account_platforms ap (cost=0.00..1.19 rows=14 width=4) (actual rows= loops=)

  • Filter: ((name)::text <> 'mt5_real_contest'::text)
24. 0.000 0.000 ↓ 0.0

Index Scan using account_mt4_pkey on account_mt4 a_mt4 (cost=0.56..0.78 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (account_id = a.id)
  • Filter: (server = 'dollar'::type.account_server)
25. 0.000 0.000 ↓ 0.0

Hash (cost=1.24..1.24 rows=24 width=11) (actual rows= loops=)

26. 0.000 0.000 ↓ 0.0

Seq Scan on account_types a_t (cost=0.00..1.24 rows=24 width=11) (actual rows= loops=)

27. 0.000 0.000 ↓ 0.0

Hash (cost=391,063.22..391,063.22 rows=13,769,822 width=8) (actual rows= loops=)

28. 0.000 0.000 ↓ 0.0

Seq Scan on "user" pu (cost=0.00..391,063.22 rows=13,769,822 width=8) (actual rows= loops=)

29. 0.000 0.000 ↓ 0.0

Hash (cost=131,530.17..131,530.17 rows=38 width=132) (actual rows= loops=)

30. 0.000 0.000 ↓ 0.0

Subquery Scan on stat (cost=131,528.94..131,530.17 rows=38 width=132) (actual rows= loops=)

31. 0.000 0.000 ↓ 0.0

HashAggregate (cost=131,528.94..131,529.79 rows=38 width=16) (actual rows= loops=)

  • Group Key: s.server_account_number
32. 0.000 0.000 ↓ 0.0

Index Scan using arrg_account_stats_date_idx on arrg_account_stats s (cost=0.56..131,415.64 rows=7,553 width=16) (actual rows= loops=)

  • Index Cond: ((date >= '2020-02-01'::date) AND (date <= '2020-02-12'::date))
  • Filter: (partner_id = 359,091)