explain.depesz.com

PostgreSQL's explain analyze made readable

Result: NC6

Settings
# exclusive inclusive rows x rows loops node
1. 1.580 8,629.438 ↑ 1.1 622 1

Sort (cost=2,671,789.95..2,671,791.61 rows=663 width=56) (actual time=8,629.233..8,629.438 rows=622 loops=1)

  • Sort Key: cg.name
  • Sort Method: quicksort Memory: 110kB
2. 1.357 8,627.858 ↑ 1.1 622 1

Nested Loop Left Join (cost=148.20..2,671,758.88 rows=663 width=56) (actual time=35.348..8,627.858 rows=622 loops=1)

3. 1.365 4.959 ↑ 1.1 622 1

Hash Left Join (cost=147.91..7,254.70 rows=663 width=48) (actual time=1.026..4.959 rows=622 loops=1)

  • Hash Cond: (cg.owner_id = ua.id)
  • Filter: (((ua.system_admin = 0) AND (ua.deleted_timestamp IS NULL) AND (cg.owner_id = 29104)) OR (cg.share_permission = 2) OR ((cg.share_permission = 1) AND (alternatives: SubPlan 1 or hashed SubPlan 2)))
4. 2.581 2.590 ↑ 2.0 622 1

Seq Scan on candidate_group cg (cost=0.00..4,971.46 rows=1,257 width=34) (actual time=0.016..2.590 rows=622 loops=1)

  • Filter: ((owner_id = 29104) OR (share_permission = 2) OR ((share_permission = 1) AND (alternatives: SubPlan 1 or hashed SubPlan 2)))
  • Rows Removed by Filter: 1765
5.          

SubPlan (forSeq Scan)

6. 0.000 0.000 ↓ 0.0 0

Seq Scan on candidate_group_user_account cgua (cost=0.00..1.67 rows=1 width=0) (never executed)

  • Filter: ((cg.id = candidate_group_id) AND (user_account_id = 29104))
7. 0.009 0.009 ↑ 1.0 1 1

Seq Scan on candidate_group_user_account cgua_1 (cost=0.00..1.56 rows=1 width=4) (actual time=0.007..0.009 rows=1 loops=1)

  • Filter: (user_account_id = 29104)
  • Rows Removed by Filter: 56
8. 0.246 0.995 ↑ 1.0 223 1

Hash (cost=145.13..145.13 rows=223 width=28) (actual time=0.995..0.995 rows=223 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 21kB
9. 0.749 0.749 ↑ 1.0 223 1

Index Scan using client_account_pkey on user_account ua (cost=0.14..145.13 rows=223 width=28) (actual time=0.014..0.749 rows=223 loops=1)

10.          

SubPlan (forHash Left Join)

11. 0.000 0.000 ↓ 0.0 0

Seq Scan on candidate_group_user_account cgua (cost=0.00..1.67 rows=1 width=0) (never executed)

  • Filter: ((cg.id = candidate_group_id) AND (user_account_id = 29104))
12. 0.009 0.009 ↑ 1.0 1 1

Seq Scan on candidate_group_user_account cgua_1 (cost=0.00..1.56 rows=1 width=4) (actual time=0.007..0.009 rows=1 loops=1)

  • Filter: (user_account_id = 29104)
  • Rows Removed by Filter: 56
13. 23.014 8,621.542 ↑ 1.0 1 622

GroupAggregate (cost=0.29..4,018.84 rows=1 width=8) (actual time=13.860..13.861 rows=1 loops=622)

  • Group Key: cgc.candidate_group_id
14. 69.044 8,598.528 ↑ 1.3 62 622

Nested Loop (cost=0.29..4,018.41 rows=83 width=8) (actual time=4.817..13.824 rows=62 loops=622)

15. 8,451.736 8,451.736 ↑ 1.3 62 622

Seq Scan on candidate_group_candidate cgc (cost=0.00..3,910.66 rows=83 width=8) (actual time=4.809..13.588 rows=62 loops=622)

  • Filter: (cg.id = candidate_group_id)
  • Rows Removed by Filter: 170653
16. 77.748 77.748 ↑ 1.0 1 38,874

Index Only Scan using candidate_pkey on candidate can (cost=0.29..1.29 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=38,874)

  • Index Cond: (id = cgc.candidate_id)
  • Heap Fetches: 8484
Planning time : 0.983 ms