explain.depesz.com

PostgreSQL's explain analyze made readable

Result: a4FD

Settings
# exclusive inclusive rows x rows loops node
1. 12.442 73.492 ↓ 2.8 692 1

Gather Merge (cost=36,825.43..36,853.90 rows=244 width=267) (actual time=68.946..73.492 rows=692 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
2. 0.986 61.050 ↓ 1.9 231 3 / 3

Sort (cost=35,825.41..35,825.71 rows=122 width=267) (actual time=61.020..61.050 rows=231 loops=3)

  • Sort Key: supplies.quantity DESC NULLS LAST, orders.deadline
  • Sort Method: quicksort Memory: 99kB
3. 0.541 60.064 ↓ 1.9 231 3 / 3

Nested Loop Left Join (cost=1,173.74..35,821.18 rows=122 width=267) (actual time=14.495..60.064 rows=231 loops=3)

4. 0.415 58.139 ↓ 1.9 231 3 / 3

Hash Left Join (cost=1,173.45..35,773.50 rows=122 width=321) (actual time=14.406..58.139 rows=231 loops=3)

  • Hash Cond: (line_items.material_id = materials.id)
5. 0.494 53.903 ↓ 1.9 231 3 / 3

Nested Loop (cost=878.34..35,478.07 rows=122 width=263) (actual time=10.388..53.903 rows=231 loops=3)

6. 48.928 52.025 ↓ 1.9 231 3 / 3

Parallel Bitmap Heap Scan on line_items (cost=877.92..34,474.66 rows=123 width=255) (actual time=10.318..52.025 rows=231 loops=3)

  • Recheck Cond: ((aasm_state)::text = 'waiting'::text)
  • Filter: ((deleted_at IS NULL) AND surface_customized AND ready_for_produce_termo AND (surface_customization_solicitation_id IS NULL))
  • Rows Removed by Filter: 14380
  • Heap Blocks: exact=6618
7. 3.097 3.097 ↑ 1.0 44,670 1 / 3

Bitmap Index Scan on index_line_items_on_aasm_state (cost=0.00..877.85 rows=46,589 width=0) (actual time=9.291..9.291 rows=44,670 loops=1)

  • Index Cond: ((aasm_state)::text = 'waiting'::text)
8. 1.384 1.384 ↑ 1.0 1 692 / 3

Index Scan using orders_pkey on orders (cost=0.42..8.16 rows=1 width=12) (actual time=0.006..0.006 rows=1 loops=692)

  • Index Cond: (id = line_items.order_id)
  • Filter: (deleted_at IS NULL)
9. 1.315 3.821 ↑ 1.0 2,484 3 / 3

Hash (cost=264.06..264.06 rows=2,484 width=58) (actual time=3.821..3.821 rows=2,484 loops=3)

  • Buckets: 4096 Batches: 1 Memory Usage: 254kB
10. 2.506 2.506 ↑ 1.0 2,484 3 / 3

Seq Scan on materials (cost=0.00..264.06 rows=2,484 width=58) (actual time=0.067..2.506 rows=2,484 loops=3)

  • Filter: (deleted_at IS NULL)
  • Rows Removed by Filter: 122
11. 1.384 1.384 ↑ 1.0 1 692 / 3

Index Scan using index_supplies_on_suppliable_type_and_suppliable_id on supplies (cost=0.29..0.38 rows=1 width=12) (actual time=0.006..0.006 rows=1 loops=692)

  • Index Cond: (((suppliable_type)::text = 'Material'::text) AND (suppliable_id = COALESCE((NULLIF((materials.supply_material -> 'fortaleza'::text), ''::text))::integer, materials.id)))
  • Filter: (inventory_centre_id = 1)
  • Rows Removed by Filter: 0
Planning time : 1.017 ms
Execution time : 73.742 ms