explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Z4B5

Settings
# exclusive inclusive rows x rows loops node
1. 1.183 632.115 ↑ 1.1 622 1

Sort (cost=32,947.07..32,948.72 rows=663 width=56) (actual time=631.922..632.115 rows=622 loops=1)

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

Hash Left Join (cost=24,151.45..32,915.99 rows=663 width=56) (actual time=474.461..630.932 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)))
3. 1.389 629.763 ↑ 2.0 622 1

Merge Right Join (cost=24,003.53..30,632.75 rows=1,257 width=42) (actual time=473.995..629.763 rows=622 loops=1)

  • Merge Cond: (candidate_group_candidate.candidate_group_id = cg.id)
4. 83.234 625.984 ↓ 1.1 2,255 1

GroupAggregate (cost=24,003.25..25,303.91 rows=2,046 width=8) (actual time=473.916..625.984 rows=2,255 loops=1)

  • Group Key: candidate_group_candidate.candidate_group_id
5. 215.913 542.750 ↓ 1.0 170,714 1

Sort (cost=24,003.25..24,429.98 rows=170,693 width=8) (actual time=473.881..542.750 rows=170,714 loops=1)

  • Sort Key: candidate_group_candidate.candidate_group_id
  • Sort Method: external merge Disk: 3008kB
6. 161.147 326.837 ↓ 1.0 170,714 1

Hash Join (cost=1,970.83..7,801.79 rows=170,693 width=8) (actual time=100.738..326.837 rows=170,714 loops=1)

  • Hash Cond: (candidate_group_candidate.candidate_id = can.id)
7. 65.066 65.066 ↓ 1.0 170,714 1

Seq Scan on candidate_group_candidate (cost=0.00..3,483.93 rows=170,693 width=8) (actual time=0.012..65.066 rows=170,714 loops=1)

8. 44.960 100.624 ↓ 1.0 58,820 1

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

  • Buckets: 65536 Batches: 1 Memory Usage: 2810kB
9. 55.664 55.664 ↓ 1.0 58,820 1

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

  • Heap Fetches: 12133
10. 2.380 2.390 ↑ 2.0 622 1

Index Scan using candidate_group_pkey on candidate_group cg (cost=0.28..5,289.32 rows=1,257 width=34) (actual time=0.036..2.390 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
11.          

SubPlan (forIndex Scan)

12. 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))
13. 0.010 0.010 ↑ 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.008..0.010 rows=1 loops=1)

  • Filter: (user_account_id = 29104)
  • Rows Removed by Filter: 56
14. 0.092 0.453 ↑ 1.0 223 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 21kB
15. 0.361 0.361 ↑ 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.009..0.361 rows=223 loops=1)

16.          

SubPlan (forHash Left Join)

17. 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))
18. 0.010 0.010 ↑ 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.008..0.010 rows=1 loops=1)

  • Filter: (user_account_id = 29104)
  • Rows Removed by Filter: 56
Planning time : 1.017 ms