explain.depesz.com

PostgreSQL's explain analyze made readable

Result: k3Ls

Settings
# exclusive inclusive rows x rows loops node
1. 51.970 51.970 ↑ 1.2 33 1

CTE Scan on sales_table (cost=8,288.18..8,288.96 rows=39 width=556) (actual time=5.262..51.970 rows=33 loops=1)

2.          

CTE sales_managers

3. 0.136 1.065 ↑ 1.2 33 1

Nested Loop (cost=0.83..157.61 rows=39 width=64) (actual time=0.034..1.065 rows=33 loops=1)

4. 0.056 0.830 ↑ 1.2 33 1

Nested Loop (cost=0.56..144.66 rows=39 width=28) (actual time=0.025..0.830 rows=33 loops=1)

  • Join Filter: (m.user_id = u.id)
5. 0.055 0.634 ↑ 1.1 35 1

Nested Loop (cost=0.28..117.08 rows=39 width=16) (actual time=0.019..0.634 rows=35 loops=1)

6. 0.439 0.439 ↑ 1.1 35 1

Seq Scan on partners_partnermanager m (cost=0.00..42.48 rows=39 width=8) (actual time=0.011..0.439 rows=35 loops=1)

  • Filter: (is_hired AND ((type)::text = ANY ('{sales,senior_sales_manager}'::text[])))
  • Rows Removed by Filter: 1128
7. 0.140 0.140 ↑ 1.0 1 35

Index Scan using profile_userconfig_user_id_key on profile_userconfig uc (cost=0.28..1.91 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=35)

  • Index Cond: (user_id = m.user_id)
8. 0.140 0.140 ↑ 1.0 1 35

Index Scan using auth_user_pkey on auth_user u (cost=0.28..0.69 rows=1 width=20) (actual time=0.004..0.004 rows=1 loops=35)

  • Index Cond: (id = uc.user_id)
  • Filter: ((email)::text <> 'crm@ostrovok.ru'::text)
  • Rows Removed by Filter: 0
9. 0.099 0.099 ↑ 1.0 1 33

Index Scan using profile_team_pkey on profile_team t (cost=0.27..0.33 rows=1 width=24) (actual time=0.003..0.003 rows=1 loops=33)

  • Index Cond: (id = uc.team_id)
10.          

CTE sales_table

11. 1.154 51.941 ↑ 1.2 33 1

CTE Scan on sales_managers u_1 (cost=0.00..8,130.57 rows=39 width=556) (actual time=5.259..51.941 rows=33 loops=1)

12.          

SubPlan (for CTE Scan)

13. 0.132 50.787 ↑ 1.0 1 33

Aggregate (cost=208.45..208.46 rows=1 width=8) (actual time=1.539..1.539 rows=1 loops=33)

14. 1.386 50.655 ↓ 4.0 16 33

Nested Loop (cost=0.85..208.44 rows=4 width=0) (actual time=0.261..1.535 rows=16 loops=33)

15. 2.419 25.047 ↓ 8.3 367 33

Nested Loop (cost=0.57..194.10 rows=44 width=4) (actual time=0.016..0.759 rows=367 loops=33)

16. 0.132 0.132 ↑ 1.0 1 33

Index Scan using partners_partnermanager_e8701ad4 on partners_partnermanager m_1 (cost=0.28..2.29 rows=1 width=4) (actual time=0.003..0.004 rows=1 loops=33)

  • Index Cond: (user_id = u_1.user_id)
17. 22.496 22.496 ↓ 1.7 327 37

Index Scan using partners_partnercontract_3f984797 on partners_partnercontract c (cost=0.29..189.90 rows=191 width=8) (actual time=0.011..0.608 rows=327 loops=37)

  • Index Cond: (sales_manager_id = m_1.id)
18. 24.222 24.222 ↓ 0.0 0 12,111

Index Only Scan using idx_contract_data_public_offer on partners_partnercontractdata cd (cost=0.28..0.32 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=12,111)

  • Index Cond: (contract_id = c.id)
  • Heap Fetches: 515
Planning time : 1.955 ms
Execution time : 52.067 ms