explain.depesz.com

PostgreSQL's explain analyze made readable

Result: a4FD

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 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. 2.958 183.150 ↓ 1.9 231 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. 1.623 180.192 ↓ 1.9 231 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. 1.245 174.417 ↓ 1.9 231 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. 1.482 161.709 ↓ 1.9 231 3

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

6. 146.784 156.075 ↓ 1.9 231 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. 9.291 9.291 ↑ 1.0 44,670 1

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. 4.152 4.152 ↑ 1.0 1 692

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. 3.945 11.463 ↑ 1.0 2,484 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. 7.518 7.518 ↑ 1.0 2,484 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. 4.152 4.152 ↑ 1.0 1 692

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