explain.depesz.com

PostgreSQL's explain analyze made readable

Result: D9vT

Settings
# exclusive inclusive rows x rows loops node
1. 9,242.433 9,242.433 ↑ 1.0 1 1

CTE Scan on contagem c (cost=28,265.35..28,265.37 rows=1 width=1,224) (actual time=9,242.432..9,242.433 rows=1 loops=1)

2.          

CTE base

3. 0.002 9,242.045 ↓ 0.0 0 1

GroupAggregate (cost=25,610.61..25,691.39 rows=302 width=16) (actual time=9,242.045..9,242.045 rows=0 loops=1)

  • Group Key: v.femea_id
4. 0.042 9,242.043 ↓ 0.0 0 1

Sort (cost=25,610.61..25,611.36 rows=302 width=12) (actual time=9,242.043..9,242.043 rows=0 loops=1)

  • Sort Key: v.femea_id
  • Sort Method: quicksort Memory: 25kB
5. 9,238.849 9,242.001 ↓ 0.0 0 1

Bitmap Heap Scan on vw_modelo_reprodutivo v (cost=24.14..25,598.17 rows=302 width=12) (actual time=9,242.001..9,242.001 rows=0 loops=1)

  • Recheck Cond: ((data_hora_cobertura <= '2020-06-24'::date) AND (contrato_id = 16))
  • Rows Removed by Index Recheck: 284,432
  • Heap Blocks: lossy=8,960
6. 3.152 3.152 ↓ 10.1 89,600 1

Bitmap Index Scan on vw_modelo_reprodutivo_contrato_cobertura_brin (cost=0.00..24.07 rows=8,910 width=0) (actual time=3.152..3.152 rows=89,600 loops=1)

  • Index Cond: ((data_hora_cobertura <= '2020-06-24'::date) AND (contrato_id = 16))
7.          

CTE agrupamento

8. 0.001 9,242.049 ↓ 0.0 0 1

Nested Loop (cost=1.11..2,572.36 rows=1 width=121) (actual time=9,242.048..9,242.049 rows=0 loops=1)

  • Join Filter: (e.animal_id = a.id)
9. 0.001 9,242.048 ↓ 0.0 0 1

Nested Loop (cost=0.68..2,571.71 rows=1 width=125) (actual time=9,242.048..9,242.048 rows=0 loops=1)

  • Join Filter: (b.femea_id = e.animal_id)
10. 0.002 9,242.047 ↓ 0.0 0 1

Nested Loop (cost=0.43..2,548.96 rows=1 width=17) (actual time=9,242.047..9,242.047 rows=0 loops=1)

11. 9,242.045 9,242.045 ↓ 0.0 0 1

CTE Scan on base b (cost=0.00..6.04 rows=302 width=12) (actual time=9,242.045..9,242.045 rows=0 loops=1)

12. 0.000 0.000 ↓ 0.0 0

Index Scan using vw_modelo_reprodutivo_data_hora_cobertura_idx_order on vw_modelo_reprodutivo v_1 (cost=0.43..8.41 rows=1 width=21) (never executed)

  • Index Cond: ((femea_id = b.femea_id) AND (data_hora_cobertura = b.cobertura_mais_recente))
13. 0.000 0.000 ↓ 0.0 0

Function Scan on obtenha_animais_estoque_por_propriedade_com_peso_projetado e (cost=0.25..10.25 rows=1,000 width=108) (never executed)

14. 0.000 0.000 ↓ 0.0 0

Index Scan using mbw_animal_pkey on mbw_animal a (cost=0.43..0.64 rows=1 width=8) (never executed)

  • Index Cond: (id = v_1.femea_id)
  • Filter: (tipo_id = ANY ('{1,2,3}'::integer[]))
15.          

CTE contagem

16. 0.047 9,242.426 ↑ 1.0 1 1

Aggregate (cost=1.59..1.60 rows=1 width=1,224) (actual time=9,242.426..9,242.426 rows=1 loops=1)

17.          

Initplan (for Aggregate)

18. 0.082 0.082 ↓ 0.0 0 1

CTE Scan on resultado r (cost=0.06..0.08 rows=1 width=32) (actual time=0.082..0.082 rows=0 loops=1)

19.          

CTE resultado

20. 0.002 0.080 ↓ 0.0 0 1

GroupAggregate (cost=0.04..0.06 rows=1 width=40) (actual time=0.079..0.080 rows=0 loops=1)

  • Group Key: a_1.categoria_femea
