explain.depesz.com

PostgreSQL's explain analyze made readable

Result: VriF

Settings
# exclusive inclusive rows x rows loops node
1. 1.128 394.538 ↑ 1.1 622 1

Sort (cost=28,495.11..28,496.77 rows=663 width=56) (actual time=394.349..394.538 rows=622 loops=1)

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

Hash Left Join (cost=21,180.00..28,464.04 rows=663 width=56) (actual time=390.535..393.410 rows=622 loops=1)

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

Hash Left Join (cost=147.91..7,254.70 rows=663 width=48) (actual time=0.817..3.218 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.829 1.840 ↑ 2.0 622 1

Seq Scan on candidate_group cg (cost=0.00..4,971.46 rows=1,257 width=34) (actual time=0.013..1.840 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.186 0.789 ↑ 1.0 223 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 21kB
9. 0.603 0.603 ↑ 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.603 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.987 389.704 ↓ 1.1 2,255 1

Hash (cost=21,006.51..21,006.51 rows=2,046 width=12) (actual time=389.704..389.704 rows=2,255 loops=1)

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

Subquery Scan on cgc (cost=19,685.39..21,006.51 rows=2,046 width=12) (actual time=238.699..388.717 rows=2,255 loops=1)

15. 81.710 387.270 ↓ 1.1 2,255 1

GroupAggregate (cost=19,685.39..20,986.05 rows=2,046 width=8) (actual time=238.697..387.270 rows=2,255 loops=1)

  • Group Key: candidate_group_candidate.candidate_group_id
16. 219.432 305.560 ↓ 1.0 170,714 1

Sort (cost=19,685.39..20,112.13 rows=170,693 width=8) (actual time=238.666..305.560 rows=170,714 loops=1)

  • Sort Key: candidate_group_candidate.candidate_group_id
  • Sort Method: external merge Disk: 3008kB
17. 86.128 86.128 ↓ 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.006..86.128 rows=170,714 loops=1)