explain.depesz.com

PostgreSQL's explain analyze made readable

Result: PUJo

Settings
# exclusive inclusive rows x rows loops node
1. 274.521 1,866.514 ↓ 11.7 68,826 1

Sort (cost=599,047.46..599,062.17 rows=5,883 width=280) (actual time=1,854.296..1,866.514 rows=68,826 loops=1)

  • Sort Key: millfeedingtypelocalized.name, lot.id, (avg((((((date_trunc('day'::text, grainorder.orderdate))::date - (date_trunc('day'::text, lot.arrivaldate))::date) + lot.age) + ((date_trunc('day'::text, lot.arrivaldate))::date - (date_trunc('day'::text, timezone('Canada/Eastern'::text, lot.arrivaldate)))::date)))))
  • Sort Method: external merge Disk: 12296kB
2.          

CTE filterlot

3. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=9,093.05..9,109.43 rows=1,638 width=76) (never executed)

  • Group Key: lot_1.id, lot_1.periodid, lot_1.hatcheryid, lot_1.millid, lot_1.slaughterhouseid, lot_1.slaughtermillid, lot_1.pickerteamid, lot_1.transporterid, lot_1.productiontypeid, lot_1.categoryid, lot_1.breedid, lot_1.ownerid, lot_1.ownernumberid, lot_1.healthstatusid, lot_1.pigflowid, lot_1.hatcheryperiodid, lot_1.vaccinationprogramtemplateid, lot_1.parentlotid, lot_1.malecategoryid
4. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=561.17..8,967.18 rows=2,650 width=76) (never executed)

  • Hash Cond: (lot_1.productiontypeid = productiontype.id)
5. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=559.92..8,956.29 rows=2,650 width=76) (never executed)

  • Hash Cond: (lotfloor_1.lotid = lot_1.id)
  • Join Filter: ((lot_1.createdby = 34) OR (building_1.id = ANY ('{2956,3,2958,7,2884,2885,12,2771,2864,2865,2866,2867,2828,2829,2808,2809,2797,2853,2761,2762,2770,2822,2823,2821,2903,2715,2716,2730,2731,2732,2719,2789,2790,2707,2708,2709,2757,2758,2811,2812,2738,2739,2684,2810,2913,2914,2791,2807,2710,2854,2855,2726,2714,2869,2870,2871,2894,2895,2743,2786,2792,2793,2845,2846,2782,2702,2703,2704,2847,2896,2897,2898,2768,2763,2764,2765,2766,2767,2698,2747,2748,2749,2750,2751,2752,2753,2754,2755,2779,2780,2804,2736,2893,2830,2831,2832,2833,2834,2835,2836,2837,2844,2729,2824,2820,2900,2901,2902,2693,2769,2685,2827,2826,2740,2741,2742,2825,2803,2772,2773,2774,2775,2776,2687,2735,2711,2688,2777,2778,2850,2851,2746,2880,2881,2717,2718,2712,2713,2720,2721,2722,2723,2805,2806,2899,2838,2839,2882,2891,2892,2744,2745,2781,2886,2887,2888,2889,2890,2800,2691,2801,2794,2759,2868,2796,2795,2813,2814,2815,2904,2905,2699,2700,2915,2916,2917,2918,2919,2920,2921,2922,2760,2848,2849,2923,2816,2883,2798,2799,2802,2842,2843,2690,2686,2840,2841,2876,2877,2878,2879,2701,2856,2857,2858,2859,2860,2861,2862,2863,2689,2817,2818,2733,2734,2737,2694,2695,2692,2727,2696,2697,2728,2705,2706,2906,2907,2908,2909,2912,2910,2911,2784,2785,2872,2873,2874,2875,2852,2724,2725,2783,2819,2756,2787,2788,2960,2961,2962,2963,2932,2933,2934,2935,2936,2937,2942,2943,2944,2945,2946,2938,2939,2940,2941,2947,2948,2952,2951,2950,2953,2959,2957,2954,2955,2964,2967,2965,3004,2969,2970,2971,2966,2949,3042,3022,3024,3025,3030,3014,3013,3015,3033,3011,3012,3010,3017,3009,3163,3125,3126,3127,3128,3129,3119,3120,3079,3130,3075,3076,3040,3038,3039,3037,3113,3114,3078,3077,3121,3122,3041,3080,3081,3082,3083,3084,3123,3028,3036,3118,3124,3681,3684,3685,3686,3687,3688,3689,3690,3691,3692,3693,3694,3695,3696,3697,3698,3699,3700,3701,3702,3703,3704,3705,3706,3707,3708,3709,3710,3711,3712,3713,3714,3715,3716,3717,3718,3719,3720,3721,3722,3723,3724,3725,3726,3727,3728,3729,3730,3731,3732,3733,3734,3735,3736,3737,3738,3739,3740,3741,3742,3743,3744,3745,3746,3747,3748,3749,3750,3751,3752,3753,3754,3755,3756,3757,3758,3759,3760,3761,3762,3763,3764,3765,3766,3767,3768,3769,3773,3775,3771,3774,3772,3776,3777,3778,3779}'::integer[])))
6. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=215.67..8,594.97 rows=6,087 width=8) (never executed)

  • Hash Cond: (floor_1.id = lotfloor_1.floorid)
7. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=18.26..8,260.17 rows=1,275 width=8) (never executed)

  • Join Filter: ((silo_1.floorid = floor_1.id) OR (silo_1.buildingid = building_1.id))
8. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=18.26..48.79 rows=567 width=8) (never executed)

  • Join Filter: ((accesspoint.siteid = building_1.parentid) OR (accesspoint.buildingid = building_1.id) OR (accesspoint.floorid = floor_1.id))
9. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=18.26..36.44 rows=567 width=12) (never executed)

  • Hash Cond: (floor_1.parentid = building_1.id)
10. 0.000 0.000 ↓ 0.0 0

Seq Scan on floor floor_1 (cost=0.00..16.67 rows=567 width=8) (never executed)

11. 0.000 0.000 ↓ 0.0 0

Hash (cost=13.67..13.67 rows=367 width=8) (never executed)

12. 0.000 0.000 ↓ 0.0 0

Seq Scan on building building_1 (cost=0.00..13.67 rows=367 width=8) (never executed)

13. 0.000 0.000 ↓ 0.0 0

Materialize (cost=0.00..1.01 rows=1 width=12) (never executed)

14. 0.000 0.000 ↓ 0.0 0

Seq Scan on accesspoint (cost=0.00..1.01 rows=1 width=12) (never executed)

15. 0.000 0.000 ↓ 0.0 0

Materialize (cost=0.00..27.38 rows=825 width=8) (never executed)

16. 0.000 0.000 ↓ 0.0 0

Seq Scan on silo silo_1 (cost=0.00..23.25 rows=825 width=8) (never executed)

17. 0.000 0.000 ↓ 0.0 0

Hash (cost=163.56..163.56 rows=2,708 width=8) (never executed)

18. 0.000 0.000 ↓ 0.0 0

Seq Scan on lotfloor lotfloor_1 (cost=0.00..163.56 rows=2,708 width=8) (never executed)

  • Filter: ((discriminator)::text = 'prod'::text)
19. 0.000 0.000 ↓ 0.0 0

Hash (cost=323.78..323.78 rows=1,638 width=80) (never executed)

20. 0.000 0.000 ↓ 0.0 0

Seq Scan on lot lot_1 (cost=0.00..323.78 rows=1,638 width=80) (never executed)

  • Filter: (((status)::text = ANY ('{created,draft,published,proddraft,preproduction,production,postproduction,split,reopened,closed}'::text[])) AND (productiontypeid = ANY ('{84,87,82,89,86,83,80,13,81,88,85}'::integer[])))
21. 0.000 0.000 ↓ 0.0 0

Hash (cost=1.11..1.11 rows=11 width=4) (never executed)

22. 0.000 0.000 ↓ 0.0 0

Seq Scan on productiontype (cost=0.00..1.11 rows=11 width=4) (never executed)

23.          

CTE filtermillfeedingtype

24. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=34.57..39.03 rows=446 width=16) (never executed)

  • Group Key: millfeedingtype_3.id, millfeedingtype_3.millid, millfeedingtype_3.feedtextureid, millfeedingtype_3.feedtypeid
25. 0.000 0.000 ↓ 0.0 0

Hash Left Join (cost=7.54..30.11 rows=446 width=16) (never executed)

  • Hash Cond: (feedtype.id = feedtypelocalized.feedtypeid)
26. 0.000 0.000 ↓ 0.0 0

Hash Left Join (cost=3.92..24.80 rows=446 width=20) (never executed)

  • Hash Cond: (millfeedingtype_3.id = feedtype.id)
27. 0.000 0.000 ↓ 0.0 0

Seq Scan on millfeedingtype millfeedingtype_3 (cost=0.00..19.69 rows=446 width=16) (never executed)

  • Filter: (lower((code)::text) ~~ '%'::text)
28. 0.000 0.000 ↓ 0.0 0

Hash (cost=2.30..2.30 rows=130 width=4) (never executed)

29. 0.000 0.000 ↓ 0.0 0

Seq Scan on feedtype (cost=0.00..2.30 rows=130 width=4) (never executed)

30. 0.000 0.000 ↓ 0.0 0

Hash (cost=3.60..3.60 rows=1 width=4) (never executed)

