explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 8Uig

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 11,036.837 ↓ 8.5 17 1

Limit (cost=109,313.23..1,371,871.15 rows=2 width=293) (actual time=2,685.104..11,036.837 rows=17 loops=1)

2. 61.135 11,036.835 ↓ 8.5 17 1

Subquery Scan on stockcover0_ (cost=109,313.23..1,371,871.15 rows=2 width=293) (actual time=2,685.104..11,036.835 rows=17 loops=1)

  • Filter: ((stockcover0_.planned_production_date >= '2020-09-01'::date) AND (stockcover0_.planned_production_date < '2020-09-21'::date) AND (lower((stockcover0_.name_default)::text) ~~ '%%'::text) AND (lower((stockcover0_.supplier_name)::text) ~~ '%%'::text) AND (lower((stockcover0_.package_gtin)::text) ~~ '7680380960366'::text))
  • Rows Removed by Filter: 324,578
3. 847.377 10,975.700 ↓ 3.3 324,595 1

WindowAgg (cost=109,313.23..1,368,881.77 rows=99,646 width=293) (actual time=1,547.297..10,975.700 rows=324,595 loops=1)

4. 588.561 3,636.423 ↓ 3.3 324,595 1

Finalize GroupAggregate (cost=109,313.23..151,207.65 rows=99,646 width=125) (actual time=1,546.215..3,636.423 rows=324,595 loops=1)

  • Group Key: st.package_gtin, st.package_pharmacode, st.name_default, st.dosage_id, st.supplier_name, st.package_size, st.production_date, st.planned_production_date
5. 552.222 3,047.862 ↓ 2.1 423,715 1