21. 0.077 0.078 ↓ 0.0 0 1

Sort (cost=0.04..0.04 rows=1 width=32) (actual time=0.078..0.078 rows=0 loops=1)

  • Sort Key: a_1.categoria_femea
  • Sort Method: quicksort Memory: 25kB
22. 0.001 0.001 ↓ 0.0 0 1

CTE Scan on agrupamento a_1 (cost=0.00..0.03 rows=1 width=32) (actual time=0.001..0.001 rows=0 loops=1)

  • Filter: ((peso >= '0'::double precision) AND (peso <= '150'::double precision))
23. 0.021 0.021 ↓ 0.0 0 1

CTE Scan on resultado r_1 (cost=0.06..0.08 rows=1 width=32) (actual time=0.021..0.021 rows=0 loops=1)

24.          

CTE resultado

25. 0.001 0.019 ↓ 0.0 0 1

GroupAggregate (cost=0.04..0.06 rows=1 width=40) (actual time=0.019..0.019 rows=0 loops=1)

  • Group Key: a_2.categoria_femea
26. 0.017 0.018 ↓ 0.0 0 1

Sort (cost=0.04..0.04 rows=1 width=32) (actual time=0.018..0.018 rows=0 loops=1)

  • Sort Key: a_2.categoria_femea
  • Sort Method: quicksort Memory: 25kB
27. 0.001 0.001 ↓ 0.0 0 1

CTE Scan on agrupamento a_2 (cost=0.00..0.03 rows=1 width=32) (actual time=0.001..0.001 rows=0 loops=1)

  • Filter: ((peso > '150'::double precision) AND (peso <= '180'::double precision))
28. 0.018 0.018 ↓ 0.0 0 1

CTE Scan on resultado r_2 (cost=0.06..0.08 rows=1 width=32) (actual time=0.018..0.018 rows=0 loops=1)

29.          

CTE resultado

30. 0.001 0.017 ↓ 0.0 0 1

GroupAggregate (cost=0.04..0.06 rows=1 width=40) (actual time=0.017..0.017 rows=0 loops=1)

  • Group Key: a_3.categoria_femea
31. 0.016 0.016 ↓ 0.0 0 1

Sort (cost=0.04..0.04 rows=1 width=32) (actual time=0.016..0.016 rows=0 loops=1)

  • Sort Key: a_3.categoria_femea
  • Sort Method: quicksort Memory: 25kB
32. 0.000 0.000 ↓ 0.0 0 1

CTE Scan on agrupamento a_3 (cost=0.00..0.03 rows=1 width=32) (actual time=0.000..0.000 rows=0 loops=1)

  • Filter: ((peso > '180'::double precision) AND (peso <= '210'::double precision))
33. 0.017 0.017 ↓ 0.0 0 1

CTE Scan on resultado r_3 (cost=0.06..0.08 rows=1 width=32) (actual time=0.017..0.017 rows=0 loops=1)

34.          

CTE resultado

35. 0.001 0.016 ↓ 0.0 0 1

GroupAggregate (cost=0.04..0.06 rows=1 width=40) (actual time=0.016..0.016 rows=0 loops=1)

  • Group Key: a_4.categoria_femea
36. 0.014 0.015 ↓ 0.0 0 1

Sort (cost=0.04..0.04 rows=1 width=32) (actual time=0.015..0.015 rows=0 loops=1)

  • Sort Key: a_4.categoria_femea
  • Sort Method: quicksort Memory: 25kB
37. 0.001 0.001 ↓ 0.0 0 1

CTE Scan on agrupamento a_4 (cost=0.00..0.03 rows=1 width=32) (actual time=0.001..0.001 rows=0 loops=1)

  • Filter: ((peso > '210'::double precision) AND (peso <= '240'::double precision))
38. 0.016 0.016 ↓ 0.0 0 1

CTE Scan on resultado r_4 (cost=0.06..0.08 rows=1 width=32) (actual time=0.016..0.016 rows=0 loops=1)

39.          

CTE resultado

40. 0.001 0.015 ↓ 0.0 0 1

GroupAggregate (cost=0.04..0.06 rows=1 width=40) (actual time=0.015..0.015 rows=0 loops=1)

  • Group Key: a_5.categoria_femea
41. 0.014 0.014 ↓ 0.0 0 1

Sort (cost=0.04..0.04 rows=1 width=32) (actual time=0.014..0.014 rows=0 loops=1)

  • Sort Key: a_5.categoria_femea
  • Sort Method: quicksort Memory: 25kB
