explain.depesz.com

PostgreSQL's explain analyze made readable

Result: r7gv

Settings
# exclusive inclusive rows x rows loops node
1. 10.629 19,755.971 ↓ 2.9 4,368 1

HashAggregate (cost=159,154.68..159,177.12 rows=1,496 width=505) (actual time=19,752.846..19,755.971 rows=4,368 loops=1)

  • Group Key: l.cobertura_id, a.identificacao_usual, a.id, l.macho_raca_nome, l.cobertura_situacao_nome, l.tipo_cobertura, l.data_hora_cobertura, l.resultado_parto_nome, l.situacao_cria, l.parto_id, l.data_parto, l.propriedade_id, l.dg_inicial, (l.data_hora_cobertura + '275 days'::interval day), (l.data_hora_cobertura + '315 days'::interval day), c.sexo, p.propriedade_id, c.id, CASE WHEN ((r.identificacao_usual IS NOT NULL) OR (apt.id_animal IS NULL)) THEN true ELSE false END, CASE WHEN (apt.id_animal IS NULL) THEN 'saida-outros'::text ELSE r.tipo_descarte END, CASE WHEN (l.femea_id IS NOT NULL) THEN true ELSE false END, a.categoria, a.novilhas_chance
2.          

CTE animais_aptos

3. 14,169.300 14,169.300 ↓ 1,028.4 5,142 1

Function Scan on obtenha_animais_estoque_por_contrato_propriedade (cost=0.25..12.75 rows=5 width=4) (actual time=14,164.902..14,169.300 rows=5,142 loops=1)

  • Filter: (propriedade_id = 3144)
  • Rows Removed by Filter: 36360
4.          

CTE novilhas

5. 2.953 14,379.952 ↓ 7.2 1,468 1

HashAggregate (cost=17,031.87..17,033.91 rows=204 width=11) (actual time=14,379.333..14,379.952 rows=1,468 loops=1)

  • Group Key: a_1.id, a_1.identificacao_usual, ('novilha'::text)
6. 0.746 14,376.999 ↓ 21.4 4,373 1

Append (cost=48.67..17,030.34 rows=204 width=11) (actual time=3.512..14,376.999 rows=4,373 loops=1)

7. 13.873 155.392 ↓ 17.7 3,570 1

Nested Loop Anti Join (cost=48.67..16,926.73 rows=202 width=11) (actual time=3.511..155.392 rows=3,570 loops=1)

8. 4.956 80.241 ↓ 101.1 20,426 1

Nested Loop (cost=48.11..15,174.89 rows=202 width=11) (actual time=1.447..80.241 rows=20,426 loops=1)

9. 15.129 16.277 ↓ 12.1 3,688 1

Bitmap Heap Scan on mbw_animal a_1 (cost=47.55..7,635.52 rows=306 width=11) (actual time=1.305..16.277 rows=3,688 loops=1)

  • Recheck Cond: (propriedade_id = 3144)
  • Filter: ((data_morte IS NULL) AND ((data_descarte_reprodutor IS NULL) OR (data_descarte_reprodutor < '2018-07-01'::date)) AND (tipo_id <> 4) AND (sexo = 0) AND (((date_part('year'::text, age('2018-07-01 00:00:00'::timestamp without time zone, (data_nascimento)::timestamp without time zone)) * '12'::double precision) + date_part('month'::text, age('2018-07-01 00:00:00'::timestamp without time zone, (data_nascimento)::timestamp without time zone))) > '16'::double precision))
  • Rows Removed by Filter: 4220
  • Heap Blocks: exact=662
10. 1.148 1.148 ↓ 3.9 7,908 1

Bitmap Index Scan on mbw_animal_62d4a177 (cost=0.00..47.48 rows=2,006 width=0) (actual time=1.148..1.148 rows=7,908 loops=1)

  • Index Cond: (propriedade_id = 3144)
11. 59.008 59.008 ↓ 1.5 6 3,688

