explain.depesz.com

PostgreSQL's explain analyze made readable

Result: HG1AY

Settings
# exclusive inclusive rows x rows loops node
1. 0.054 8.756 ↑ 6.4 37 1

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

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

CTE active_client

3. 0.060 1.088 ↓ 14.0 14 1

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

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

Seq Scan on arrg_client_stats (cost=0.00..89.26 rows=18 width=11) (actual time=0.122..1.028 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.855 8.702 ↑ 6.4 37 1

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

  • Group Key: amt.server_account_number
6. 0.097 7.847 ↓ 1.0 239 1

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

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

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

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

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

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

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

10. 0.329 4.409 ↓ 1.0 239 1

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

11. 0.181 2.407 ↓ 1.0 239 1

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

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

Seq Scan on arrg_partner_stats st_p (cost=0.00..23.37 rows=236 width=21) (actual time=0.031..0.377 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.248 1.849 ↓ 1.0 1,314 1

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

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

Seq Scan on partner p (cost=0.00..100.71 rows=1,271 width=16) (actual time=0.004..1.601 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.007..0.007 rows=1 loops=239)

  • Index Cond: (id = p.user_id)
16. 1.434 1.434 ↑ 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.006 rows=1 loops=239)

  • Index Cond: (account_id = p.account_id)
17. 0.119 0.239 ↑ 1.0 247 1

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

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

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

19. 0.006 1.105 ↓ 14.0 14 1

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

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

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

21. 0.016 0.021 ↓ 1.3 8 1

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

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

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

Planning time : 3.056 ms
Execution time : 9.107 ms