explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ewRg

Settings
# exclusive inclusive rows x rows loops node
1. 0.026 6.058 ↓ 6.8 27 1

Sort (cost=319.97..319.98 rows=4 width=75) (actual time=6.057..6.058 rows=27 loops=1)

  • Sort Key: (max(p.reg_date)) DESC
  • Sort Method: quicksort Memory: 29kB
2.          

CTE active_client

3. 0.084 0.800 ↓ 6.8 27 1

HashAggregate (cost=134.07..134.12 rows=4 width=7) (actual time=0.793..0.800 rows=27 loops=1)

  • Group Key: stat.partner_id
4. 0.137 0.716 ↓ 33.0 132 1

Hash Join (cost=113.50..134.04 rows=4 width=7) (actual time=0.465..0.716 rows=132 loops=1)

  • Hash Cond: (stat.partner_id = p_1.user_id)
5. 0.141 0.141 ↑ 1.0 764 1

Seq Scan on arrg_partner_stats stat (cost=0.00..17.64 rows=764 width=7) (actual time=0.004..0.141 rows=764 loops=1)

6. 0.065 0.438 ↓ 49.8 299 1

Hash (cost=113.42..113.42 rows=6 width=4) (actual time=0.438..0.438 rows=299 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 19kB
7. 0.373 0.373 ↓ 49.8 299 1

Seq Scan on partner p_1 (cost=0.00..113.42 rows=6 width=4) (actual time=0.013..0.373 rows=299 loops=1)

  • Filter: (((reg_date)::date >= '2017-01-10'::date) AND ((reg_date)::date <= '2019-03-15'::date))
  • Rows Removed by Filter: 1015
8. 0.454 6.032 ↓ 6.8 27 1

HashAggregate (cost=185.70..185.81 rows=4 width=75) (actual time=5.996..6.032 rows=27 loops=1)

  • Group Key: amt.server_account_number
9. 0.075 5.578 ↓ 33.0 132 1

Nested Loop Left Join (cost=114.47..185.55 rows=4 width=75) (actual time=2.513..5.578 rows=132 loops=1)

10. 0.112 5.371 ↓ 33.0 132 1

Hash Left Join (cost=114.34..184.91 rows=4 width=71) (actual time=2.507..5.371 rows=132 loops=1)

  • Hash Cond: (p.user_id = active_client.partner_id)
11. 0.181 4.426 ↓ 33.0 132 1

Nested Loop (cost=114.21..184.75 rows=4 width=67) (actual time=1.651..4.426 rows=132 loops=1)

12. 0.157 3.849 ↓ 33.0 132 1

Nested Loop (cost=114.07..184.06 rows=4 width=60) (actual time=1.615..3.849 rows=132 loops=1)

13. 0.217 2.900 ↓ 33.0 132 1

Nested Loop (cost=113.78..150.80 rows=4 width=60) (actual time=1.574..2.900 rows=132 loops=1)

  • Join Filter: (p.user_id = u.id)
14. 0.171 1.759 ↓ 33.0 132 1

Hash Join (cost=113.50..134.04 rows=4 width=37) (actual time=1.525..1.759 rows=132 loops=1)

  • Hash Cond: (st_p.partner_id = p.user_id)
15. 0.105 0.105 ↑ 1.0 764 1

Seq Scan on arrg_partner_stats st_p (cost=0.00..17.64 rows=764 width=21) (actual time=0.024..0.105 rows=764 loops=1)

16. 0.100 1.483 ↓ 49.8 299 1

Hash (cost=113.42..113.42 rows=6 width=16) (actual time=1.483..1.483 rows=299 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 23kB
17. 1.383 1.383 ↓ 49.8 299 1

Seq Scan on partner p (cost=0.00..113.42 rows=6 width=16) (actual time=0.010..1.383 rows=299 loops=1)

  • Filter: (((reg_date)::date >= '2017-01-10'::date) AND ((reg_date)::date <= '2019-03-15'::date))
  • Rows Removed by Filter: 1015
18. 0.924 0.924 ↑ 1.0 1 132

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

  • Index Cond: (id = st_p.partner_id)
19. 0.792 0.792 ↑ 1.0 1 132

Index Scan using account_mt4_pkey on account_mt4 amt (cost=0.29..8.30 rows=1 width=8) (actual time=0.006..0.006 rows=1 loops=132)

  • Index Cond: (account_id = p.account_id)
20. 0.396 0.396 ↑ 1.0 1 132

Index Scan using unq_countries_code_a3 on countries c (cost=0.14..0.16 rows=1 width=14) (actual time=0.003..0.003 rows=1 loops=132)

  • Index Cond: ((code_a3)::text = u.country)
21. 0.018 0.833 ↓ 6.8 27 1

Hash (cost=0.08..0.08 rows=4 width=12) (actual time=0.833..0.833 rows=27 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
22. 0.815 0.815 ↓ 6.8 27 1

CTE Scan on active_client (cost=0.00..0.08 rows=4 width=12) (actual time=0.797..0.815 rows=27 loops=1)

23. 0.132 0.132 ↓ 0.0 0 132

Index Scan using loyalty_pkey on loyalty pl (cost=0.13..0.15 rows=1 width=12) (actual time=0.001..0.001 rows=0 loops=132)

  • Index Cond: (user_id = u.id)