explain.depesz.com

PostgreSQL's explain analyze made readable

Result: XOsR

Settings
# exclusive inclusive rows x rows loops node
1. 10.912 32,784.918 ↓ 2.9 4,368 1

HashAggregate (cost=159,039.50..159,061.94 rows=1,496 width=505) (actual time=32,781.988..32,784.918 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. 4,793.698 4,793.698 ↓ 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=4,789.491..4,793.698 rows=5,142 loops=1)

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

CTE novilhas

5. 7.859 7,117.873 ↓ 7.2 1,468 1

HashAggregate (cost=17,031.87..17,033.91 rows=204 width=11) (actual time=7,117.437..7,117.873 rows=1,468 loops=1)

  • Group Key: a_1.id, a_1.identificacao_usual, ('novilha'::text)
6. 1.401 7,110.014 ↓ 21.4 4,373 1

Append (cost=48.67..17,030.34 rows=204 width=11) (actual time=4.498..7,110.014 rows=4,373 loops=1)

7. 22.081 2,267.154 ↓ 17.7 3,570 1

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

8. 7.229 2,183.795 ↓ 101.1 20,426 1

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

9. 17.668 19.086 ↓ 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.644..19.086 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.418 1.418 ↓ 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.418..1.418 rows=7,908 loops=1)

  • Index Cond: (propriedade_id = 3144)
11. 2,157.480 2,157.480 ↓ 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.107..0.585 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.224 4,828.028 ↓ 757.0 757 1

Nested Loop Anti Join (cost=0.99..50.28 rows=1 width=11) (actual time=4,789.555..4,828.028 rows=757 loops=1)

14. 4.564 4,815.293 ↓ 3,837.0 3,837 1

Nested Loop (cost=0.43..42.55 rows=1 width=11) (actual time=4,789.537..4,815.293 rows=3,837 loops=1)

15. 4,795.303 4,795.303 ↓ 1,028.4 5,142 1

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

16. 15.426 15.426 ↑ 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.003 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.194 13.431 ↓ 46.0 46 1

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

19. 1.197 12.321 ↓ 229.0 229 1

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

20. 0.840 0.840 ↓ 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.840 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. 0.916 0.916 ↑ 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.004..0.004 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. 8.387 237.056 ↓ 32.8 8,101 1

HashAggregate (cost=118,598.54..118,601.01 rows=247 width=11) (actual time=234.127..237.056 rows=8,101 loops=1)

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

Append (cost=40.73..118,596.68 rows=247 width=11) (actual time=3.456..228.669 rows=8,101 loops=1)

26. 0.984 179.426 ↓ 30.8 1,633 1

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

27. 1.180 1.342 ↑ 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.179..1.342 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.162 0.162 ↑ 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.162..0.162 rows=1,933 loops=1)

  • Index Cond: (contrato_id = 16)
29. 177.100 177.100 ↑ 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.092..0.092 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. 3.675 4.875 ↓ 0.0 0 1

Bitmap Heap Scan on mbw_animal a_5 (cost=47.48..7,585.29 rows=12 width=11) (actual time=4.875..4.875 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. 1.200 1.200 ↓ 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.200..1.200 rows=7,908 loops=1)

  • Index Cond: (propriedade_id = 3144)
32. 0.046 5.863 ↓ 9.0 36 1

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

33. 0.012 5.673 ↓ 9.0 36 1

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

34. 0.040 3.681 ↑ 1.0 1 1

Bitmap Heap Scan on mbw_venda v (cost=31.59..35.61 rows=1 width=4) (actual time=3.670..3.681 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.006 3.641 ↓ 0.0 0 1

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

36. 2.048 2.048 ↑ 19.5 13 1

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

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

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

  • Index Cond: (contrato_id = 16)
38. 1.980 1.980 ↑ 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=1.955..1.980 rows=36 loops=1)

  • Index Cond: (venda_id = v.id)
39. 0.144 0.144 ↑ 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.004..0.004 rows=1 loops=36)

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

Nested Loop (cost=115.07..5,660.77 rows=1 width=11) (actual time=1.428..1.428 rows=0 loops=1)

41. 0.000 1.427 ↓ 0.0 0 1

Nested Loop (cost=114.64..5,652.79 rows=1 width=4) (actual time=1.427..1.427 rows=0 loops=1)

42. 1.427 1.427 ↓ 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.427..1.427 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.23 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.45 rows=5,736 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. 0.795 35.732 ↓ 36.3 6,432 1

Nested Loop (cost=175.82..85,611.09 rows=177 width=11) (actual time=6.124..35.732 rows=6,432 loops=1)

49. 3.150 9.209 ↑ 1.3 6,432 1