42. 0.000 0.000 ↓ 0.0 0 1

CTE Scan on agrupamento a_5 (cost=0.00..0.03 rows=1 width=32) (actual time=0.000..0.000 rows=0 loops=1)

  • Filter: ((peso > '240'::double precision) AND (peso <= '270'::double precision))
43. 0.018 0.018 ↓ 0.0 0 1

CTE Scan on resultado r_5 (cost=0.06..0.08 rows=1 width=32) (actual time=0.018..0.018 rows=0 loops=1)

44.          

CTE resultado

45. 0.001 0.017 ↓ 0.0 0 1

GroupAggregate (cost=0.04..0.06 rows=1 width=40) (actual time=0.017..0.017 rows=0 loops=1)

  • Group Key: a_6.categoria_femea
46. 0.015 0.016 ↓ 0.0 0 1

Sort (cost=0.04..0.04 rows=1 width=32) (actual time=0.016..0.016 rows=0 loops=1)

  • Sort Key: a_6.categoria_femea
  • Sort Method: quicksort Memory: 25kB
47. 0.001 0.001 ↓ 0.0 0 1

CTE Scan on agrupamento a_6 (cost=0.00..0.03 rows=1 width=32) (actual time=0.001..0.001 rows=0 loops=1)

  • Filter: ((peso > '270'::double precision) AND (peso <= '300'::double precision))
48. 0.019 0.019 ↓ 0.0 0 1

CTE Scan on resultado r_6 (cost=0.06..0.08 rows=1 width=32) (actual time=0.019..0.019 rows=0 loops=1)

49.          

CTE resultado

50. 0.001 0.018 ↓ 0.0 0 1

GroupAggregate (cost=0.04..0.06 rows=1 width=40) (actual time=0.018..0.018 rows=0 loops=1)

  • Group Key: a_7.categoria_femea
51. 0.017 0.017 ↓ 0.0 0 1

Sort (cost=0.04..0.04 rows=1 width=32) (actual time=0.017..0.017 rows=0 loops=1)

  • Sort Key: a_7.categoria_femea
  • Sort Method: quicksort Memory: 25kB
52. 0.000 0.000 ↓ 0.0 0 1

CTE Scan on agrupamento a_7 (cost=0.00..0.03 rows=1 width=32) (actual time=0.000..0.000 rows=0 loops=1)

  • Filter: ((peso > '300'::double precision) AND (peso <= '330'::double precision))
53. 0.020 0.020 ↓ 0.0 0 1

CTE Scan on resultado r_7 (cost=0.06..0.08 rows=1 width=32) (actual time=0.020..0.020 rows=0 loops=1)

54.          

CTE resultado

55. 0.001 0.019 ↓ 0.0 0 1

GroupAggregate (cost=0.04..0.06 rows=1 width=40) (actual time=0.019..0.019 rows=0 loops=1)

  • Group Key: a_8.categoria_femea
56. 0.017 0.018 ↓ 0.0 0 1

Sort (cost=0.04..0.04 rows=1 width=32) (actual time=0.018..0.018 rows=0 loops=1)

  • Sort Key: a_8.categoria_femea
  • Sort Method: quicksort Memory: 25kB
57. 0.001 0.001 ↓ 0.0 0 1

CTE Scan on agrupamento a_8 (cost=0.00..0.03 rows=1 width=32) (actual time=0.001..0.001 rows=0 loops=1)

  • Filter: ((peso > '330'::double precision) AND (peso <= '360'::double precision))
58. 0.013 0.013 ↓ 0.0 0 1

CTE Scan on resultado r_8 (cost=0.06..0.08 rows=1 width=32) (actual time=0.013..0.013 rows=0 loops=1)

59.          

CTE resultado

60. 0.000 0.012 ↓ 0.0 0 1

GroupAggregate (cost=0.04..0.06 rows=1 width=40) (actual time=0.012..0.012 rows=0 loops=1)

  • Group Key: a_9.categoria_femea
61. 0.011 0.012 ↓ 0.0 0 1

Sort (cost=0.04..0.04 rows=1 width=32) (actual time=0.012..0.012 rows=0 loops=1)

  • Sort Key: a_9.categoria_femea
  • Sort Method: quicksort Memory: 25kB
62. 0.001 0.001 ↓ 0.0 0 1

