explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ywBz

Settings
# exclusive inclusive rows x rows loops node
1. 0.085 9.124 ↑ 6.4 37 1

Sort (cost=2,119.46..2,120.05 rows=236 width=75) (actual time=9.121..9.124 rows=37 loops=1)

  • Sort Key: (max((c.en)::text)) DESC
  • Sort Method: quicksort Memory: 30kB
2.          

CTE active_client

3. 0.068 1.086 ↓ 14.0 14 1

HashAggregate (cost=89.39..89.41 rows=1 width=11) (actual time=1.081..1.086 rows=14 loops=1)

  • Group Key: arrg_client_stats.partner_id
4. 1.018 1.018 ↓ 2.9 53 1

Seq Scan on arrg_client_stats (cost=0.00..89.26 rows=18 width=11) (actual time=0.121..1.018 rows=53 loops=1)

  • Filter: ((date >= '2017-01-10'::date) AND (date <= '2019-03-15'::date) AND (partner_id > 0) AND (partner_commission > '0'::numeric))
  • Rows Removed by Filter: 2610
5. 0.763 9.039 ↑ 6.4 37 1

HashAggregate (cost=2,014.26..2,020.75 rows=236 width=75) (actual time=8.983..9.039 rows=37 loops=1)

  • Group Key: amt.server_account_number
6. 0.123 8.276 ↓ 1.0 239 1

Hash Left Join (cost=126.90..2,005.41 rows=236 width=75) (actual time=4.310..8.276 rows=239 loops=1)

  • Hash Cond: (u.id = pl.user_id)
7. 0.121 8.136 ↓ 1.0 239 1

Hash Left Join (cost=125.76..2,003.38 rows=236 width=71) (actual time=4.254..8.136 rows=239 loops=1)

  • Hash Cond: (p.user_id = active_client.partner_id)
8. 0.215 6.908 ↓ 1.0 239 1

Hash Join (cost=125.73..2,002.45 rows=236 width=67) (actual time=3.125..6.908 rows=239 loops=1)

  • Hash Cond: (u.country = (c.code_a3)::text)
9. 0.269 6.561 ↓ 1.0 239 1

Nested Loop (cost=117.17..1,990.65 rows=236 width=60) (actual time=2.976..6.561 rows=239 loops=1)

10. 0.116 5.097 ↓ 1.0 239 1

Nested Loop (cost=116.88..991.62 rows=236 width=60) (actual time=2.927..5.097 rows=239 loops=1)

11. 0.151 3.308 ↓ 1.0 239 1

Hash Join (cost=116.60..143.21 rows=236 width=37) (actual time=2.858..3.308 rows=239 loops=1)

  • Hash Cond: (st_p.partner_id = p.user_id)
12. 0.355 0.355 ↓ 1.0 239 1

Seq Scan on arrg_partner_stats st_p (cost=0.00..23.37 rows=236 width=21) (actual time=0.028..0.355 rows=239 loops=1)

  • Filter: ((date >= '2017-01-10'::date) AND (date <= '2019-03-15'::date) AND (partner_id > 0))
  • Rows Removed by Filter: 525
13. 0.328 2.802 ↓ 1.0 1,314 1

Hash (cost=100.71..100.71 rows=1,271 width=16) (actual time=2.802..2.802 rows=1,314 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 78kB
14. 2.474 2.474 ↓ 1.0 1,314 1

Seq Scan on partner p (cost=0.00..100.71 rows=1,271 width=16) (actual time=0.006..2.474 rows=1,314 loops=1)

15. 1.673 1.673 ↑ 1.0 1 239

Index Scan using users_pkey on users u (cost=0.29..3.58 rows=1 width=23) (actual time=0.006..0.007 rows=1 loops=239)

  • Index Cond: (id = p.user_id)
16. 1.195 1.195 ↑ 1.0 1 239

Index Scan using account_mt4_pkey on account_mt4 amt (cost=0.29..4.22 rows=1 width=8) (actual time=0.005..0.005 rows=1 loops=239)

  • Index Cond: (account_id = p.account_id)
17. 0.066 0.132 ↑ 1.0 247 1

Hash (cost=5.47..5.47 rows=247 width=14) (actual time=0.132..0.132 rows=247 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 20kB
18. 0.066 0.066 ↑ 1.0 247 1

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

19. 0.011 1.107 ↓ 14.0 14 1

Hash (cost=0.02..0.02 rows=1 width=12) (actual time=1.107..1.107 rows=14 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
20. 1.096 1.096 ↓ 14.0 14 1

CTE Scan on active_client (cost=0.00..0.02 rows=1 width=12) (actual time=1.084..1.096 rows=14 loops=1)

21. 0.010 0.017 ↓ 1.3 8 1

Hash (cost=1.06..1.06 rows=6 width=12) (actual time=0.017..0.017 rows=8 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
22. 0.007 0.007 ↓ 1.3 8 1

Seq Scan on loyalty pl (cost=0.00..1.06 rows=6 width=12) (actual time=0.005..0.007 rows=8 loops=1)