explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Fjc4

Settings
# exclusive inclusive rows x rows loops node
1. 0.028 2,018.232 ↑ 2.0 1 1

GroupAggregate (cost=726,648.92..726,649.07 rows=2 width=116) (actual time=2,018.232..2,018.232 rows=1 loops=1)

  • Group Key: c.en, amt.server_account_number, st_p.partner_id, (sum((sum(arrg_client_stats.partner_commission))))
2. 0.020 2,018.204 ↓ 1.5 3 1

Sort (cost=726,648.92..726,648.93 rows=2 width=116) (actual time=2,018.203..2,018.204 rows=3 loops=1)

  • Sort Key: c.en, amt.server_account_number, st_p.partner_id, (sum((sum(arrg_client_stats.partner_commission))))
  • Sort Method: quicksort Memory: 25kB
3. 0.003 2,018.184 ↓ 1.5 3 1

Nested Loop (cost=726,606.77..726,648.91 rows=2 width=116) (actual time=2,018.118..2,018.184 rows=3 loops=1)

4. 0.003 2,018.128 ↑ 1.0 1 1

Nested Loop Left Join (cost=726,606.34..726,636.89 rows=1 width=94) (actual time=2,018.092..2,018.128 rows=1 loops=1)

  • Join Filter: (pl.user_id = u.id)
5. 0.011 2,018.114 ↑ 1.0 1 1

Nested Loop Left Join (cost=726,605.92..726,628.44 rows=1 width=90) (actual time=2,018.078..2,018.114 rows=1 loops=1)

  • Join Filter: (arrg_client_stats.partner_id = p.user_id)
6. 0.001 0.177 ↑ 1.0 1 1

Nested Loop (cost=9.46..31.92 rows=1 width=50) (actual time=0.142..0.177 rows=1 loops=1)

7. 0.003 0.155 ↑ 1.0 1 1

Nested Loop (cost=8.89..23.32 rows=1 width=50) (actual time=0.127..0.155 rows=1 loops=1)

8. 0.064 0.124 ↑ 1.0 1 1

Hash Join (cost=8.46..14.87 rows=1 width=34) (actual time=0.097..0.124 rows=1 loops=1)

  • Hash Cond: ((c.code_a3)::text = u.country)
9. 0.032 0.032 ↑ 1.0 247 1

Seq Scan on countries c (cost=0.00..5.47 rows=247 width=14) (actual time=0.008..0.032 rows=247 loops=1)

10. 0.004 0.028 ↑ 1.0 1 1

Hash (cost=8.45..8.45 rows=1 width=28) (actual time=0.028..0.028 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
11. 0.024 0.024 ↑ 1.0 1 1

Index Scan using users_pkey on users u (cost=0.43..8.45 rows=1 width=28) (actual time=0.020..0.024 rows=1 loops=1)

  • Index Cond: (id = 9348998)
12. 0.028 0.028 ↑ 1.0 1 1

Index Scan using partner_user_id_idx on partner p (cost=0.42..8.44 rows=1 width=16) (actual time=0.028..0.028 rows=1 loops=1)

  • Index Cond: (user_id = 9348998)
13. 0.021 0.021 ↑ 1.0 1 1

Index Scan using account_mt4_pkey on account_mt4 amt (cost=0.57..8.59 rows=1 width=8) (actual time=0.014..0.021 rows=1 loops=1)

  • Index Cond: (account_id = p.account_id)
14. 0.005 2,017.926 ↑ 1.0 1 1

GroupAggregate (cost=726,596.46..726,596.50 rows=1 width=40) (actual time=2,017.926..2,017.926 rows=1 loops=1)

  • Group Key: arrg_client_stats.partner_id
15. 0.020 2,017.921 ↑ 1.0 1 1

HashAggregate (cost=726,596.46..726,596.47 rows=1 width=12) (actual time=2,017.921..2,017.921 rows=1 loops=1)

  • Group Key: arrg_client_stats.client_id, arrg_client_stats.partner_id
16. 2,017.901 2,017.901 ↑ 4.0 2 1

Seq Scan on arrg_client_stats (cost=0.00..726,596.40 rows=8 width=12) (actual time=1,941.639..2,017.901 rows=2 loops=1)

  • Filter: ((date >= '2019-03-10'::date) AND (date <= '2019-03-15'::date) AND (partner_commission > '0'::numeric) AND (partner_id = 9348998))
  • Rows Removed by Filter: 21966694
17. 0.011 0.011 ↓ 0.0 0 1

Index Scan using loyalty_pkey on loyalty pl (cost=0.42..8.44 rows=1 width=12) (actual time=0.011..0.011 rows=0 loops=1)

  • Index Cond: (user_id = 9348998)
18. 0.053 0.053 ↓ 1.5 3 1

Index Scan using arrg_partner_stats_pk on arrg_partner_stats st_p (cost=0.43..12.00 rows=2 width=26) (actual time=0.024..0.053 rows=3 loops=1)

  • Index Cond: ((partner_id = 9348998) AND (date >= '2019-03-10'::date) AND (date <= '2019-03-15'::date))