explain.depesz.com

PostgreSQL's explain analyze made readable

Result: MiMR

Settings
# exclusive inclusive rows x rows loops node
1. 0.009 2,887.831 ↓ 50.0 50 1

Limit (cost=409,917.24..409,917.25 rows=1 width=12) (actual time=2,887.812..2,887.831 rows=50 loops=1)

2. 0.007 2,887.822 ↓ 50.0 50 1

Unique (cost=409,917.24..409,917.25 rows=1 width=12) (actual time=2,887.812..2,887.822 rows=50 loops=1)

3. 1.386 2,887.815 ↓ 50.0 50 1

Sort (cost=409,917.24..409,917.25 rows=1 width=12) (actual time=2,887.811..2,887.815 rows=50 loops=1)

  • Sort Key: ((SubPlan 1)) DESC NULLS LAST, clients_client.id DESC
  • Sort Method: quicksort Memory: 265kB
4. 33.207 2,886.429 ↓ 3,588.0 3,588 1

Nested Loop Semi Join (cost=19,749.48..409,917.23 rows=1 width=12) (actual time=79.561..2,886.429 rows=3,588 loops=1)

5. 141.285 303.134 ↓ 1.5 92,146 1

Hash Join (cost=19,748.78..32,524.17 rows=60,530 width=8) (actual time=79.045..303.134 rows=92,146 loops=1)

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

Seq Scan on clients_groupassignment (cost=0.00..11,506.36 rows=483,436 width=8) (actual time=0.007..82.917 rows=469,265 loops=1)

7. 16.245 78.932 ↓ 1.0 92,159 1

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

  • Buckets: 131072 Batches: 1 Memory Usage: 4264kB
8. 62.687 62.687 ↓ 1.0 92,159 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.013..62.687 rows=92,159 loops=1)

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

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

10. 242.410 368.584 ↓ 0.0 0 92,146

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

  • Index Cond: (id = clients_groupassignment.id)
  • Filter: ((status = ANY ('{10,15}'::integer[])) AND (NOT (alternatives: SubPlan 2 or hashed SubPlan 3)))
  • 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. 5.980 126.174 ↑ 1.0 1 21,029

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

13. 2.990 84.116 ↑ 1.0 1 21,029

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

14. 63.087 63.087 ↑ 1.0 1 21,029

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.003..0.003 rows=1 loops=21,029)

  • Index Cond: (client_id = v0.client_id)
  • Heap Fetches: 15800
15. 18.039 18.039 ↑ 1.0 1 18,039

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

  • Index Cond: (id = u3.user_id)
  • Heap Fetches: 17432
16. 36.078 36.078 ↑ 1.0 1 18,039

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.002..0.002 rows=1 loops=18,039)

  • Index Cond: ((employeegroup_id = v0.group_id) AND (user_id = u0_1.id))
  • Heap Fetches: 7426
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_2.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_2.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_2 (cost=0.29..855.49 rows=28,296 width=4) (never executed)

24. 7.180 7.180 ↑ 1.0 1 3,590

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.002..0.002 rows=1 loops=3,590)

25.          

SubPlan (for Nested Loop Semi Join)

26. 3.588 2,181.504 ↑ 1.0 1 3,588

Limit (cost=5.30..5.30 rows=1 width=8) (actual time=0.607..0.608 rows=1 loops=3,588)

27. 7.176 2,177.916 ↑ 1.0 1 3,588

Sort (cost=5.30..5.30 rows=1 width=8) (actual time=0.607..0.607 rows=1 loops=3,588)

  • Sort Key: u2."timestamp" DESC NULLS LAST
  • Sort Method: quicksort Memory: 25kB
28. 2.983 2,170.740 ↑ 1.0 1 3,588

Nested Loop Left Join (cost=0.85..5.29 rows=1 width=8) (actual time=0.604..0.605 rows=1 loops=3,588)

29. 14.352 14.352 ↑ 1.0 1 3,588

Index Scan using clients_groupassignment_client_id_4c897251 on clients_groupassignment u0 (cost=0.42..2.64 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=3,588)

  • Index Cond: (client_id = clients_client.id)
30. 2,153.405 2,153.405 ↑ 1.0 1 3,595

Index Scan using messenger_communication_pkey on messenger_communication u2 (cost=0.43..2.65 rows=1 width=12) (actual time=0.599..0.599 rows=1 loops=3,595)

  • Index Cond: (u0.last_communication_id = id)
Planning time : 2.847 ms
Execution time : 2,887.943 ms