Index Scan using vw_modelo_reprodutivo_data_hora_cobertura_idx on vw_modelo_reprodutivo cb (cost=0.56..24.60 rows=4 width=4) (actual time=0.005..0.016 rows=6 loops=3,688)

  • Index Cond: ((femea_id = a_1.id) AND (data_hora_cobertura < '2018-07-01 00:00:00-03'::timestamp with time zone))
  • Filter: (cobertura_situacao_nome <> ALL ('{Servida,Gestante}'::text[]))
  • Rows Removed by Filter: 0
12. 61.278 61.278 ↑ 1.0 1 20,426

Index Scan using vw_modelo_reprodutivo_data_hora_cobertura_idx on vw_modelo_reprodutivo m (cost=0.56..8.63 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=20,426)

  • Index Cond: ((femea_id = a_1.id) AND (data_hora_cobertura < '2018-07-01 00:00:00-03'::timestamp with time zone) AND (propriedade_id = 3144))
  • Filter: ((data_parto IS NOT NULL) AND (situacao_cria = ANY ('{Vivo,Descartado}'::text[])))
13. 1.585 14,205.397 ↓ 757.0 757 1

Nested Loop Anti Join (cost=0.99..50.28 rows=1 width=11) (actual time=14,164.981..14,205.397 rows=757 loops=1)

14. 0.727 14,192.301 ↓ 3,837.0 3,837 1

Nested Loop (cost=0.43..42.55 rows=1 width=11) (actual time=14,164.961..14,192.301 rows=3,837 loops=1)

15. 14,171.006 14,171.006 ↓ 1,028.4 5,142 1

CTE Scan on animais_aptos apt_1 (cost=0.00..0.10 rows=5 width=4) (actual time=14,164.907..14,171.006 rows=5,142 loops=1)

16. 20.568 20.568 ↑ 1.0 1 5,142

Index Scan using mbw_animal_pkey on mbw_animal a_2 (cost=0.43..8.48 rows=1 width=11) (actual time=0.003..0.004 rows=1 loops=5,142)

  • Index Cond: (id = apt_1.id_animal)
  • Filter: ((tipo_id <> 4) AND (contrato_id = 16) AND (sexo = 0) AND (((date_part('year'::text, age('2018-07-01 00:00:00'::timestamp without time zone, (data_nascimento)::timestamp without time zone)) * '12'::double precision) + date_part('month'::text, age('2018-07-01 00:00:00'::timestamp without time zone, (data_nascimento)::timestamp without time zone))) > '16'::double precision))
  • Rows Removed by Filter: 0
17. 11.511 11.511 ↑ 1.0 1 3,837

Index Only Scan using vw_modelo_reprodutivo_data_hora_cobertura_idx on vw_modelo_reprodutivo (cost=0.56..4.14 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=3,837)

  • Index Cond: ((femea_id = a_2.id) AND (data_hora_cobertura < '2018-07-01 00:00:00-03'::timestamp with time zone) AND (propriedade_id = 3144) AND (contrato_id = 16))
  • Heap Fetches: 0
18. 0.256 15.464 ↓ 46.0 46 1

Nested Loop Anti Join (cost=0.99..51.29 rows=1 width=11) (actual time=13.288..15.464 rows=46 loops=1)

19. 2.848 14.063 ↓ 229.0 229 1

Nested Loop (cost=0.43..42.56 rows=1 width=11) (actual time=0.096..14.063 rows=229 loops=1)

20. 0.931 0.931 ↓ 1,028.4 5,142 1

CTE Scan on animais_aptos apt_2 (cost=0.00..0.10 rows=5 width=4) (actual time=0.001..0.931 rows=5,142 loops=1)

21. 10.284 10.284 ↓ 0.0 0 5,142

Index Scan using mbw_animal_pkey on mbw_animal a_3 (cost=0.43..8.48 rows=1 width=11) (actual time=0.002..0.002 rows=0 loops=5,142)

  • Index Cond: (id = apt_2.id_animal)
  • Filter: ((data_descarte_reprodutor >= '2018-07-01'::date) AND (contrato_id = 16) AND (sexo = 0) AND (tipo_id = 4) AND (((date_part('year'::text, age('2018-07-01 00:00:00'::timestamp without time zone, (data_nascimento)::timestamp without time zone)) * '12'::double precision) + date_part('month'::text, age('2018-07-01 00:00:00'::timestamp without time zone, (data_nascimento)::timestamp without time zone))) > '16'::double precision))
  • Rows Removed by Filter: 1