Bitmap Heap Scan on mbw_transferenciapropriedade t (cost=175.39..21,765.53 rows=8,185 width=4) (actual time=6.098..9.209 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. 6.059 6.059 ↑ 1.0 9,122 1

Bitmap Index Scan on mbw_transferenciapropriedade_f8de2aa4 (cost=0.00..173.35 rows=9,189 width=0) (actual time=6.059..6.059 rows=9,122 loops=1)

  • Index Cond: (propriedade_origem_id = 3144)
51. 25.728 25.728 ↑ 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.004 rows=1 loops=6,432)

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

CTE animais_supostamente_aptos

53. 5.662 32,644.611 ↓ 3.6 4,368 1

HashAggregate (cost=12,660.02..12,672.13 rows=1,211 width=71) (actual time=32,641.899..32,644.611 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.781 32,638.949 ↓ 3.6 4,413 1

Append (cost=1,771.74..12,644.88 rows=1,211 width=71) (actual time=7,123.600..32,638.949 rows=4,413 loops=1)

55. 1.145 7,123.885 ↓ 7.2 1,468 1

HashAggregate (cost=1,771.74..1,773.78 rows=204 width=98) (actual time=7,123.600..7,123.885 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.307 7,122.740 ↓ 7.2 1,468 1

Nested Loop Left Join (cost=0.56..1,769.19 rows=204 width=98) (actual time=7,117.447..7,122.740 rows=1,468 loops=1)

57. 7,118.497 7,118.497 ↓ 7.2 1,468 1

CTE Scan on novilhas n (cost=0.00..4.08 rows=204 width=94) (actual time=7,117.439..7,118.497 rows=1,468 loops=1)

58. 2.936 2.936 ↓ 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.002..0.002 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. 24,422.500 24,422.500 ↓ 7.6 38 1

Function Scan on reprodutivo_partos_previstos (cost=0.25..10.25 rows=5 width=66) (actual time=24,422.256..24,422.500 rows=38 loops=1)

  • Filter: (data_parto IS NULL)
  • Rows Removed by Filter: 2229
60. 5.766 270.806 ↓ 71.0 71 1

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

61. 240.737 240.737 ↓ 32.8 8,101 1

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

62. 24.303 24.303 ↓ 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.003..0.003 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.223 487.343 ↓ 0.0 0 1

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

64. 0.407 409.196 ↓ 242.0 242 1

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

65. 403.707 403.707 ↑ 4.1 242 1

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

66. 5.082 5.082 ↑ 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.019..0.021 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. 77.924 77.924 ↑ 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.322..0.322 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. 333.634 333.634 ↓ 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=332.667..333.634 rows=2,836 loops=1)

69.          

CTE last_cobertura

70. 7.466 69.852 ↓ 6.9 6,040 1

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

71. 8.072 62.386 ↓ 6.9 6,040 1

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

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

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

73. 6.102 6.102 ↓ 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..6.102 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.008..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. 9.159 32,774.006 ↓ 2.9 4,368 1

Hash Left Join (cost=93.72..190.87 rows=1,496 width=505) (actual time=32,755.012..32,774.006 rows=4,368 loops=1)

  • Hash Cond: ((a.identificacao_usual)::text = (r.identificacao_usual)::text)
76. 3.614 32,758.270 ↓ 3.6 4,368 1

Hash Left Join (cost=85.69..119.53 rows=1,211 width=415) (actual time=32,748.397..32,758.270 rows=4,368 loops=1)

  • Hash Cond: (a.id = apt.id_animal)
77. 4.847 32,752.104 ↓ 3.6 4,368 1

Hash Left Join (cost=85.53..114.53 rows=1,211 width=411) (actual time=32,745.816..32,752.104 rows=4,368 loops=1)

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

CTE Scan on animais_supostamente_aptos a (cost=0.00..24.22 rows=1,211 width=95) (actual time=32,641.903..32,643.382 rows=4,368 loops=1)

79. 2.180 103.875 ↓ 732.5 2,930 1

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

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

Nested Loop Left Join (cost=1.29..85.48 rows=4 width=316) (actual time=61.137..101.695 rows=2,930 loops=1)

81. 0.825 98.923 ↓ 732.5 2,930 1

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

82. 3.294 89.308 ↓ 732.5 2,930 1

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

83. 77.224 77.224 ↓ 732.5 2,930 1

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

  • Filter: (ordem = 1)
  • Rows Removed by Filter: 3110
84. 8.790 8.790 ↓ 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.003..0.003 rows=0 loops=2,930)

  • Index Cond: (l.parto_id = id)
85. 8.790 8.790 ↓ 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.003..0.003 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.45 rows=1 width=6) (actual time=0.000..0.000 rows=0 loops=2,930)

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

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

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

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

89. 3.640 6.577 ↓ 32.8 8,101 1

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

  • Buckets: 8192 (originally 1024) Batches: 1 (originally 1) Memory Usage: 489kB
90. 2.937 2.937 ↓ 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.937 rows=8,101 loops=1)

Planning time : 14.299 ms
Execution time : 32,788.097 ms