CTE Scan on agrupamento a_9 (cost=0.00..0.03 rows=1 width=32) (actual time=0.001..0.001 rows=0 loops=1)

  • Filter: ((peso > '360'::double precision) AND (peso <= '390'::double precision))
63. 0.019 0.019 ↓ 0.0 0 1

CTE Scan on resultado r_9 (cost=0.06..0.08 rows=1 width=32) (actual time=0.019..0.019 rows=0 loops=1)

64.          

CTE resultado

65. 0.001 0.019 ↓ 0.0 0 1

GroupAggregate (cost=0.04..0.06 rows=1 width=40) (actual time=0.018..0.019 rows=0 loops=1)

  • Group Key: a_10.categoria_femea
66. 0.018 0.018 ↓ 0.0 0 1

Sort (cost=0.04..0.04 rows=1 width=32) (actual time=0.017..0.018 rows=0 loops=1)

  • Sort Key: a_10.categoria_femea
  • Sort Method: quicksort Memory: 25kB
67. 0.000 0.000 ↓ 0.0 0 1

CTE Scan on agrupamento a_10 (cost=0.00..0.03 rows=1 width=32) (actual time=0.000..0.000 rows=0 loops=1)

  • Filter: ((peso > '390'::double precision) AND (peso <= '420'::double precision))
68. 0.012 0.012 ↓ 0.0 0 1

CTE Scan on resultado r_10 (cost=0.06..0.08 rows=1 width=32) (actual time=0.012..0.012 rows=0 loops=1)

69.          

CTE resultado

70. 0.001 0.011 ↓ 0.0 0 1

GroupAggregate (cost=0.04..0.06 rows=1 width=40) (actual time=0.011..0.011 rows=0 loops=1)

  • Group Key: a_11.categoria_femea
71. 0.009 0.010 ↓ 0.0 0 1

Sort (cost=0.04..0.04 rows=1 width=32) (actual time=0.010..0.010 rows=0 loops=1)

  • Sort Key: a_11.categoria_femea
  • Sort Method: quicksort Memory: 25kB
72. 0.001 0.001 ↓ 0.0 0 1

CTE Scan on agrupamento a_11 (cost=0.00..0.03 rows=1 width=32) (actual time=0.001..0.001 rows=0 loops=1)

  • Filter: ((peso > '420'::double precision) AND (peso <= '450'::double precision))
73. 0.013 0.013 ↓ 0.0 0 1

CTE Scan on resultado r_11 (cost=0.06..0.08 rows=1 width=32) (actual time=0.013..0.013 rows=0 loops=1)

74.          

CTE resultado

75. 0.001 0.013 ↓ 0.0 0 1

GroupAggregate (cost=0.04..0.06 rows=1 width=40) (actual time=0.013..0.013 rows=0 loops=1)

  • Group Key: a_12.categoria_femea
76. 0.011 0.012 ↓ 0.0 0 1

Sort (cost=0.04..0.04 rows=1 width=32) (actual time=0.012..0.012 rows=0 loops=1)

  • Sort Key: a_12.categoria_femea
  • Sort Method: quicksort Memory: 25kB
77. 0.001 0.001 ↓ 0.0 0 1

CTE Scan on agrupamento a_12 (cost=0.00..0.03 rows=1 width=32) (actual time=0.000..0.001 rows=0 loops=1)

  • Filter: ((peso > '450'::double precision) AND (peso <= '480'::double precision))
78. 0.012 0.012 ↓ 0.0 0 1

CTE Scan on resultado r_12 (cost=0.06..0.08 rows=1 width=32) (actual time=0.012..0.012 rows=0 loops=1)

79.          

CTE resultado

80. 0.001 0.011 ↓ 0.0 0 1

GroupAggregate (cost=0.04..0.06 rows=1 width=40) (actual time=0.011..0.011 rows=0 loops=1)

  • Group Key: a_13.categoria_femea
81. 0.010 0.010 ↓ 0.0 0 1

Sort (cost=0.04..0.04 rows=1 width=32) (actual time=0.010..0.010 rows=0 loops=1)

  • Sort Key: a_13.categoria_femea
  • Sort Method: quicksort Memory: 25kB
82. 0.000 0.000 ↓ 0.0 0 1

CTE Scan on agrupamento a_13 (cost=0.00..0.03 rows=1 width=32) (actual time=0.000..0.000 rows=0 loops=1)

  • Filter: ((peso > '480'::double precision) AND (peso <= '510'::double precision))
83. 0.012 0.012 ↓ 0.0 0 1

