explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 1qX9

Settings
# exclusive inclusive rows x rows loops node
1. 1.079 591.936 ↑ 1.1 622 1

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

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

Hash Left Join (cost=24,151.45..32,915.99 rows=663 width=56) (actual time=435.774..590.857 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.312 589.656 ↑ 2.0 622 1

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

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

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

  • Group Key: candidate_group_candidate.candidate_group_id
5. 209.716 503.904 ↓ 1.0 170,714 1

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

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

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

  • Hash Cond: (candidate_group_candidate.candidate_id = can.id)
7. 61.446 61.446 ↓ 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.011..61.446 rows=170,714 loops=1)

8. 36.258 82.513 ↓ 1.0 58,820 1

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

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

  • Heap Fetches: 12133
10. 2.329 2.339 ↑ 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.033..2.339 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 (for Index 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.102 0.476 ↑ 1.0 223 1

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

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

16.          

SubPlan (for Hash 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.081 ms