31. 0.000 0.000 ↓ 0.0 0

Seq Scan on feedtypelocalized (cost=0.00..3.60 rows=1 width=4) (never executed)

  • Filter: ((locale)::text = 'en'::text)
32. 68.875 1,591.993 ↓ 11.7 68,826 1

GroupAggregate (cost=588,824.69..589,530.65 rows=5,883 width=280) (actual time=1,502.644..1,591.993 rows=68,826 loops=1)

  • Group Key: lot.id, (((((date_trunc('day'::text, grainorder.orderdate))::date - (date_trunc('day'::text, lot.arrivaldate))::date) + lot.age) + ((date_trunc('day'::text, lot.arrivaldate))::date - (date_trunc('day'::text, timezone('Canada/Eastern'::text, lot.arrivaldate)))::date))), ((((grainorder.id)::character varying)::text || 'grainorder'::text)), millfeedingtypelocalized.name, (CASE WHEN (millfeedingtype.code IS NOT NULL) THEN supplier.name ELSE ''::character varying END), millfeedingtype.code, deliveryfeedtype.name, deliveryfeedcode.code, deliveryname.name, NULL::text, (CASE WHEN grainorder.urgent THEN '1'::numeric WHEN (NOT grainorder.urgent) THEN '0'::numeric ELSE NULL::numeric END)
33. 130.045 1,523.118 ↓ 11.7 68,826 1

Sort (cost=588,824.69..588,839.40 rows=5,883 width=260) (actual time=1,502.626..1,523.118 rows=68,826 loops=1)

  • Sort Key: lot.id, (((((date_trunc('day'::text, grainorder.orderdate))::date - (date_trunc('day'::text, lot.arrivaldate))::date) + lot.age) + ((date_trunc('day'::text, lot.arrivaldate))::date - (date_trunc('day'::text, timezone('Canada/Eastern'::text, lot.arrivaldate)))::date))), ((((grainorder.id)::character varying)::text || 'grainorder'::text)), millfeedingtypelocalized.name, (CASE WHEN (millfeedingtype.code IS NOT NULL) THEN supplier.name ELSE ''::character varying END), millfeedingtype.code, deliveryfeedtype.name, deliveryfeedcode.code, deliveryname.name, (CASE WHEN grainorder.urgent THEN '1'::numeric WHEN (NOT grainorder.urgent) THEN '0'::numeric ELSE NULL::numeric END)
  • Sort Method: external merge Disk: 12800kB
34. 136.434 1,393.073 ↓ 11.7 68,826 1

Hash Left Join (cost=587,660.28..588,456.35 rows=5,883 width=260) (actual time=1,147.011..1,393.073 rows=68,826 loops=1)

  • Hash Cond: (lot.id = lotfarmer.lotid)
  • Filter: ((lotfarmer.assignedfarmersexpression IS NULL) OR lotfarmer.assignedfarmersexpression)
  • Rows Removed by Filter: 20
35. 15.889 1,252.619 ↓ 5.9 68,846 1

Hash Left Join (cost=584,844.32..585,374.29 rows=11,707 width=153) (actual time=1,142.826..1,252.619 rows=68,846 loops=1)

  • Hash Cond: (deliveryfeedcode.millid = deliveryname.id)
36. 15.352 1,236.591 ↓ 5.9 68,846 1

Hash Left Join (cost=584,822.38..585,321.36 rows=11,707 width=137) (actual time=1,142.673..1,236.591 rows=68,846 loops=1)

  • Hash Cond: (millfeedingtype.millid = supplier.id)
37. 16.296 1,221.072 ↓ 5.9 68,846 1

Hash Left Join (cost=584,800.43..585,268.44 rows=11,707 width=121) (actual time=1,142.494..1,221.072 rows=68,846 loops=1)

  • Hash Cond: (grainorder.millfeedingtypeid = millfeedingtypelocalized.millfeedingtypeid)
38. 43.616 1,204.552 ↓ 5.9 68,846 1

Hash Join (cost=584,768.08..585,205.06 rows=11,707 width=92) (actual time=1,142.236..1,204.552 rows=68,846 loops=1)

  • Hash Cond: ("*SELECT* 1".grainorderid = grainorder.id)
39. 67.407 836.582 ↓ 5.2 70,222 1

HashAggregate (cost=430,953.34..431,088.04 rows=13,470 width=8) (actual time=817.504..836.582 rows=70,222 loops=1)

  • Group Key: "*SELECT* 1".lotid, "*SELECT* 1".grainorderid
40. 9.908 769.175 ↓ 1.0 140,444 1

Append (cost=16,095.83..428,932.81 rows=134,702 width=76) (actual time=168.977..769.175 rows=140,444 loops=1)