CTE Scan on resultado r_13 (cost=0.06..0.08 rows=1 width=32) (actual time=0.011..0.012 rows=0 loops=1)

84.          

CTE resultado

85. 0.001 0.011 ↓ 0.0 0 1

GroupAggregate (cost=0.04..0.06 rows=1 width=40) (actual time=0.011..0.011 rows=0 loops=1)

  • Group Key: a_14.categoria_femea
86. 0.010 0.010 ↓ 0.0 0 1

Sort (cost=0.04..0.04 rows=1 width=32) (actual time=0.010..0.010 rows=0 loops=1)

  • Sort Key: a_14.categoria_femea
  • Sort Method: quicksort Memory: 25kB
87. 0.000 0.000 ↓ 0.0 0 1

CTE Scan on agrupamento a_14 (cost=0.00..0.03 rows=1 width=32) (actual time=0.000..0.000 rows=0 loops=1)

  • Filter: ((peso > '510'::double precision) AND (peso <= '540'::double precision))
88. 0.013 0.013 ↓ 0.0 0 1

CTE Scan on resultado r_14 (cost=0.06..0.08 rows=1 width=32) (actual time=0.013..0.013 rows=0 loops=1)

89.          

CTE resultado

90. 0.001 0.012 ↓ 0.0 0 1

GroupAggregate (cost=0.04..0.06 rows=1 width=40) (actual time=0.012..0.012 rows=0 loops=1)

  • Group Key: a_15.categoria_femea
91. 0.011 0.011 ↓ 0.0 0 1

Sort (cost=0.04..0.04 rows=1 width=32) (actual time=0.011..0.011 rows=0 loops=1)

  • Sort Key: a_15.categoria_femea
  • Sort Method: quicksort Memory: 25kB
92. 0.000 0.000 ↓ 0.0 0 1

CTE Scan on agrupamento a_15 (cost=0.00..0.03 rows=1 width=32) (actual time=0.000..0.000 rows=0 loops=1)

  • Filter: ((peso > '540'::double precision) AND (peso <= '570'::double precision))
93. 0.013 0.013 ↓ 0.0 0 1

CTE Scan on resultado r_15 (cost=0.06..0.08 rows=1 width=32) (actual time=0.013..0.013 rows=0 loops=1)

94.          

CTE resultado

95. 0.001 0.012 ↓ 0.0 0 1

GroupAggregate (cost=0.04..0.06 rows=1 width=40) (actual time=0.012..0.012 rows=0 loops=1)

  • Group Key: a_16.categoria_femea
96. 0.011 0.011 ↓ 0.0 0 1

Sort (cost=0.04..0.04 rows=1 width=32) (actual time=0.011..0.011 rows=0 loops=1)

  • Sort Key: a_16.categoria_femea
  • Sort Method: quicksort Memory: 25kB
97. 0.000 0.000 ↓ 0.0 0 1

CTE Scan on agrupamento a_16 (cost=0.00..0.03 rows=1 width=32) (actual time=0.000..0.000 rows=0 loops=1)

  • Filter: ((peso > '570'::double precision) AND (peso <= '600'::double precision))
98. 0.011 0.011 ↓ 0.0 0 1

CTE Scan on resultado r_16 (cost=0.05..0.08 rows=1 width=32) (actual time=0.011..0.011 rows=0 loops=1)

99.          

CTE resultado

100. 0.000 0.010 ↓ 0.0 0 1

GroupAggregate (cost=0.03..0.05 rows=1 width=40) (actual time=0.010..0.010 rows=0 loops=1)

  • Group Key: a_17.categoria_femea
101. 0.009 0.010 ↓ 0.0 0 1

Sort (cost=0.03..0.04 rows=1 width=32) (actual time=0.010..0.010 rows=0 loops=1)

  • Sort Key: a_17.categoria_femea
  • Sort Method: quicksort Memory: 25kB
102. 0.001 0.001 ↓ 0.0 0 1

CTE Scan on agrupamento a_17 (cost=0.00..0.02 rows=1 width=32) (actual time=0.000..0.001 rows=0 loops=1)

  • Filter: (peso > '600'::double precision)
103. 9,242.050 9,242.050 ↓ 0.0 0 1

CTE Scan on agrupamento a_18 (cost=0.00..0.02 rows=1 width=12) (actual time=9,242.050..9,242.050 rows=0 loops=1)

Planning time : 126.998 ms
Execution time : 9,250.454 ms