explain.depesz.com

PostgreSQL's explain analyze made readable

Result: gG2m

Settings
# exclusive inclusive rows x rows loops node
1. 2.786 2.786 ↑ 100.0 2 1

CTE Scan on top_performer (cost=104,076.93..104,080.93 rows=200 width=64) (actual time=2.776..2.786 rows=2 loops=1)

2.          

CTE managers

3. 0.554 2.319 ↑ 1.0 458 1

Nested Loop (cost=0.41..1,464.34 rows=458 width=40) (actual time=0.022..2.319 rows=458 loops=1)

4. 0.391 0.391 ↑ 1.0 458 1

Seq Scan on partners_partnermanager m (cost=0.00..27.72 rows=458 width=8) (actual time=0.011..0.391 rows=458 loops=1)

  • Filter: is_hired
  • Rows Removed by Filter: 415
5. 1.374 1.374 ↑ 1.0 1 458

Index Scan using profile_userconfig_user_id_key on profile_userconfig p (cost=0.41..3.13 rows=1 width=9) (actual time=0.003..0.003 rows=1 loops=458)

  • Index Cond: (user_id = m.user_id)
6.          

CTE top_performer

7. 0.004 2.784 ↑ 100.0 2 1

Subquery Scan on m_1 (cost=10.30..102,612.59 rows=200 width=64) (actual time=2.774..2.784 rows=2 loops=1)

8. 0.194 2.758 ↑ 100.0 2 1

HashAggregate (cost=10.30..12.30 rows=200 width=32) (actual time=2.756..2.758 rows=2 loops=1)

  • Group Key: managers.brand
9. 2.564 2.564 ↑ 1.0 458 1

CTE Scan on managers (cost=0.00..9.16 rows=458 width=32) (actual time=0.024..2.564 rows=458 loops=1)

10.          

SubPlan (forSubquery Scan)

11. 0.000 0.022 ↓ 0.0 0 2

Limit (cost=510.37..512.99 rows=1 width=32) (actual time=0.011..0.011 rows=0 loops=2)

12. 0.002 0.022 ↓ 0.0 0 2

Nested Loop (cost=510.37..512.99 rows=1 width=32) (actual time=0.011..0.011 rows=0 loops=2)

13. 0.002 0.020 ↓ 0.0 0 2

Nested Loop (cost=510.09..512.12 rows=1 width=4) (actual time=0.010..0.010 rows=0 loops=2)

14. 0.000 0.018 ↓ 0.0 0 2

Limit (cost=509.81..509.82 rows=1 width=12) (actual time=0.009..0.009 rows=0 loops=2)

15. 0.010 0.018 ↓ 0.0 0 2

Sort (cost=509.81..510.04 rows=90 width=12) (actual time=0.009..0.009 rows=0 loops=2)

  • Sort Key: (count(*)) DESC
  • Sort Method: quicksort Memory: 25kB
16. 0.004 0.008 ↓ 0.0 0 2

HashAggregate (cost=508.46..509.36 rows=90 width=12) (actual time=0.004..0.004 rows=0 loops=2)

  • Group Key: c.account_manager_id
17. 0.000 0.004 ↓ 0.0 0 2

Nested Loop (cost=0.58..507.32 rows=229 width=4) (actual time=0.002..0.002 rows=0 loops=2)

18. 0.000 0.004 ↓ 0.0 0 2

Nested Loop (cost=0.29..328.18 rows=370 width=8) (actual time=0.002..0.002 rows=0 loops=2)

19. 0.004 0.004 ↓ 0.0 0 2

Seq Scan on partners_partnerstatdata sd (cost=0.00..17.40 rows=370 width=4) (actual time=0.002..0.002 rows=0 loops=2)

  • Filter: is_reactivated
20. 0.000 0.000 ↓ 0.0 0

Index Only Scan using partners_partner_pkey on partners_partner p_1 (cost=0.29..0.84 rows=1 width=4) (never executed)

  • Index Cond: (id = sd.partner_id)
  • Heap Fetches: 0
21. 0.000 0.000 ↓ 0.0 0

Index Scan using partners_partnercontract_4e98b6eb on partners_partnercontract c (cost=0.29..0.47 rows=1 width=8) (never executed)

  • Index Cond: (partner_id = p_1.id)
  • Filter: ((brand)::text = (m_1.brand)::text)
22. 0.000 0.000 ↓ 0.0 0

Index Scan using partners_partnermanager_pkey on partners_partnermanager (cost=0.28..2.29 rows=1 width=8) (never executed)

  • Index Cond: (id = c.account_manager_id)
23. 0.000 0.000 ↓ 0.0 0

Index Scan using auth_user_pkey on auth_user u (cost=0.28..0.86 rows=1 width=20) (never executed)

  • Index Cond: (id = partners_partnermanager.user_id)
Planning time : 1.808 ms
Execution time : 2.995 ms