41. 9.697 402.442 ↓ 1.0 70,222 1

Subquery Scan on *SELECT* 1 (cost=16,095.83..216,596.39 rows=67,351 width=76) (actual time=168.975..402.442 rows=70,222 loops=1)

42. 34.540 392.745 ↓ 1.0 70,222 1

Finalize GroupAggregate (cost=16,095.83..215,754.50 rows=67,351 width=52) (actual time=168.972..392.745 rows=70,222 loops=1)

  • Group Key: grainorder_1.id, (NULL::numeric)
43. 0.000 358.205 ↓ 1.0 70,222 1

Gather Merge (cost=16,095.83..214,239.11 rows=67,351 width=52) (actual time=168.929..358.205 rows=70,222 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
44. 31.536 616.320 ↑ 1.9 35,111 2

Partial GroupAggregate (cost=15,095.82..205,662.11 rows=67,351 width=52) (actual time=117.274..308.160 rows=35,111 loops=2)

  • Group Key: grainorder_1.id, NULL::numeric
45. 74.148 584.784 ↑ 2.3 35,122 2

Nested Loop (cost=15,095.82..204,000.01 rows=79,087 width=48) (actual time=117.256..292.392 rows=35,122 loops=2)

46. 28.384 299.790 ↑ 1.1 35,141 2

Merge Left Join (cost=15,095.26..20,906.41 rows=39,618 width=24) (actual time=117.153..149.895 rows=35,141 loops=2)

  • Merge Cond: (grainorder_1.id = grainingredient.grainorderid)
47. 36.134 36.134 ↑ 1.1 35,130 2

Parallel Index Scan using pk_grainorder on grainorder grainorder_1 (cost=0.29..5,636.71 rows=39,618 width=16) (actual time=0.036..18.067 rows=35,130 loops=2)

48. 4.470 235.272 ↓ 1.0 7,410 2

Sort (cost=15,094.97..15,113.12 rows=7,259 width=12) (actual time=117.111..117.636 rows=7,410 loops=2)

  • Sort Key: grainingredient.grainorderid
  • Sort Method: quicksort Memory: 542kB
49. 5.364 230.802 ↓ 1.0 7,451 2

Hash Left Join (cost=13,456.82..14,629.47 rows=7,259 width=12) (actual time=112.257..115.401 rows=7,451 loops=2)

  • Hash Cond: (grainingredient.economiclogid = economiclog.id)
50. 3.318 3.318 ↓ 1.0 7,451 2

Seq Scan on grainingredient (cost=0.00..199.59 rows=7,259 width=16) (actual time=0.031..1.659 rows=7,451 loops=2)

51. 92.410 222.120 ↓ 1.0 227,183 2

Hash (cost=9,753.81..9,753.81 rows=225,681 width=8) (actual time=111.060..111.060 rows=227,183 loops=2)

  • Buckets: 262144 Batches: 2 Memory Usage: 6489kB
52. 129.710 129.710 ↓ 1.0 227,183 2

Seq Scan on economiclog (cost=0.00..9,753.81 rows=225,681 width=8) (actual time=0.022..64.855 rows=227,183 loops=2)

53. 70.282 210.846 ↑ 2.0 1 70,282

Bitmap Heap Scan on millfeedingtype millfeedingtype_1 (cost=0.56..4.60 rows=2 width=4) (actual time=0.003..0.003 rows=1 loops=70,282)

  • Recheck Cond: ((id = grainorder_1.millfeedingtypeid) OR (id = grainorder_1.deliverymillfeedingtypeid))
  • Filter: (lower((code)::text) ~~ '%'::text)
  • Heap Blocks: exact=21188
54. 0.000 140.564 ↓ 0.0 0 70,282

BitmapOr (cost=0.56..0.56 rows=2 width=0) (actual time=0.002..0.002 rows=0 loops=70,282)

55. 70.282 70.282 ↑ 1.0 1 70,282

Bitmap Index Scan on pk_millfeedingtype (cost=0.00..0.28 rows=1 width=0) (actual time=0.001..0.001 rows=1 loops=70,282)

  • Index Cond: (id = grainorder_1.millfeedingtypeid)
56. 70.282 70.282 ↑ 1.0 1 70,282

Bitmap Index Scan on pk_millfeedingtype (cost=0.00..0.28 rows=1 width=0) (actual time=0.001..0.001 rows=1 loops=70,282)

  • Index Cond: (id = grainorder_1.deliverymillfeedingtypeid)
57. 6.520 356.825 ↓ 1.0 70,222 1

Subquery Scan on *SELECT* 2 (cost=1,001.28..212,336.42 rows=67,351 width=76) (actual time=19.654..356.825 rows=70,222 loops=1)

58. 25.256 350.305 ↓ 1.0 70,222 1

Finalize GroupAggregate (cost=1,001.28..211,662.91 rows=67,351 width=80) (actual time=19.651..350.305 rows=70,222 loops=1)

  • Group Key: grainorder_2.id, (NULL::numeric)
59. 0.000 325.049 ↓ 1.0 70,222 1

Gather Merge (cost=1,001.28..210,315.89 rows=67,351 width=48) (actual time=19.583..325.049 rows=70,222 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
60. 33.712 585.834 ↑ 1.9 35,111 2

Partial GroupAggregate (cost=1.27..201,738.89 rows=67,351 width=48) (actual time=0.536..292.917 rows=35,111 loops=2)

  • Group Key: grainorder_2.id, NULL::numeric
61. 33.596 552.122 ↑ 7.5 35,111 2

Merge Left Join (cost=1.27..198,415.32 rows=265,006 width=44) (actual time=0.516..276.061 rows=35,111 loops=2)

  • Merge Cond: (grainorder_2.id = economiclog_1.grainorderid)
62. 67.026 388.458 ↑ 2.3 35,111 2

Nested Loop (cost=0.85..188,730.32 rows=79,087 width=8) (actual time=0.184..194.229 rows=35,111 loops=2)

63. 40.388 40.388 ↑ 1.1 35,130 2

Parallel Index Scan using pk_grainorder on grainorder grainorder_2 (cost=0.29..5,636.71 rows=39,618 width=16) (actual time=0.035..20.194 rows=35,130 loops=2)

64. 70.261 281.044 ↑ 2.0 1 70,261

Bitmap Heap Scan on millfeedingtype millfeedingtype_2 (cost=0.56..4.60 rows=2 width=4) (actual time=0.004..0.004 rows=1 loops=70,261)

  • Recheck Cond: ((id = grainorder_2.millfeedingtypeid) OR (id = grainorder_2.deliverymillfeedingtypeid))
  • Filter: (lower((code)::text) ~~ '%'::text)
  • Heap Blocks: exact=34364
65. 70.261 210.783 ↓ 0.0 0 70,261

BitmapOr (cost=0.56..0.56 rows=2 width=0) (actual time=0.003..0.003 rows=0 loops=70,261)

66. 70.261 70.261 ↑ 1.0 1 70,261

Bitmap Index Scan on pk_millfeedingtype (cost=0.00..0.28 rows=1 width=0) (actual time=0.001..0.001 rows=1 loops=70,261)

  • Index Cond: (id = grainorder_2.millfeedingtypeid)
67. 70.261 70.261 ↑ 1.0 1 70,261

Bitmap Index Scan on pk_millfeedingtype (cost=0.00..0.28 rows=1 width=0) (actual time=0.001..0.001 rows=1 loops=70,261)

  • Index Cond: (id = grainorder_2.deliverymillfeedingtypeid)
68. 130.068 130.068 ↑ 3.2 70,026 2

Index Scan using economiclog_grainorderid_idx on economiclog economiclog_1 (cost=0.42..28,871.27 rows=225,681 width=12) (actual time=0.059..65.034 rows=70,026 loops=2)

69. 35.679 324.354 ↓ 1.2 68,851 1

Hash (cost=153,083.07..153,083.07 rows=58,534 width=92) (actual time=324.354..324.354 rows=68,851 loops=1)

  • Buckets: 131072 (originally 65536) Batches: 2 (originally 1) Memory Usage: 8405kB
70. 29.235 288.675 ↓ 1.2 68,851 1

Gather (cost=1,698.97..153,083.07 rows=58,534 width=92) (actual time=14.235..288.675 rows=68,851 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
71. 11.478 259.440 ↑ 1.0 34,426 2

Hash Left Join (cost=698.97..146,229.67 rows=34,432 width=92) (actual time=11.519..259.440 rows=34,426 loops=2)

  • Hash Cond: (grainorder.deliverymillfeedingtypeid = deliveryfeedtype.millfeedingtypeid)
72. 11.201 247.451 ↑ 1.0 34,426 2

Hash Left Join (cost=666.62..146,106.05 rows=34,432 width=63) (actual time=10.992..247.451 rows=34,426 loops=2)

  • Hash Cond: (grainorder.deliverymillfeedingtypeid = deliveryfeedcode.id)
73. 145.073 235.937 ↑ 1.0 34,426 2

Nested Loop Left Join (cost=643.58..145,991.78 rows=34,432 width=50) (actual time=10.665..235.937 rows=34,426 loops=2)

  • Filter: ((lot.createdby = 34) OR (building.id = ANY ('{2956,3,2958,7,2884,2885,12,2771,2864,2865,2866,2867,2828,2829,2808,2809,2797,2853,2761,2762,2770,2822,2823,2821,2903,2715,2716,2730,2731,2732,2719,2789,2790,2707,2708,2709,2757,2758,2811,2812,2738,2739,2684,2810,2913,2914,2791,2807,2710,2854,2855,2726,2714,2869,2870,2871,2894,2895,2743,2786,2792,2793,2845,2846,2782,2702,2703,2704,2847,2896,2897,2898,2768,2763,2764,2765,2766,2767,2698,2747,2748,2749,2750,2751,2752,2753,2754,2755,2779,2780,2804,2736,2893,2830,2831,2832,2833,2834,2835,2836,2837,2844,2729,2824,2820,2900,2901,2902,2693,2769,2685,2827,2826,2740,2741,2742,2825,2803,2772,2773,2774,2775,2776,2687,2735,2711,2688,2777,2778,2850,2851,2746,2880,2881,2717,2718,2712,2713,2720,2721,2722,2723,2805,2806,2899,2838,2839,2882,2891,2892,2744,2745,2781,2886,2887,2888,2889,2890,2800,2691,2801,2794,2759,2868,2796,2795,2813,2814,2815,2904,2905,2699,2700,2915,2916,2917,2918,2919,2920,2921,2922,2760,2848,2849,2923,2816,2883,2798,2799,2802,2842,2843,2690,2686,2840,2841,2876,2877,2878,2879,2701,2856,2857,2858,2859,2860,2861,2862,2863,2689,2817,2818,2733,2734,2737,2694,2695,2692,2727,2696,2697,2728,2705,2706,2906,2907,2908,2909,2912,2910,2911,2784,2785,2872,2873,2874,2875,2852,2724,2725,2783,2819,2756,2787,2788,2960,2961,2962,2963,2932,2933,2934,2935,2936,2937,2942,2943,2944,2945,2946,2938,2939,2940,2941,2947,2948,2952,2951,2950,2953,2959,2957,2954,2955,2964,2967,2965,3004,2969,2970,2971,2966,2949,3042,3022,3024,3025,3030,3014,3013,3015,3033,3011,3012,3010,3017,3009,3163,3125,3126,3127,3128,3129,3119,3120,3079,3130,3075,3076,3040,3038,3039,3037,3113,3114,3078,3077,3121,3122,3041,3080,3081,3082,3083,3084,3123,3028,3036,3118,3124,3681,3684,3685,3686,3687,3688,3689,3690,3691,3692,3693,3694,3695,3696,3697,3698,3699,3700,3701,3702,3703,3704,3705,3706,3707,3708,3709,3710,3711,3712,3713,3714,3715,3716,3717,3718,3719,3720,3721,3722,3723,3724,3725,3726,3727,3728,3729,3730,3731,3732,3733,3734,3735,3736,3737,3738,3739,3740,3741,3742,3743,3744,3745,3746,3747,3748,3749,3750,3751,3752,3753,3754,3755,3756,3757,3758,3759,3760,3761,3762,3763,3764,3765,3766,3767,3768,3769,3773,3775,3771,3774,3772,3776,3777,3778,3779}'::integer[])))
  • Rows Removed by Filter: 686
74. 11.475 90.862 ↓ 1.4 35,112 2

Hash Left Join (cost=643.07..4,579.95 rows=25,085 width=62) (actual time=10.631..90.862 rows=35,112 loops=2)

  • Hash Cond: (grainorder.millfeedingtypeid = millfeedingtype.id)
75. 7.298 78.984 ↓ 1.4 35,112 2

Hash Left Join (cost=620.03..4,490.44 rows=25,085 width=49) (actual time=10.213..78.984 rows=35,112 loops=2)

  • Hash Cond: (lotfloor.floorid = floor.id)
76. 8.296 71.362 ↓ 1.4 35,112 2

Hash Left Join (cost=596.27..4,400.35 rows=25,085 width=49) (actual time=9.874..71.362 rows=35,112 loops=2)

  • Hash Cond: ((lot.id = lotfloor.lotid) AND (silo.floorid = lotfloor.floorid))
77. 11.523 60.331 ↓ 1.4 35,112 2

Hash Left Join (cost=392.09..4,064.47 rows=25,085 width=49) (actual time=7.108..60.331 rows=35,112 loops=2)

  • Hash Cond: (grainorder.siloid = silo.id)
78. 6.772 48.228 ↓ 1.4 35,112 2

Hash Left Join (cost=358.53..3,964.72 rows=25,085 width=45) (actual time=6.515..48.228 rows=35,112 loops=2)

  • Hash Cond: (lot.periodid = period.id)
79. 25.990 41.449 ↓ 1.4 35,112 2

Hash Join (cost=344.25..3,884.60 rows=25,085 width=49) (actual time=6.492..41.449 rows=35,112 loops=2)

  • Hash Cond: (grainorder.lotid = lot.id)
80. 9.070 9.070 ↑ 1.1 35,130 2

Parallel Seq Scan on grainorder (cost=0.00..3,436.18 rows=39,618 width=29) (actual time=0.015..9.070 rows=35,130 loops=2)

81. 0.963 6.389 ↓ 1.6 2,604 2

Hash (cost=323.78..323.78 rows=1,638 width=24) (actual time=6.389..6.389 rows=2,604 loops=2)

  • Buckets: 4096 (originally 2048) Batches: 1 (originally 1) Memory Usage: 174kB
82. 5.426 5.426 ↓ 1.6 2,604 2

Seq Scan on lot (cost=0.00..323.78 rows=1,638 width=24) (actual time=0.028..5.426 rows=2,604 loops=2)

  • Filter: (((status)::text = ANY ('{created,draft,published,proddraft,preproduction,production,postproduction,split,reopened,closed}'::text[])) AND (productiontypeid = ANY ('{84,87,82,89,86,83,80,13,81,88,85}'::integer[])))
83. 0.000 0.007 ↓ 0.0 0 2

Hash (cost=11.90..11.90 rows=190 width=4) (actual time=0.007..0.007 rows=0 loops=2)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
84. 0.007 0.007 ↓ 0.0 0 2

Seq Scan on period (cost=0.00..11.90 rows=190 width=4) (actual time=0.007..0.007 rows=0 loops=2)

85. 0.236 0.580 ↓ 1.0 833 2

Hash (cost=23.25..23.25 rows=825 width=12) (actual time=0.580..0.580 rows=833 loops=2)

  • Buckets: 1024 Batches: 1 Memory Usage: 41kB
86. 0.344 0.344 ↓ 1.0 833 2

Seq Scan on silo (cost=0.00..23.25 rows=825 width=12) (actual time=0.024..0.344 rows=833 loops=2)

87. 0.839 2.735 ↓ 1.0 2,710 2

Hash (cost=163.56..163.56 rows=2,708 width=8) (actual time=2.735..2.735 rows=2,710 loops=2)

  • Buckets: 4096 Batches: 1 Memory Usage: 138kB
88. 1.896 1.896 ↓ 1.0 2,710 2

Seq Scan on lotfloor (cost=0.00..163.56 rows=2,708 width=8) (actual time=0.016..1.896 rows=2,710 loops=2)

  • Filter: ((discriminator)::text = 'prod'::text)
  • Rows Removed by Filter: 2297
89. 0.150 0.324 ↓ 1.0 568 2

Hash (cost=16.67..16.67 rows=567 width=8) (actual time=0.324..0.324 rows=568 loops=2)

  • Buckets: 1024 Batches: 1 Memory Usage: 31kB
90. 0.174 0.174 ↓ 1.0 568 2

Seq Scan on floor (cost=0.00..16.67 rows=567 width=8) (actual time=0.013..0.174 rows=568 loops=2)

91. 0.146 0.403 ↓ 1.0 451 2

Hash (cost=17.46..17.46 rows=446 width=17) (actual time=0.403..0.403 rows=451 loops=2)

  • Buckets: 1024 Batches: 1 Memory Usage: 31kB
92. 0.257 0.257 ↓ 1.0 451 2

Seq Scan on millfeedingtype (cost=0.00..17.46 rows=446 width=17) (actual time=0.021..0.257 rows=451 loops=2)

93. 0.001 0.002 ↑ 2.0 1 70,224

Bitmap Heap Scan on building (cost=0.52..4.55 rows=2 width=4) (actual time=0.002..0.002 rows=1 loops=70,224)

  • Recheck Cond: ((silo.buildingid = id) OR (floor.parentid = id))
  • Heap Blocks: exact=33139
94. 0.000 0.001 ↓ 0.0 0 70,224

BitmapOr (cost=0.52..0.52 rows=2 width=0) (actual time=0.001..0.001 rows=0 loops=70,224)

95. 0.001 0.001 ↑ 1.0 1 70,224

Bitmap Index Scan on pk_building (cost=0.00..0.16 rows=1 width=0) (actual time=0.001..0.001 rows=1 loops=70,224)

  • Index Cond: (silo.buildingid = id)
96. 0.000 0.000 ↓ 0.0 0 70,224

Bitmap Index Scan on pk_building (cost=0.00..0.17 rows=1 width=0) (actual time=0.000..0.000 rows=0 loops=70,224)

  • Index Cond: (floor.parentid = id)
97. 0.152 0.313 ↓ 1.0 451 2

Hash (cost=17.46..17.46 rows=446 width=21) (actual time=0.313..0.313 rows=451 loops=2)

  • Buckets: 1024 Batches: 1 Memory Usage: 31kB
98. 0.161 0.161 ↓ 1.0 451 2

Seq Scan on millfeedingtype deliveryfeedcode (cost=0.00..17.46 rows=446 width=21) (actual time=0.006..0.161 rows=451 loops=2)

99. 0.125 0.511 ↓ 1.0 367 2

Hash (cost=27.90..27.90 rows=356 width=37) (actual time=0.511..0.511 rows=367 loops=2)

  • Buckets: 1024 Batches: 1 Memory Usage: 33kB
100. 0.386 0.386 ↓ 1.0 367 2

Seq Scan on millfeedingtypelocalized deliveryfeedtype (cost=0.00..27.90 rows=356 width=37) (actual time=0.024..0.386 rows=367 loops=2)

  • Filter: ((locale)::text = 'en'::text)
  • Rows Removed by Filter: 451
101. 0.061 0.224 ↓ 1.0 367 1

Hash (cost=27.90..27.90 rows=356 width=37) (actual time=0.224..0.224 rows=367 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 33kB
102. 0.163 0.163 ↓ 1.0 367 1

Seq Scan on millfeedingtypelocalized (cost=0.00..27.90 rows=356 width=37) (actual time=0.011..0.163 rows=367 loops=1)

  • Filter: ((locale)::text = 'en'::text)
  • Rows Removed by Filter: 451
103. 0.076 0.167 ↓ 1.0 532 1

Hash (cost=15.31..15.31 rows=531 width=24) (actual time=0.167..0.167 rows=532 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 39kB
104. 0.091 0.091 ↓ 1.0 532 1

Seq Scan on supplier (cost=0.00..15.31 rows=531 width=24) (actual time=0.008..0.091 rows=532 loops=1)

105. 0.075 0.139 ↓ 1.0 532 1

Hash (cost=15.31..15.31 rows=531 width=24) (actual time=0.139..0.139 rows=532 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 39kB
106. 0.064 0.064 ↓ 1.0 532 1

Seq Scan on supplier deliveryname (cost=0.00..15.31 rows=531 width=24) (actual time=0.002..0.064 rows=532 loops=1)

107. 0.250 4.020 ↓ 1.0 1,945 1

Hash (cost=2,792.22..2,792.22 rows=1,899 width=5) (actual time=4.020..4.020 rows=1,945 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 87kB
108. 0.168 3.770 ↓ 1.0 1,946 1

Subquery Scan on lotfarmer (cost=2,749.49..2,792.22 rows=1,899 width=5) (actual time=3.290..3.770 rows=1,946 loops=1)

109. 2.448 3.602 ↓ 1.0 1,946 1

HashAggregate (cost=2,749.49..2,773.23 rows=1,899 width=134) (actual time=3.289..3.602 rows=1,946 loops=1)

  • Group Key: lotfarmer_1.lotid
110. 0.208 1.154 ↑ 3.3 2,216 1

Hash Right Join (cost=88.23..209.05 rows=7,337 width=8) (actual time=0.957..1.154 rows=2,216 loops=1)

  • Hash Cond: (farmerlink.farmerid = lotfarmer_1.farmerid)
111. 0.003 0.003 ↓ 0.0 0 1

Seq Scan on farmerlink (cost=0.00..20.70 rows=1,070 width=4) (actual time=0.003..0.003 rows=0 loops=1)

112. 0.283 0.943 ↓ 1.2 2,216 1

Hash (cost=64.23..64.23 rows=1,920 width=8) (actual time=0.943..0.943 rows=2,216 loops=1)

  • Buckets: 4096 (originally 2048) Batches: 1 (originally 1) Memory Usage: 117kB
113. 0.402 0.660 ↓ 1.2 2,216 1

Hash Right Join (cost=21.95..64.23 rows=1,920 width=8) (actual time=0.131..0.660 rows=2,216 loops=1)

  • Hash Cond: (lotfarmer_1.farmerid = supplier_1.id)
114. 0.145 0.145 ↓ 1.0 1,967 1

Seq Scan on lotfarmer lotfarmer_1 (cost=0.00..37.20 rows=1,920 width=12) (actual time=0.006..0.145 rows=1,967 loops=1)

115. 0.062 0.113 ↓ 1.0 532 1

Hash (cost=15.31..15.31 rows=531 width=4) (actual time=0.113..0.113 rows=532 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 27kB
116. 0.051 0.051 ↓ 1.0 532 1

Seq Scan on supplier supplier_1 (cost=0.00..15.31 rows=531 width=4) (actual time=0.002..0.051 rows=532 loops=1)

Planning time : 17.139 ms
Execution time : 1,880.832 ms