22. 1.145 1.145 ↑ 1.0 1 229

Index Only Scan using vw_modelo_reprodutivo_data_hora_cobertura_idx on vw_modelo_reprodutivo vw_modelo_reprodutivo_1 (cost=0.56..4.64 rows=1 width=4) (actual time=0.005..0.005 rows=1 loops=229)

  • Index Cond: ((femea_id = a_3.id) AND (data_hora_cobertura < '2018-07-01 00:00:00-03'::timestamp with time zone) AND (propriedade_id = 3144) AND (contrato_id = 16))
  • Heap Fetches: 0
23.          

CTE retirada_em

24. 9.853 53.519 ↓ 32.8 8,101 1

HashAggregate (cost=118,713.69..118,716.16 rows=247 width=11) (actual time=49.435..53.519 rows=8,101 loops=1)

  • Group Key: a_4.id, a_4.identificacao_usual, ('Mortes'::text)
25. 1.408 43.666 ↓ 32.8 8,101 1

Append (cost=40.73..118,711.84 rows=247 width=11) (actual time=0.263..43.666 rows=8,101 loops=1)

26. 1.335 10.091 ↓ 30.8 1,633 1

Nested Loop (cost=40.73..19,377.20 rows=53 width=11) (actual time=0.261..10.091 rows=1,633 loops=1)

27. 0.888 1.056 ↑ 1.0 1,925 1

Bitmap Heap Scan on mbw_morte m_1 (cost=40.30..3,189.93 rows=1,953 width=4) (actual time=0.187..1.056 rows=1,925 loops=1)

  • Recheck Cond: (contrato_id = 16)
  • Filter: (tipo_id <> 98)
  • Rows Removed by Filter: 8
  • Heap Blocks: exact=55
28. 0.168 0.168 ↑ 1.1 1,933 1

Bitmap Index Scan on mbw_morte_868819a8 (cost=0.00..39.81 rows=2,052 width=0) (actual time=0.168..0.168 rows=1,933 loops=1)

  • Index Cond: (contrato_id = 16)
29. 7.700 7.700 ↑ 1.0 1 1,925

Index Scan using mbw_animal_pkey on mbw_animal a_4 (cost=0.43..8.28 rows=1 width=11) (actual time=0.004..0.004 rows=1 loops=1,925)

  • Index Cond: (id = m_1.animal_id)
  • Filter: (data_morte <= '2019-03-31'::date)
  • Rows Removed by Filter: 0
30. 2.666 3.438 ↓ 0.0 0 1

Bitmap Heap Scan on mbw_animal a_5 (cost=47.48..7,585.29 rows=12 width=11) (actual time=3.438..3.438 rows=0 loops=1)

  • Recheck Cond: (propriedade_id = 3144)
  • Filter: ((data_descarte_reprodutor <= '2019-03-31'::date) AND (situacao_id <> 4))
  • Rows Removed by Filter: 7908
  • Heap Blocks: exact=662
31. 0.772 0.772 ↓ 3.9 7,908 1

Bitmap Index Scan on mbw_animal_62d4a177 (cost=0.00..47.48 rows=2,006 width=0) (actual time=0.772..0.772 rows=7,908 loops=1)

  • Index Cond: (propriedade_id = 3144)
32. 0.028 0.216 ↓ 9.0 36 1

Nested Loop (cost=32.45..359.87 rows=4 width=11) (actual time=0.105..0.216 rows=36 loops=1)

33. 0.012 0.116 ↓ 9.0 36 1

Nested Loop (cost=32.02..356.08 rows=4 width=4) (actual time=0.090..0.116 rows=36 loops=1)

34. 0.025 0.076 ↑ 1.0 1 1

