explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 2b3c

Settings
# exclusive inclusive rows x rows loops node
1. 0.213 591.927 ↑ 1.0 1 1

Aggregate (cost=409,911.96..409,911.97 rows=1 width=8) (actual time=591.927..591.927 rows=1 loops=1)

2. 0.462 591.714 ↓ 3,601.0 3,601 1

Unique (cost=409,911.94..409,911.95 rows=1 width=4) (actual time=591.004..591.714 rows=3,601 loops=1)

3. 1.182 591.252 ↓ 3,603.0 3,603 1

Sort (cost=409,911.94..409,911.95 rows=1 width=4) (actual time=591.003..591.252 rows=3,603 loops=1)

  • Sort Key: clients_client.id
  • Sort Method: quicksort Memory: 265kB
4. 56.162 590.070 ↓ 3,603.0 3,603 1

Nested Loop Semi Join (cost=19,749.48..409,911.93 rows=1 width=4) (actual time=83.585..590.070 rows=3,603 loops=1)

5. 139.178 257.419 ↓ 1.5 92,163 1

Hash Join (cost=19,748.78..32,524.17 rows=60,530 width=8) (actual time=83.274..257.419 rows=92,163 loops=1)

  • Hash Cond: (clients_groupassignment.client_id = clients_client.id)
6. 35.085 35.085 ↑ 1.0 469,322 1

Seq Scan on clients_groupassignment (cost=0.00..11,506.36 rows=483,436 width=8) (actual time=0.009..35.085 rows=469,322 loops=1)

7. 16.481 83.156 ↓ 1.0 92,176 1

Hash (cost=18,636.19..18,636.19 rows=89,007 width=4) (actual time=83.156..83.156 rows=92,176 loops=1)

  • Buckets: 131072 Batches: 1 Memory Usage: 4265kB
8. 66.675 66.675 ↓ 1.0 92,176 1

Index Scan using clients_client_brokerage_id on clients_client (cost=0.42..18,636.19 rows=89,007 width=4) (actual time=0.014..66.675 rows=92,176 loops=1)

  • Index Cond: (brokerage_id = 18855)
  • Filter: (status <> ALL ('{50,70}'::integer[]))
  • Rows Removed by Filter: 7226
9. 0.000 276.489 ↓ 0.0 0 92,163

Nested Loop (cost=0.70..6.22 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=92,163)

10. 171.264 276.489 ↓ 0.0 0 92,163

Index Scan using clients_groupassignment_pkey on clients_groupassignment v0 (cost=0.42..5.92 rows=1 width=8) (actual time=0.003..0.003 rows=0 loops=92,163)

  • Index Cond: (id = clients_groupassignment.id)
  • Filter: ((status = ANY ('{10,15}'::integer[])) AND (NOT (alternatives: SubPlan 1 or hashed SubPlan 2)))
  • Rows Removed by Filter: 1
  • Index Cond: (id = v0.group_id)
  • Filter: (company_id = 18855)
  • Rows Removed by Filter: 0
11.          

SubPlan (for Index Scan)

12. 3.005 105.225 ↑ 1.0 1 21,045

Nested Loop (cost=1.00..5.46 rows=1 width=0) (actual time=0.005..0.005 rows=1 loops=21,045)

13. 24.050 84.180 ↑ 1.0 1 21,045

Nested Loop (cost=0.71..5.15 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=21,045)

14. 42.090 42.090 ↑ 1.0 1 21,045

Index Only Scan using clients_client_agents_client_id_37afacd828f1e2f6_uniq on clients_client_agents u3 (cost=0.42..2.64 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=21,045)

  • Index Cond: (client_id = v0.client_id)
  • Heap Fetches: 15801
15. 18.040 18.040 ↑ 1.0 1 18,040

Index Only Scan using auth_user_pkey on auth_user u0 (cost=0.29..2.51 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=18,040)

  • Index Cond: (id = u3.user_id)
  • Heap Fetches: 17447
16. 18.040 18.040 ↑ 1.0 1 18,040

Index Only Scan using accounts_employeegroup_employees_employeegroup_id_user_id_key on accounts_employeegroup_employees u1 (cost=0.29..0.31 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=18,040)

  • Index Cond: ((employeegroup_id = v0.group_id) AND (user_id = u0.id))
  • Heap Fetches: 7427
17. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=2,003.74..19,914.22 rows=571,474 width=8) (never executed)

  • Hash Cond: (u3_1.user_id = u0_1.id)
18. 0.000 0.000 ↓ 0.0 0

Seq Scan on clients_client_agents u3_1 (cost=0.00..9,820.90 rows=633,290 width=8) (never executed)

19. 0.000 0.000 ↓ 0.0 0

Hash (cost=1,684.57..1,684.57 rows=25,534 width=12) (never executed)

20. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=1,209.19..1,684.57 rows=25,534 width=12) (never executed)

  • Hash Cond: (u1_1.user_id = u0_1.id)
21. 0.000 0.000 ↓ 0.0 0

Seq Scan on accounts_employeegroup_employees u1_1 (cost=0.00..408.34 rows=25,534 width=8) (never executed)

22. 0.000 0.000 ↓ 0.0 0

Hash (cost=855.49..855.49 rows=28,296 width=4) (never executed)

23. 0.000 0.000 ↓ 0.0 0

Index Only Scan using auth_user_pkey on auth_user u0_1 (cost=0.29..855.49 rows=28,296 width=4) (never executed)

24. 3.605 3.605 ↑ 1.0 1 3,605

Heap Fetches: 0-> Index Scan using accounts_employeegroup_pkey on accounts_employeegroup v1 (cost=0.28..0.30 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=3,605)

Planning time : 1.749 ms
Execution time : 592.023 ms