explain.depesz.com

PostgreSQL's explain analyze made readable

Result: CwCs

Settings
# exclusive inclusive rows x rows loops node
1. 0.039 34,691.038 ↓ 3.0 3 1

GroupAggregate (cost=32,045.81..32,045.83 rows=1 width=17) (actual time=34,691.031..34,691.038 rows=3 loops=1)

  • Group Key: equipment_types.name
2. 0.085 34,690.999 ↓ 27.0 27 1

Sort (cost=32,045.81..32,045.82 rows=1 width=13) (actual time=34,690.997..34,690.999 rows=27 loops=1)

  • Sort Key: equipment_types.name
  • Sort Method: quicksort Memory: 26kB
3. 0.049 34,690.914 ↓ 27.0 27 1

Nested Loop (cost=2,990.51..32,045.80 rows=1 width=13) (actual time=2,435.302..34,690.914 rows=27 loops=1)

4. 0.080 34,690.568 ↓ 27.0 27 1

Nested Loop Left Join (cost=2,990.22..32,043.53 rows=1 width=8) (actual time=2,435.275..34,690.568 rows=27 loops=1)

  • Filter: ((service_desk_desks.id IS NOT NULL) OR ((desks2.user_without_access_create_ticket IS TRUE) AND (service_desk_tickets.created_by_id = 12,059) AND (service_desk_desks.id IS NULL)))
5. 0.179 34,689.840 ↓ 27.0 27 1

Nested Loop (cost=2,989.65..32,032.77 rows=1 width=17) (actual time=2,435.231..34,689.840 rows=27 loops=1)

6. 1,512.441 34,689.256 ↓ 27.0 27 1

Nested Loop (cost=2,989.36..32,032.39 rows=1 width=16) (actual time=2,435.182..34,689.256 rows=27 loops=1)

  • Join Filter: (equipment.id = service_desk_tickets.equipment_id)
  • Rows Removed by Join Filter: 11,406,222
7. 0.369 21.004 ↓ 333.0 333 1

Nested Loop (cost=2,988.94..3,167.88 rows=1 width=8) (actual time=16.872..21.004 rows=333 loops=1)

8. 0.135 17.783 ↓ 15.5 62 1

Nested Loop (cost=2,988.65..3,164.96 rows=4 width=8) (actual time=16.847..17.783 rows=62 loops=1)

9. 0.080 17.214 ↓ 15.5 62 1

Group (cost=2,988.36..3,147.69 rows=4 width=520) (actual time=16.823..17.214 rows=62 loops=1)

  • Group Key: clients_1.id
10. 0.088 17.134 ↓ 15.5 62 1

Nested Loop Left Join (cost=2,988.36..3,147.68 rows=4 width=4) (actual time=16.821..17.134 rows=62 loops=1)

  • Join Filter: (users_clients.client_id = clients_1.id)
  • Filter: ((users_clients.id IS NOT NULL) OR (client_technical_groups.id IS NOT NULL))
11. 0.169 16.054 ↓ 15.5 62 1

Merge Left Join (cost=2,988.36..2,988.46 rows=4 width=8) (actual time=15.834..16.054 rows=62 loops=1)

  • Merge Cond: (clients_1.id = client_technical_groups.client_id)
12. 0.103 15.627 ↓ 15.5 62 1

Sort (cost=2,952.66..2,952.68 rows=4 width=4) (actual time=15.609..15.627 rows=62 loops=1)

  • Sort Key: clients_1.id
  • Sort Method: quicksort Memory: 27kB
13. 15.524 15.524 ↓ 15.5 62 1

Seq Scan on clients clients_1 (cost=0.00..2,952.62 rows=4 width=4) (actual time=6.836..15.524 rows=62 loops=1)

  • Filter: (organization_id = 3,747)
  • Rows Removed by Filter: 49,908
14. 0.077 0.258 ↓ 4.3 64 1

Sort (cost=35.69..35.73 rows=15 width=8) (actual time=0.220..0.258 rows=64 loops=1)

  • Sort Key: client_technical_groups.client_id
  • Sort Method: quicksort Memory: 28kB
15. 0.181 0.181 ↓ 4.3 64 1

Index Scan using index_client_technical_groups_on_technical_group_id on client_technical_groups (cost=0.42..35.40 rows=15 width=8) (actual time=0.035..0.181 rows=64 loops=1)

  • Index Cond: (technical_group_id = 9,762)
16. 0.018 0.992 ↓ 0.0 0 62

Materialize (cost=0.00..159.16 rows=1 width=8) (actual time=0.016..0.016 rows=0 loops=62)

17. 0.974 0.974 ↓ 0.0 0 1

Seq Scan on users_clients (cost=0.00..159.15 rows=1 width=8) (actual time=0.974..0.974 rows=0 loops=1)

  • Filter: (user_id = 12,059)
  • Rows Removed by Filter: 7,612
18. 0.434 0.434 ↑ 1.0 1 62

Index Only Scan using clients_pkey on clients (cost=0.29..4.31 rows=1 width=4) (actual time=0.007..0.007 rows=1 loops=62)

  • Index Cond: (id = clients_1.id)
  • Heap Fetches: 0
19. 2.852 2.852 ↓ 5.0 5 62

Index Scan using index_equipment_on_client_id on equipment (cost=0.29..0.72 rows=1 width=12) (actual time=0.010..0.046 rows=5 loops=62)

  • Index Cond: (client_id = clients.id)
  • Filter: (organization_id = 3,747)
20. 33,155.811 33,155.811 ↓ 1.0 34,253 333

Index Scan using index_service_desk_tickets_on_is_closed on service_desk_tickets (cost=0.42..28,441.87 rows=33,811 width=16) (actual time=0.031..99.567 rows=34,253 loops=333)

  • Index Cond: (is_closed = false)
  • Filter: (NOT is_closed)
21. 0.405 0.405 ↑ 1.0 1 27

Index Scan using service_desk_desks_pkey on service_desk_desks desks2 (cost=0.29..0.38 rows=1 width=5) (actual time=0.015..0.015 rows=1 loops=27)

  • Index Cond: (id = service_desk_tickets.desk_id)
22. 0.054 0.648 ↑ 1.0 1 27

Nested Loop (cost=0.57..10.75 rows=1 width=4) (actual time=0.022..0.024 rows=1 loops=27)

23. 0.081 0.081 ↑ 1.0 1 27

Index Scan using service_desk_desks_pkey on service_desk_desks (cost=0.29..0.39 rows=1 width=4) (actual time=0.002..0.003 rows=1 loops=27)

  • Index Cond: (id = service_desk_tickets.desk_id)
  • Filter: (organization_id = 3,747)
24. 0.513 0.513 ↑ 1.0 1 27

Index Scan using index_desk_technical_groups_on_desk_id on desk_technical_groups (cost=0.29..10.35 rows=1 width=4) (actual time=0.017..0.019 rows=1 loops=27)

  • Index Cond: (desk_id = service_desk_desks.id)
  • Filter: (technical_group_id = 9,762)
  • Rows Removed by Filter: 3
25. 0.297 0.297 ↑ 1.0 1 27

Index Scan using equipment_types_pkey on equipment_types (cost=0.29..2.27 rows=1 width=13) (actual time=0.011..0.011 rows=1 loops=27)

  • Index Cond: (id = equipment.equipment_type_id)