Bitmap Heap Scan on mbw_venda v (cost=31.59..35.61 rows=1 width=4) (actual time=0.070..0.076 rows=1 loops=1)

  • Recheck Cond: ((propriedade_id = 3144) AND (contrato_id = 16))
  • Filter: ((tipo_venda_id <> 5) AND (data <= '2019-03-31'::date))
  • Rows Removed by Filter: 12
  • Heap Blocks: exact=5
35. 0.009 0.051 ↓ 0.0 0 1

BitmapAnd (cost=31.59..31.59 rows=1 width=0) (actual time=0.051..0.051 rows=0 loops=1)

36. 0.024 0.024 ↑ 19.5 13 1

Bitmap Index Scan on mbw_venda_62d4a177 (cost=0.00..6.33 rows=254 width=0) (actual time=0.024..0.024 rows=13 loops=1)

  • Index Cond: (propriedade_id = 3144)
37. 0.018 0.018 ↑ 13.6 84 1

Bitmap Index Scan on mbw_venda_868819a8 (cost=0.00..25.00 rows=1,144 width=0) (actual time=0.018..0.018 rows=84 loops=1)

  • Index Cond: (contrato_id = 16)
38. 0.028 0.028 ↑ 2.4 36 1

Index Scan using mbw_vendaitens_2f2a853d on mbw_vendaitens vi (cost=0.43..319.61 rows=87 width=8) (actual time=0.013..0.028 rows=36 loops=1)

  • Index Cond: (venda_id = v.id)
39. 0.072 0.072 ↑ 1.0 1 36

Index Scan using mbw_animal_pkey on mbw_animal a_6 (cost=0.43..0.94 rows=1 width=11) (actual time=0.002..0.002 rows=1 loops=36)

  • Index Cond: (id = vi.animal_id)
40. 0.001 1.839 ↓ 0.0 0 1

Nested Loop (cost=115.08..5,661.09 rows=1 width=11) (actual time=1.839..1.839 rows=0 loops=1)

41. 0.001 1.838 ↓ 0.0 0 1

Nested Loop (cost=114.65..5,653.11 rows=1 width=4) (actual time=1.838..1.838 rows=0 loops=1)

42. 1.837 1.837 ↓ 0.0 0 1

Index Scan using mbw_venda_62d4a177 on mbw_venda v_1 (cost=0.42..804.88 rows=41 width=4) (actual time=1.837..1.837 rows=0 loops=1)

  • Index Cond: (propriedade_id = 31557)
  • Filter: ((data <= '2019-03-31'::date) AND (tipo_venda_id = 5))
43. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on mbw_vendaitens vi_1 (cost=114.22..118.24 rows=1 width=8) (never executed)

  • Recheck Cond: ((venda_id = v_1.id) AND (contrato_id = 16))
44. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=114.22..114.22 rows=1 width=0) (never executed)

45. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on mbw_vendaitens_2f2a853d (cost=0.00..5.08 rows=87 width=0) (never executed)

  • Index Cond: (venda_id = v_1.id)
46. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on mbw_vendaitens_868819a8 (cost=0.00..107.46 rows=5,737 width=0) (never executed)

  • Index Cond: (contrato_id = 16)
47. 0.000 0.000 ↓ 0.0 0

Index Scan using mbw_animal_pkey on mbw_animal a_7 (cost=0.43..7.97 rows=1 width=11) (never executed)

  • Index Cond: (id = vi_1.animal_id)
48. 3.109 26.674 ↓ 36.3 6,432 1

Nested Loop (cost=175.90..85,725.93 rows=177 width=11) (actual time=0.847..26.674 rows=6,432 loops=1)

49. 3.505 4.269 ↑ 1.3 6,432 1

Bitmap Heap Scan on mbw_transferenciapropriedade t (cost=175.47..21,788.66 rows=8,193 width=4) (actual time=0.816..4.269 rows=6,432 loops=1)

  • Recheck Cond: (propriedade_origem_id = 3144)
  • Filter: (data <= '2019-03-31'::date)
  • Rows Removed by Filter: 2690
  • Heap Blocks: exact=184
50. 0.764 0.764 ↑ 1.0 9,122 1