Gather Merge (cost=109,313.23..144,979.77 rows=199,292 width=125) (actual time=1,546.175..3,047.862 rows=423,715 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
6. 345.059 2,495.640 ↓ 1.4 141,238 3 / 3

Partial GroupAggregate (cost=108,313.21..120,976.51 rows=99,646 width=125) (actual time=1,514.398..2,495.640 rows=141,238 loops=3)

  • Group Key: st.package_gtin, st.package_pharmacode, st.name_default, st.dosage_id, st.supplier_name, st.package_size, st.production_date, st.planned_production_date
7. 1,963.734 2,150.581 ↑ 1.2 332,152 3 / 3

Sort (cost=108,313.21..109,351.18 rows=415,190 width=103) (actual time=1,514.369..2,150.581 rows=332,152 loops=3)

  • Sort Key: st.package_gtin, st.package_pharmacode, st.name_default, st.dosage_id, st.supplier_name, st.package_size, st.production_date, st.planned_production_date
  • Sort Method: external merge Disk: 38,672kB
8. 186.847 186.847 ↑ 1.2 332,152 3 / 3

Parallel Seq Scan on stock_need st (cost=0.00..46,860.90 rows=415,190 width=103) (actual time=0.044..186.847 rows=332,152 loops=3)

9.          

SubPlan (for WindowAgg)

10. 0.000 1,298.380 ↑ 1.0 1 324,595

Aggregate (cost=2.42..2.43 rows=1 width=32) (actual time=0.004..0.004 rows=1 loops=324,595)

11. 320.374 1,298.380 ↓ 0.0 0 324,595

Nested Loop (cost=0.00..2.41 rows=1 width=32) (actual time=0.004..0.004 rows=0 loops=324,595)

  • Join Filter: (sl.location_settings_id = ls.id)
  • Rows Removed by Join Filter: 0
12. 973.785 973.785 ↓ 0.0 0 324,595

Seq Scan on stock_location sl (cost=0.00..1.24 rows=1 width=64) (actual time=0.003..0.003 rows=0 loops=324,595)

  • Filter: ((gtin)::text = (st.package_gtin)::text)
  • Rows Removed by Filter: 19
13. 4.221 4.221 ↓ 3.0 3 4,221

Seq Scan on stock_location_settings ls (cost=0.00..1.16 rows=1 width=32) (actual time=0.001..0.001 rows=3 loops=4,221)

  • Filter: ((aggregation_type)::text = 'PACKAGE'::text)
  • Rows Removed by Filter: 1
14. 0.000 1,298.380 ↑ 1.0 1 324,595

Aggregate (cost=2.42..2.43 rows=1 width=32) (actual time=0.004..0.004 rows=1 loops=324,595)

15. 316.153 1,298.380 ↓ 0.0 0 324,595

Nested Loop (cost=0.00..2.41 rows=1 width=32) (actual time=0.004..0.004 rows=0 loops=324,595)

  • Join Filter: (sl_1.location_settings_id = ls_1.id)
  • Rows Removed by Join Filter: 0
16. 973.785 973.785 ↓ 0.0 0 324,595

Seq Scan on stock_location sl_1 (cost=0.00..1.24 rows=1 width=64) (actual time=0.003..0.003 rows=0 loops=324,595)

  • Filter: ((gtin)::text = (st.package_gtin)::text)
  • Rows Removed by Filter: 19
17. 8.442 8.442 ↑ 1.0 1 4,221

Seq Scan on stock_location_settings ls_1 (cost=0.00..1.16 rows=1 width=32) (actual time=0.002..0.002 rows=1 loops=4,221)

  • Filter: ((aggregation_type)::text = 'DOSE'::text)
  • Rows Removed by Filter: 11
18. 324.595 1,298.380 ↑ 1.0 1 324,595

Aggregate (cost=2.42..2.43 rows=1 width=32) (actual time=0.004..0.004 rows=1 loops=324,595)

19. 0.000 973.785 ↓ 0.0 0 324,595

Nested Loop (cost=0.00..2.41 rows=1 width=32) (actual time=0.003..0.003 rows=0 loops=324,595)

  • Join Filter: (sl_2.location_settings_id = ls_2.id)
  • Rows Removed by Join Filter: 0
20. 973.785 973.785 ↓ 0.0 0 324,595

Seq Scan on stock_location sl_2 (cost=0.00..1.24 rows=1 width=64) (actual time=0.003..0.003 rows=0 loops=324,595)

  • Filter: ((gtin)::text = (st.package_gtin)::text)
  • Rows Removed by Filter: 19
21. 12.663 12.663 ↑ 1.0 1 4,221

Seq Scan on stock_location_settings ls_2 (cost=0.00..1.16 rows=1 width=32) (actual time=0.001..0.003 rows=1 loops=4,221)

  • Filter: ((aggregation_type)::text = 'CANISTER'::text)
  • Rows Removed by Filter: 12
22. 324.595 1,298.380 ↑ 1.0 1 324,595

Aggregate (cost=2.42..2.43 rows=1 width=32) (actual time=0.004..0.004 rows=1 loops=324,595)

23. 0.000 973.785 ↓ 0.0 0 324,595

Nested Loop (cost=0.00..2.41 rows=1 width=32) (actual time=0.003..0.003 rows=0 loops=324,595)

  • Join Filter: (sl_3.location_settings_id = ls_3.id)
  • Rows Removed by Join Filter: 0
24. 973.785 973.785 ↓ 0.0 0 324,595

Seq Scan on stock_location sl_3 (cost=0.00..1.24 rows=1 width=64) (actual time=0.003..0.003 rows=0 loops=324,595)

  • Filter: ((gtin)::text = (st.package_gtin)::text)
  • Rows Removed by Filter: 19
25. 12.663 12.663 ↓ 2.0 2 4,221

Seq Scan on stock_location_settings ls_3 (cost=0.00..1.16 rows=1 width=32) (actual time=0.002..0.003 rows=2 loops=4,221)

  • Filter: ((aggregation_type)::text = 'PRODUCTION'::text)
  • Rows Removed by Filter: 11
26. 324.595 1,298.380 ↑ 1.0 1 324,595

Aggregate (cost=2.49..2.50 rows=1 width=32) (actual time=0.004..0.004 rows=1 loops=324,595)

27. 0.000 973.785 ↓ 0.0 0 324,595

Nested Loop (cost=0.00..2.48 rows=1 width=32) (actual time=0.003..0.003 rows=0 loops=324,595)

  • Join Filter: (sl_4.location_settings_id = ls_4.id)
  • Rows Removed by Join Filter: 0
28. 973.785 973.785 ↓ 0.0 0 324,595

Seq Scan on stock_location sl_4 (cost=0.00..1.24 rows=1 width=64) (actual time=0.003..0.003 rows=0 loops=324,595)

  • Filter: ((gtin)::text = (st.package_gtin)::text)
  • Rows Removed by Filter: 19
29. 4.221 4.221 ↑ 1.3 3 4,221

Seq Scan on stock_location_settings ls_4 (cost=0.00..1.20 rows=4 width=32) (actual time=0.001..0.001 rows=3 loops=4,221)

  • Filter: ((aggregation_type)::text = ANY ('{PACKAGE,DOSE,CANISTER,PRODUCTION}'::text[]))
Planning time : 0.773 ms