explain.depesz.com

PostgreSQL's explain analyze made readable

Result: qmxO

Settings
# exclusive inclusive rows x rows loops node
1. 1.221 610.818 ↑ 1.1 622 1

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

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

Hash Left Join (cost=24,151.45..32,915.99 rows=663 width=56) (actual time=453.364..609.597 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.439 608.414 ↑ 2.0 622 1

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

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

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

  • Group Key: candidate_group_candidate.candidate_group_id
5. 212.938 521.050 ↑ 1.0 170,693 1

Sort (cost=24,003.25..24,429.98 rows=170,693 width=8) (actual time=452.733..521.050 rows=170,693 loops=1)

  • Sort Key: candidate_group_candidate.candidate_group_id
  • Sort Method: external merge Disk: 3000kB
6. 157.993 308.112 ↑ 1.0 170,693 1

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

  • Hash Cond: (candidate_group_candidate.candidate_id = can.id)
7. 63.648 63.648 ↑ 1.0 170,693 1

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

8. 38.732 86.471 ↓ 1.0 58,818 1

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

  • Buckets: 65536 Batches: 1 Memory Usage: 2810kB
9. 47.739 47.739 ↓ 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.018..47.739 rows=58,818 loops=1)

  • Heap Fetches: 11537
10. 2.998 3.009 ↑ 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.051..3.009 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.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.010..0.011 rows=1 loops=1)

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

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

  • Buckets: 1024 Batches: 1 Memory Usage: 21kB
15. 0.336 0.336 ↑ 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.015..0.336 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.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.010..0.011 rows=1 loops=1)

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