Bitmap Index Scan on mbw_transferenciapropriedade_f8de2aa4 (cost=0.00..173.42 rows=9,199 width=0) (actual time=0.764..0.764 rows=9,122 loops=1)

  • Index Cond: (propriedade_origem_id = 3144)
51. 19.296 19.296 ↑ 1.0 1 6,432

Index Scan using mbw_animal_pkey on mbw_animal a_8 (cost=0.43..7.79 rows=1 width=11) (actual time=0.003..0.003 rows=1 loops=6,432)

  • Index Cond: (id = t.animal_id)
  • Filter: (contrato_id = 16)
52.          

CTE animais_supostamente_aptos

53. 5.680 19,638.390 ↓ 3.6 4,368 1

HashAggregate (cost=12,660.02..12,672.13 rows=1,211 width=71) (actual time=19,635.976..19,638.390 rows=4,368 loops=1)

  • Group Key: n.id, n.identificacao_usual, n.categoria, (CASE WHEN (vw.cobertura_id IS NOT NULL) THEN true ELSE false END), (CASE WHEN (vw.cobertura_id IS NOT NULL) THEN vw.cobertura_id ELSE NULL::integer END)
54. 0.805 19,632.710 ↓ 3.6 4,379 1

Append (cost=1,771.74..12,644.88 rows=1,211 width=71) (actual time=14,387.831..19,632.710 rows=4,379 loops=1)

55. 1.418 14,388.229 ↓ 7.2 1,468 1

HashAggregate (cost=1,771.74..1,773.78 rows=204 width=98) (actual time=14,387.830..14,388.229 rows=1,468 loops=1)

  • Group Key: n.id, n.identificacao_usual, n.categoria, CASE WHEN (vw.cobertura_id IS NOT NULL) THEN true ELSE false END, CASE WHEN (vw.cobertura_id IS NOT NULL) THEN vw.cobertura_id ELSE NULL::integer END
56. 1.639 14,386.811 ↓ 7.2 1,468 1

Nested Loop Left Join (cost=0.56..1,769.19 rows=204 width=98) (actual time=14,379.357..14,386.811 rows=1,468 loops=1)

57. 14,380.768 14,380.768 ↓ 7.2 1,468 1

CTE Scan on novilhas n (cost=0.00..4.08 rows=204 width=94) (actual time=14,379.340..14,380.768 rows=1,468 loops=1)

58. 4.404 4.404 ↓ 0.0 0 1,468

Index Scan using vw_modelo_reprodutivo_data_hora_cobertura_idx on vw_modelo_reprodutivo vw (cost=0.56..8.64 rows=1 width=8) (actual time=0.003..0.003 rows=0 loops=1,468)

  • Index Cond: ((femea_id = n.id) AND (data_hora_cobertura < '2018-07-01 00:00:00-03'::timestamp with time zone) AND (propriedade_id = 3144) AND (contrato_id = 16))
59. 4,527.484 4,527.484 ↑ 1.2 4 1

Function Scan on reprodutivo_partos_previstos (cost=0.25..10.25 rows=5 width=66) (actual time=4,527.161..4,527.484 rows=4 loops=1)

  • Filter: (data_parto IS NULL)
  • Rows Removed by Filter: 2217
60. 4.479 95.045 ↓ 71.0 71 1

Nested Loop (cost=0.56..2,142.72 rows=1 width=14) (actual time=49.712..95.045 rows=71 loops=1)

61. 58.162 58.162 ↓ 32.8 8,101 1

CTE Scan on retirada_em r_1 (cost=0.00..4.94 rows=247 width=4) (actual time=49.439..58.162 rows=8,101 loops=1)

62. 32.404 32.404 ↓ 0.0 0 8,101

Index Scan using vw_modelo_reprodutivo_data_hora_cobertura_idx on vw_modelo_reprodutivo vw_1 (cost=0.56..8.64 rows=1 width=14) (actual time=0.004..0.004 rows=0 loops=8,101)

  • Index Cond: ((femea_id = r_1.id) AND (propriedade_id = 3144) AND (contrato_id = 16))
  • Filter: (cobertura_situacao_nome = 'Gestante'::text)
  • Rows Removed by Filter: 0
