explain.depesz.com

PostgreSQL's explain analyze made readable

Result: SmXZ : Optimization for: Optimization for: plan #T8Yq; plan #DFJ9

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.008 11.355 ↑ 1,596.0 1 1

Sort (cost=20,938.68..20,942.67 rows=1,596 width=538) (actual time=11.355..11.355 rows=1 loops=1)

  • Sort Key: cg.name
  • Sort Method: quicksort Memory: 25kB
2. 0.002 11.347 ↑ 1,596.0 1 1

Nested Loop Left Join (cost=57.59..20,853.77 rows=1,596 width=538) (actual time=11.320..11.347 rows=1 loops=1)

3. 0.021 0.054 ↑ 42.0 1 1

Hash Semi Join (cost=57.30..63.45 rows=42 width=530) (actual time=0.028..0.054 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.009..0.020 rows=200 loops=1)

5. 0.005 0.013 ↑ 42.0 1 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
6. 0.003 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.005 0.005 ↑ 42.0 1 1

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

  • Index Cond: (contact_id = 72787)
8. 0.031 11.291 ↑ 38.0 1 1

GroupAggregate (cost=0.29..494.25 rows=38 width=12) (actual time=11.291..11.291 rows=1 loops=1)

  • Group Key: contact_group_contact_1.contact_group_id
9. 0.015 11.260 ↑ 7.0 6 1

Nested Loop (cost=0.29..493.66 rows=42 width=8) (actual time=7.498..11.260 rows=6 loops=1)

10. 0.577 0.577 ↑ 7.0 6 1

Seq Scan on contact_group_contact contact_group_contact_1 (cost=0.00..156.64 rows=42 width=8) (actual time=0.007..0.577 rows=6 loops=1)

  • Filter: (contact_group_id = cg.id)
  • Rows Removed by Filter: 8365
11. 10.668 10.668 ↑ 1.0 1 6

Index Only Scan using contact__pkey on contact con (cost=0.29..8.02 rows=1 width=4) (actual time=1.778..1.778 rows=1 loops=6)

  • Index Cond: (id = contact_group_contact_1.contact_id)
  • Heap Fetches: 6
Planning time : 0.314 ms
Execution time : 11.411 ms