explain.depesz.com

PostgreSQL's explain analyze made readable

Result: msSf : Optimization for: Optimization for: Optimization for: Optimization for: plan #BUBt; plan #Capt; plan #WSGb; plan #7EhF

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 178.693 773.620 ↓ 11.2 10,632 1

HashAggregate (cost=2,887.69..2,897.19 rows=950 width=35) (actual time=702.679..773.620 rows=10,632 loops=1)

  • Group Key: spree_suppliers.id, spree_stock_locations.id, compositions.name, spree_variants.id
2. 206.039 594.927 ↓ 11.2 10,632 1

Hash Join (cost=6.88..2,875.82 rows=950 width=31) (actual time=2.732..594.927 rows=10,632 loops=1)

  • Hash Cond: (spree_stock_items.stock_location_id = spree_stock_locations.id)
3. 226.843 386.376 ↓ 1.8 15,896 1

Nested Loop (cost=1.28..2,826.91 rows=9,083 width=27) (actual time=0.169..386.376 rows=15,896 loops=1)

4. 5.459 18.421 ↓ 1.0 248 1

Nested Loop (cost=0.84..2,186.39 rows=246 width=23) (actual time=0.118..18.421 rows=248 loops=1)

5. 5.524 10.234 ↓ 1.0 248 1

Nested Loop (cost=0.42..2,072.84 rows=246 width=12) (actual time=0.069..10.234 rows=248 loops=1)

6. 1.982 1.982 ↑ 1.0 248 1

Values Scan on "*VALUES*" (cost=0.00..3.10 rows=248 width=4) (actual time=0.013..1.982 rows=248 loops=1)

7. 2.728 2.728 ↑ 1.0 1 248

Index Scan using spree_variants_pkey on spree_variants (cost=0.42..8.35 rows=1 width=8) (actual time=0.011..0.011 rows=1 loops=248)

  • Index Cond: (id = "*VALUES*".column1)
  • Filter: (deleted_at IS NULL)
8. 2.728 2.728 ↑ 1.0 1 248

Index Scan using compositions_pkey on compositions (cost=0.42..0.46 rows=1 width=15) (actual time=0.011..0.011 rows=1 loops=248)

  • Index Cond: (id = spree_variants.composition_id)
9. 141.112 141.112 ↓ 1.7 64 248

Index Scan using index_spree_stock_items_on_variant_id_and_stock_location_id on spree_stock_items (cost=0.44..2.23 rows=37 width=12) (actual time=0.012..0.569 rows=64 loops=248)

  • Index Cond: (variant_id = spree_variants.id)
10. 0.431 2.512 ↓ 4.4 48 1

Hash (cost=5.46..5.46 rows=11 width=8) (actual time=2.506..2.512 rows=48 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
11. 0.908 2.081 ↓ 4.4 48 1

Hash Join (cost=1.22..5.46 rows=11 width=8) (actual time=0.548..2.081 rows=48 loops=1)

  • Hash Cond: (spree_stock_locations.supplier_id = spree_suppliers.id)
12. 0.681 0.681 ↓ 1.2 56 1

Seq Scan on spree_stock_locations (cost=0.00..4.08 rows=48 width=8) (actual time=0.021..0.681 rows=56 loops=1)

  • Filter: active
  • Rows Removed by Filter: 52
13. 0.296 0.492 ↓ 2.5 10 1

Hash (cost=1.17..1.17 rows=4 width=4) (actual time=0.486..0.492 rows=10 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
14. 0.196 0.196 ↓ 2.5 10 1

Seq Scan on spree_suppliers (cost=0.00..1.17 rows=4 width=4) (actual time=0.015..0.196 rows=10 loops=1)

  • Filter: (show_stock AND active)
  • Rows Removed by Filter: 7