63. 0.196 502.009 ↓ 0.0 0 1

Nested Loop Anti Join (cost=1.24..8,695.77 rows=1 width=66) (actual time=502.009..502.009 rows=0 loops=1)

64. 0.197 500.603 ↓ 242.0 242 1

Nested Loop (cost=0.81..8,639.75 rows=1 width=66) (actual time=495.809..500.603 rows=242 loops=1)

65. 495.808 495.808 ↑ 4.1 242 1

Function Scan on reprodutivo_partos_perdas f (cost=0.25..10.25 rows=1,000 width=66) (actual time=495.754..495.808 rows=242 loops=1)

66. 4.598 4.598 ↑ 1.0 1 242

Index Scan using vw_modelo_reprodutivo_data_hora_cobertura_idx on vw_modelo_reprodutivo vw_2 (cost=0.56..8.62 rows=1 width=8) (actual time=0.018..0.019 rows=1 loops=242)

  • Index Cond: ((femea_id = f.femea_id) AND (propriedade_id = 3144) AND (contrato_id = 16))
  • Filter: ((categoria_femea <> 'Novilha'::text) AND (f.cobertura_id = cobertura_id))
  • Rows Removed by Filter: 5
67. 1.210 1.210 ↑ 1.0 1 242

Index Scan using vw_modelo_reprodutivo_femea_id_idx on vw_modelo_reprodutivo v_2 (cost=0.43..28.22 rows=1 width=4) (actual time=0.005..0.005 rows=1 loops=242)

  • Index Cond: (f.femea_id = femea_id)
  • Filter: ((situacao_cria = 'Vivo'::text) AND (propriedade_id = 3144) AND (contrato_id = 16))
  • Rows Removed by Filter: 1
68. 119.138 119.138 ↓ 2.8 2,836 1

Function Scan on reprodutivo_partos_realizados f_1 (cost=0.25..10.25 rows=1,000 width=66) (actual time=117.991..119.138 rows=2,836 loops=1)

69.          

CTE last_cobertura

70. 6.240 61.235 ↓ 6.9 6,040 1

WindowAgg (cost=10,425.36..10,442.82 rows=873 width=73) (actual time=53.544..61.235 rows=6,040 loops=1)

71. 6.425 54.995 ↓ 6.9 6,040 1

Sort (cost=10,425.36..10,427.54 rows=873 width=73) (actual time=53.528..54.995 rows=6,040 loops=1)

  • Sort Key: a_9.id, vw_3.data_hora_cobertura DESC
  • Sort Method: quicksort Memory: 1042kB
72. 4.062 48.570 ↓ 6.9 6,040 1

Nested Loop (cost=0.56..10,382.71 rows=873 width=73) (actual time=0.049..48.570 rows=6,040 loops=1)

73. 5.196 5.196 ↓ 3.6 4,368 1

CTE Scan on animais_supostamente_aptos a_9 (cost=0.00..24.22 rows=1,211 width=4) (actual time=0.001..5.196 rows=4,368 loops=1)

74. 39.312 39.312 ↑ 1.0 1 4,368

Index Scan using vw_modelo_reprodutivo_data_hora_cobertura_idx on vw_modelo_reprodutivo vw_3 (cost=0.56..8.54 rows=1 width=69) (actual time=0.007..0.009 rows=1 loops=4,368)

  • Index Cond: ((femea_id = a_9.id) AND (data_hora_cobertura >= '2018-07-01 00:00:00-03'::timestamp with time zone) AND (data_hora_cobertura <= '2019-03-31 00:00:00-03'::timestamp with time zone))
75. 7.550 19,745.342 ↓ 2.9 4,368 1

Hash Left Join (cost=93.74..190.89 rows=1,496 width=505) (actual time=19,728.234..19,745.342 rows=4,368 loops=1)

  • Hash Cond: ((a.identificacao_usual)::text = (r.identificacao_usual)::text)
76. 3.624 19,732.729 ↓ 3.6 4,368 1

