explain.depesz.com

PostgreSQL's explain analyze made readable

Result: DFJ9 : Optimization for: plan #T8Yq

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.006 23.025 ↑ 42.0 1 1

Sort (cost=3,297.65..3,297.76 rows=42 width=538) (actual time=23.025..23.025 rows=1 loops=1)

  • Sort Key: cg.name
  • Sort Method: quicksort Memory: 25kB
2. 0.003 23.019 ↑ 42.0 1 1

Hash Left Join (cost=3,290.26..3,296.52 rows=42 width=538) (actual time=22.993..23.019 rows=1 loops=1)

  • Hash Cond: (cg.id = cgc.contact_group_id)
3. 0.021 0.052 ↑ 42.0 1 1

Hash Semi Join (cost=57.30..63.45 rows=42 width=530) (actual time=0.026..0.052 rows=1 loops=1)

  • Hash Cond: (cg.id = contact_group_contact.contact_group_id)
4. 0.020 0.020 ↑ 1.0 200 1

Seq Scan on contact_group cg (cost=0.00..5.00 rows=200 width=530) (actual time=0.011..0.020 rows=200 loops=1)

5. 0.003 0.011 ↑ 42.0 1 1

Hash (cost=56.78..56.78 rows=42 width=4) (actual time=0.011..0.011 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
6. 0.002 0.008 ↑ 42.0 1 1

Bitmap Heap Scan on contact_group_contact (cost=4.61..56.78 rows=42 width=4) (actual time=0.008..0.008 rows=1 loops=1)

  • Recheck Cond: (contact_id = 72787)
  • Heap Blocks: exact=1
7. 0.006 0.006 ↑ 42.0 1 1

Bitmap Index Scan on contact_group_contact_idx (cost=0.00..4.60 rows=42 width=0) (actual time=0.006..0.006 rows=1 loops=1)

  • Index Cond: (contact_id = 72787)
8. 0.021 22.964 ↓ 4.0 169 1

Hash (cost=3,232.43..3,232.43 rows=42 width=12) (actual time=22.964..22.964 rows=169 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 16kB
9. 0.014 22.943 ↓ 4.0 169 1

Subquery Scan on cgc (cost=3,231.28..3,232.43 rows=42 width=12) (actual time=21.365..22.943 rows=169 loops=1)

10. 1.322 22.929 ↓ 4.0 169 1

GroupAggregate (cost=3,231.28..3,232.01 rows=42 width=12) (actual time=21.365..22.929 rows=169 loops=1)

  • Group Key: contact_group_contact_1.contact_group_id
11. 1.315 21.607 ↓ 197.9 8,312 1

Sort (cost=3,231.28..3,231.38 rows=42 width=8) (actual time=21.351..21.607 rows=8,312 loops=1)

  • Sort Key: contact_group_contact_1.contact_group_id
  • Sort Method: quicksort Memory: 774kB
12. 1.469 20.292 ↓ 197.9 8,312 1

Hash Join (cost=3,072.46..3,230.15 rows=42 width=8) (actual time=18.423..20.292 rows=8,312 loops=1)

  • Hash Cond: (contact_group_contact_1.contact_id = con.id)
13. 0.412 0.412 ↑ 1.0 8,371 1

Seq Scan on contact_group_contact contact_group_contact_1 (cost=0.00..135.71 rows=8,371 width=8) (actual time=0.006..0.412 rows=8,371 loops=1)

14. 7.841 18.411 ↓ 195.7 77,706 1

Hash (cost=3,067.50..3,067.50 rows=397 width=4) (actual time=18.411..18.411 rows=77,706 loops=1)

  • Buckets: 131072 (originally 1024) Batches: 1 (originally 1) Memory Usage: 3756kB
15. 10.570 10.570 ↓ 195.7 77,706 1

Seq Scan on contact con (cost=0.00..3,067.50 rows=397 width=4) (actual time=0.005..10.570 rows=77,706 loops=1)

  • Filter: (deleted_timestamp IS NULL)
  • Rows Removed by Filter: 1644
Planning time : 0.461 ms
Execution time : 23.560 ms