explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 1t5g

Settings
# exclusive inclusive rows x rows loops node
1. 1.039 661.883 ↑ 1.1 622 1

Sort (cost=32,674.53..32,676.19 rows=663 width=56) (actual time=661.688..661.883 rows=622 loops=1)

  • Sort Key: cg.name
  • Sort Method: quicksort Memory: 110kB
2. 0.490 660.844 ↑ 1.1 622 1

Hash Left Join (cost=25,359.42..32,643.46 rows=663 width=56) (actual time=658.138..660.844 rows=622 loops=1)

  • Hash Cond: (cg.id = cgc.candidate_group_id)
3. 0.556 3.010 ↑ 1.1 622 1

Hash Left Join (cost=147.91..7,254.70 rows=663 width=48) (actual time=0.770..3.010 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. 1.695 1.706 ↑ 2.0 622 1

Seq Scan on candidate_group cg (cost=0.00..4,971.46 rows=1,257 width=34) (actual time=0.015..1.706 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.011 0.011 ↑ 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.009..0.011 rows=1 loops=1)

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

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

  • Buckets: 1024 Batches: 1 Memory Usage: 21kB
9. 0.527 0.527 ↑ 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.011..0.527 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.011 0.011 ↑ 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.009..0.011 rows=1 loops=1)

  • Filter: (user_account_id = 29104)
  • Rows Removed by Filter: 56
13. 0.999 657.344 ↓ 1.1 2,255 1

Hash (cost=25,185.93..25,185.93 rows=2,046 width=12) (actual time=657.344..657.344 rows=2,255 loops=1)

  • Buckets: 4096 (originally 2048) Batches: 1 (originally 1) Memory Usage: 129kB
14. 1.409 656.345 ↓ 1.1 2,255 1

Subquery Scan on cgc (cost=23,872.61..25,185.93 rows=2,046 width=12) (actual time=508.969..656.345 rows=2,255 loops=1)

15. 80.308 654.936 ↓ 1.1 2,255 1

GroupAggregate (cost=23,872.61..25,165.47 rows=2,046 width=8) (actual time=508.967..654.936 rows=2,255 loops=1)

  • Group Key: candidate_group_candidate.candidate_group_id
16. 226.932 574.628 ↓ 1.0 170,693 1

Sort (cost=23,872.61..24,296.74 rows=169,654 width=8) (actual time=508.935..574.628 rows=170,693 loops=1)

  • Sort Key: candidate_group_candidate.candidate_group_id
  • Sort Method: external merge Disk: 3000kB
17. 187.441 347.696 ↓ 1.0 170,693 1

Hash Join (cost=1,970.83..7,777.11 rows=169,654 width=8) (actual time=84.642..347.696 rows=170,693 loops=1)

  • Hash Cond: (candidate_group_candidate.candidate_id = can.id)
18. 75.966 75.966 ↓ 1.0 170,693 1

Seq Scan on candidate_group_candidate (cost=0.00..3,473.54 rows=169,654 width=8) (actual time=0.006..75.966 rows=170,693 loops=1)

19. 38.363 84.289 ↓ 1.0 58,818 1

Hash (cost=1,236.13..1,236.13 rows=58,776 width=8) (actual time=84.289..84.289 rows=58,818 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 2810kB
20. 45.926 45.926 ↓ 1.0 58,818 1

Index Only Scan using candidate_pkey on candidate can (cost=0.29..1,236.13 rows=58,776 width=8) (actual time=0.014..45.926 rows=58,818 loops=1)

  • Heap Fetches: 11521
Planning time : 0.883 ms