Hash Left Join (cost=85.71..119.55 rows=1,211 width=415) (actual time=19,723.130..19,732.729 rows=4,368 loops=1)

  • Hash Cond: (a.id = apt.id_animal)
77. 4.721 19,726.763 ↓ 3.6 4,368 1

Hash Left Join (cost=85.55..114.55 rows=1,211 width=411) (actual time=19,720.760..19,726.763 rows=4,368 loops=1)

  • Hash Cond: (a.id = l.femea_id)
78. 19,637.297 19,637.297 ↓ 3.6 4,368 1

CTE Scan on animais_supostamente_aptos a (cost=0.00..24.22 rows=1,211 width=95) (actual time=19,635.981..19,637.297 rows=4,368 loops=1)

79. 1.690 84.745 ↓ 732.5 2,930 1

Hash (cost=85.50..85.50 rows=4 width=316) (actual time=84.745..84.745 rows=2,930 loops=1)

  • Buckets: 4096 (originally 1024) Batches: 1 (originally 1) Memory Usage: 310kB
80. 2.181 83.055 ↓ 732.5 2,930 1

Nested Loop Left Join (cost=1.29..85.50 rows=4 width=316) (actual time=53.571..83.055 rows=2,930 loops=1)

81. 1.254 80.874 ↓ 732.5 2,930 1

Nested Loop Left Join (cost=0.86..55.63 rows=4 width=314) (actual time=53.567..80.874 rows=2,930 loops=1)

82. 0.595 73.760 ↓ 732.5 2,930 1

Nested Loop Left Join (cost=0.43..53.47 rows=4 width=314) (actual time=53.562..73.760 rows=2,930 loops=1)

83. 67.305 67.305 ↓ 732.5 2,930 1

CTE Scan on last_cobertura l (cost=0.00..19.64 rows=4 width=306) (actual time=53.555..67.305 rows=2,930 loops=1)

  • Filter: (ordem = 1)
  • Rows Removed by Filter: 3110
84. 5.860 5.860 ↓ 0.0 0 2,930

Index Scan using mbw_parto_pkey on mbw_parto p (cost=0.43..8.45 rows=1 width=8) (actual time=0.002..0.002 rows=0 loops=2,930)

  • Index Cond: (l.parto_id = id)
85. 5.860 5.860 ↓ 0.0 0 2,930

Index Scan using mbw_partocria_6e4499ea on mbw_partocria pc (cost=0.43..0.53 rows=1 width=8) (actual time=0.002..0.002 rows=0 loops=2,930)

  • Index Cond: (parto_id = p.id)
  • Filter: (situacao_cria = ANY ('{1,2}'::integer[]))
  • Rows Removed by Filter: 0
86. 0.000 0.000 ↓ 0.0 0 2,930

Index Scan using mbw_animal_pkey on mbw_animal c (cost=0.43..7.46 rows=1 width=6) (actual time=0.000..0.000 rows=0 loops=2,930)

  • Index Cond: (id = pc.cria_id)
87. 1.271 2.342 ↓ 1,028.4 5,142 1

Hash (cost=0.10..0.10 rows=5 width=4) (actual time=2.342..2.342 rows=5,142 loops=1)

  • Buckets: 8192 (originally 1024) Batches: 1 (originally 1) Memory Usage: 245kB
88. 1.071 1.071 ↓ 1,028.4 5,142 1

CTE Scan on animais_aptos apt (cost=0.00..0.10 rows=5 width=4) (actual time=0.002..1.071 rows=5,142 loops=1)

89. 2.774 5.063 ↓ 32.8 8,101 1

Hash (cost=4.94..4.94 rows=247 width=90) (actual time=5.063..5.063 rows=8,101 loops=1)

  • Buckets: 8192 (originally 1024) Batches: 1 (originally 1) Memory Usage: 489kB
90. 2.289 2.289 ↓ 32.8 8,101 1

CTE Scan on retirada_em r (cost=0.00..4.94 rows=247 width=90) (actual time=0.003..2.289 rows=8,101 loops=1)

Planning time : 9.899 ms
Execution time : 19,759.348 ms