explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Vs6V

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Group (cost=74,510.56..75,989.28 rows=6,204 width=153) (actual rows= loops=)

  • Group Key: stock_batches.id
2. 0.000 0.000 ↓ 0.0

Gather Merge (cost=74,510.56..75,958.26 rows=12,408 width=153) (actual rows= loops=)

  • Workers Planned: 2
3. 0.000 0.000 ↓ 0.0

Sort (cost=73,510.54..73,526.05 rows=6,204 width=153) (actual rows= loops=)

  • Sort Key: stock_batches.id
4. 0.000 0.000 ↓ 0.0

Partial HashAggregate (cost=73,057.68..73,119.72 rows=6,204 width=153) (actual rows= loops=)

  • Group Key: stock_batches.id
5. 0.000 0.000 ↓ 0.0

Nested Loop (cost=3,327.12..72,743.84 rows=125,535 width=153) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Nested Loop (cost=3,326.68..14,379.70 rows=6,670 width=161) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on stock_batches (cost=3,326.26..8,340.80 rows=2,585 width=153) (actual rows= loops=)

  • Filter: ((discarded_at IS NULL) AND ((NOT (hashed SubPlan 1)) OR forced_not_for_put_away) AND (pullout_at <= '2020-07-06 23:55:05.911534'::timestamp without time zone) AND (expires_at >= '2020-07-06 23:55:05.911534'::timestamp without time zone))
8.          

SubPlan (for Parallel Seq Scan)

9. 0.000 0.000 ↓ 0.0

Nested Loop (cost=3,297.61..3,326.11 rows=60 width=8) (actual rows= loops=)

10. 0.000 0.000 ↓ 0.0

HashAggregate (cost=3,297.19..3,297.79 rows=60 width=8) (actual rows= loops=)

  • Group Key: stock_distributions_1.stock_batch_id
11. 0.000 0.000 ↓ 0.0

Nested Loop Anti Join (cost=1.27..3,297.04 rows=60 width=8) (actual rows= loops=)

12. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.84..3,250.96 rows=103 width=16) (actual rows= loops=)

13. 0.000 0.000 ↓ 0.0

Index Scan using index_stock_locations_on_kind on stock_locations (cost=0.42..5.16 rows=98 width=8) (actual rows= loops=)

  • Index Cond: ((kind)::text = 'Put-Away'::text)
14. 0.000 0.000 ↓ 0.0

Index Scan using index_stock_distributions_on_stock_location_id on stock_distributions stock_distributions_1 (cost=0.42..32.72 rows=40 width=24) (actual rows= loops=)

  • Index Cond: (stock_location_id = stock_locations.id)
  • Filter: (discarded_at IS NULL)
15. 0.000 0.000 ↓ 0.0

Index Only Scan using index_stock_transfers_on_source_stock_distribution_id on stock_transfers (cost=0.42..0.45 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (source_stock_distribution_id = stock_distributions_1.id)
16. 0.000 0.000 ↓ 0.0

Index Only Scan using stock_batches_pkey on stock_batches stock_batches_1 (cost=0.42..0.47 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = stock_distributions_1.stock_batch_id)
17. 0.000 0.000 ↓ 0.0

Index Scan using index_stock_distributions_on_stock_batch_id on stock_distributions (cost=0.42..2.30 rows=4 width=16) (actual rows= loops=)

  • Index Cond: (stock_batch_id = stock_batches.id)
  • Filter: (discarded_at IS NULL)
18. 0.000 0.000 ↓ 0.0

Index Scan using index_stock_movements_on_stock_distribution_id on stock_movements (cost=0.43..5.99 rows=276 width=8) (actual rows= loops=)

  • Index Cond: (stock_distribution_id = stock_distributions.id)
  • Filter: (discarded_at IS NULL)