explain.depesz.com

PostgreSQL's explain analyze made readable

Result: mXnY

Settings
# exclusive inclusive rows x rows loops node
1. 0.065 23,610.785 ↓ 113.0 113 1

Unique (cost=15,257.13..15,257.19 rows=1 width=385) (actual time=23,610.715..23,610.785 rows=113 loops=1)

2.          

CTE animais_consulta

3. 15,267.814 15,267.814 ↓ 4.7 4,720 1

Function Scan on obtenha_animais_estoque_por_propriedade (cost=0.25..10.25 rows=1,000 width=52) (actual time=15,264.873..15,267.814 rows=4,720 loops=1)

4.          

CTE procotoco_cobertura

5. 115.637 19,483.049 ↓ 18,074.5 108,447 1

WindowAgg (cost=2,923.07..2,923.31 rows=6 width=126) (actual time=19,338.638..19,483.049 rows=108,447 loops=1)

6. 132.254 19,367.412 ↓ 18,074.5 108,447 1

Sort (cost=2,923.07..2,923.08 rows=6 width=86) (actual time=19,338.610..19,367.412 rows=108,447 loops=1)

  • Sort Key: c_1.femea_id, c_1.data_hora_cobertura, t2.inicio_id
  • Sort Method: external merge Disk: 10760kB
7. 95.119 19,235.158 ↓ 18,074.5 108,447 1

WindowAgg (cost=2,922.78..2,922.99 rows=6 width=86) (actual time=19,113.430..19,235.158 rows=108,447 loops=1)

8. 196.887 19,140.039 ↓ 18,074.5 108,447 1

Sort (cost=2,922.78..2,922.79 rows=6 width=78) (actual time=19,113.412..19,140.039 rows=108,447 loops=1)

  • Sort Key: c_1.femea_id, c_1.data_hora_cobertura, (abs((date_part('epoch'::text, c_1.data_hora_cobertura) - date_part('epoch'::text, (t2.data)::timestamp without time zone))))
  • Sort Method: external merge Disk: 9736kB
9. 219.826 18,943.152 ↓ 18,074.5 108,447 1

Nested Loop (cost=2.85..2,922.70 rows=6 width=78) (actual time=15,267.397..18,943.152 rows=108,447 loops=1)

10. 111.687 18,397.985 ↓ 18,074.5 108,447 1

Nested Loop (cost=2.43..2,915.32 rows=6 width=74) (actual time=15,267.326..18,397.985 rows=108,447 loops=1)

11. 52.156 17,960.957 ↓ 13,555.9 108,447 1

Nested Loop (cost=2.15..2,907.54 rows=8 width=47) (actual time=15,267.273..17,960.957 rows=108,447 loops=1)

12. 48.370 15,619.151 ↓ 2,312.8 20,815 1

Nested Loop (cost=1.58..2,728.71 rows=9 width=31) (actual time=15,265.176..15,619.151 rows=20,815 loops=1)

  • Join Filter: ((a_1.id = c_1.femea_id) AND ((c_1.data_hora_cobertura)::date >= me_1.data_inicio))
  • Rows Removed by Join Filter: 22230
13. 9.900 15,449.839 ↓ 1,679.8 6,719 1

Nested Loop (cost=1.15..2,714.94 rows=4 width=23) (actual time=15,265.088..15,449.839 rows=6,719 loops=1)

14. 8.390 15,372.749 ↓ 1,679.8 6,719 1

Nested Loop (cost=0.86..2,710.61 rows=4 width=23) (actual time=15,265.049..15,372.749 rows=6,719 loops=1)

15. 11.444 15,317.159 ↓ 196.7 4,720 1

Nested Loop (cost=0.43..2,659.60 rows=24 width=15) (actual time=15,264.920..15,317.159 rows=4,720 loops=1)

16. 15,272.675 15,272.675 ↓ 4.7 4,720 1

CTE Scan on animais_consulta ap (cost=0.00..20.00 rows=1,000 width=4) (actual time=15,264.876..15,272.675 rows=4,720 loops=1)

17. 33.040 33.040 ↑ 1.0 1 4,720

Index Scan using mbw_animal_pkey on mbw_animal a_1 (cost=0.43..2.64 rows=1 width=11) (actual time=0.007..0.007 rows=1 loops=4,720)

  • Index Cond: (id = ap.id)
  • Filter: (contrato_id = 16)
18. 47.200 47.200 ↑ 3.0 1 4,720

Index Scan using mbw_estacaomontaiafemeas_33c37742 on mbw_estacaomontaiafemeas f_1 (cost=0.43..2.10 rows=3 width=8) (actual time=0.006..0.010 rows=1 loops=4,720)

  • Index Cond: (animal_id = a_1.id)
19. 67.190 67.190 ↑ 1.0 1 6,719

Index Scan using mbw_estacaomontaia_pkey on mbw_estacaomontaia me_1 (cost=0.29..1.08 rows=1 width=8) (actual time=0.010..0.010 rows=1 loops=6,719)

  • Index Cond: (id = f_1.estacao_ia_id)
20. 120.942 120.942 ↑ 1.0 6 6,719

Index Scan using mbw_cobertura_24f7cd40 on mbw_cobertura c_1 (cost=0.43..3.34 rows=6 width=12) (actual time=0.006..0.018 rows=6 loops=6,719)

  • Index Cond: (femea_id = f_1.animal_id)
21. 2,289.650 2,289.650 ↓ 5.0 5 20,815

Index Scan using mbw_tratamentoanimal_33c37742 on mbw_tratamentoanimal t2 (cost=0.56..19.86 rows=1 width=32) (actual time=0.049..0.110 rows=5 loops=20,815)

  • Index Cond: (animal_id = c_1.femea_id)
  • Filter: ((data_protocolo IS NOT NULL) AND (data <= c_1.data_hora_cobertura) AND (data >= ((c_1.data_hora_cobertura)::date + '-5 days'::interval)))
  • Rows Removed by Filter: 61
22. 325.341 325.341 ↑ 1.0 1 108,447

Index Scan using mbw_protocolo_pkey on mbw_protocolo p (cost=0.28..0.97 rows=1 width=31) (actual time=0.003..0.003 rows=1 loops=108,447)

  • Index Cond: (id = t2.protocolo_id)
  • Filter: (tipo <> 0)
23. 325.341 325.341 ↑ 1.0 1 108,447

Index Only Scan using mbw_material_pkey on mbw_material (cost=0.42..1.22 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=108,447)

  • Index Cond: (id = t2.tratamento_id)
  • Heap Fetches: 108447
24.          

CTE dg

25. 15.921 163.848 ↓ 84.2 15,492 1

WindowAgg (cost=10,947.62..10,951.30 rows=184 width=28) (actual time=145.666..163.848 rows=15,492 loops=1)

26. 9.724 147.927 ↓ 84.2 15,492 1

Sort (cost=10,947.62..10,948.08 rows=184 width=20) (actual time=145.651..147.927 rows=15,492 loops=1)

  • Sort Key: r1.cobertura_id, r1.data_exame
  • Sort Method: quicksort Memory: 1595kB
27. 14.373 138.203 ↓ 84.2 15,492 1

WindowAgg (cost=10,937.02..10,940.70 rows=184 width=20) (actual time=120.815..138.203 rows=15,492 loops=1)

28. 12.870 123.830 ↓ 84.2 15,492 1

Sort (cost=10,937.02..10,937.48 rows=184 width=12) (actual time=120.796..123.830 rows=15,492 loops=1)

  • Sort Key: r1.cobertura_id, r1.data_exame DESC
  • Sort Method: quicksort Memory: 1111kB
29. 14.961 110.960 ↓ 84.2 15,492 1

Nested Loop (cost=0.87..10,930.10 rows=184 width=12) (actual time=0.085..110.960 rows=15,492 loops=1)

30. 3.485 37.855 ↓ 2.5 14,536 1

Nested Loop (cost=0.43..8,102.27 rows=5,869 width=4) (actual time=0.030..37.855 rows=14,536 loops=1)

31. 1.330 1.330 ↓ 4.7 4,720 1

CTE Scan on animais_consulta ap_1 (cost=0.00..20.00 rows=1,000 width=4) (actual time=0.002..1.330 rows=4,720 loops=1)

32. 33.040 33.040 ↑ 2.0 3 4,720

Index Scan using mbw_cobertura_24f7cd40 on mbw_cobertura c_2 (cost=0.43..8.02 rows=6 width=8) (actual time=0.003..0.007 rows=3 loops=4,720)

  • Index Cond: (femea_id = ap_1.id)
33. 58.144 58.144 ↑ 1.0 1 14,536

Index Scan using mbw_resultadodiagnosticogestacao_33024c41 on mbw_resultadodiagnosticogestacao r1 (cost=0.43..0.47 rows=1 width=12) (actual time=0.004..0.004 rows=1 loops=14,536)

  • Index Cond: (cobertura_id = c_2.id)
  • Filter: (contrato_id = 16)
34.          

CTE ultimo_dg

35. 8.045 213.626 ↓ 11,520.0 11,520 1

Nested Loop (cost=0.43..6.79 rows=1 width=16) (actual time=145.739..213.626 rows=11,520 loops=1)

36. 171.021 171.021 ↓ 11,520.0 11,520 1

CTE Scan on dg d (cost=0.00..4.14 rows=1 width=4) (actual time=145.669..171.021 rows=11,520 loops=1)

  • Filter: (ordem_desc = 1)
  • Rows Removed by Filter: 3972
37. 34.560 34.560 ↑ 1.0 1 11,520

Index Scan using mbw_resultadodiagnosticogestacao_pkey on mbw_resultadodiagnosticogestacao r (cost=0.43..2.65 rows=1 width=16) (actual time=0.003..0.003 rows=1 loops=11,520)

  • Index Cond: (id = d.id_diagnostico)
38.          

CTE av_ovariana

39. 0.042 10.322 ↓ 56.5 113 1

Unique (cost=1,068.55..1,068.58 rows=2 width=52) (actual time=10.272..10.322 rows=113 loops=1)

40. 0.134 10.280 ↓ 56.5 113 1

Sort (cost=1,068.55..1,068.55 rows=2 width=52) (actual time=10.270..10.280 rows=113 loops=1)

  • Sort Key: "*SELECT* 1".avalicacao_ovariana, "*SELECT* 1".femea_id, "*SELECT* 1".ordem, (0), "*SELECT* 1".data_avaliacao
  • Sort Method: quicksort Memory: 33kB
41. 0.019 10.146 ↓ 56.5 113 1

Append (cost=924.05..1,068.54 rows=2 width=52) (actual time=10.005..10.146 rows=113 loops=1)

42. 0.002 3.172 ↓ 0.0 0 1

Subquery Scan on *SELECT* 1 (cost=924.05..924.08 rows=1 width=23) (actual time=3.172..3.172 rows=0 loops=1)

43. 0.004 3.170 ↓ 0.0 0 1

WindowAgg (cost=924.05..924.07 rows=1 width=31) (actual time=3.170..3.170 rows=0 loops=1)

44. 0.008 3.166 ↓ 0.0 0 1

Sort (cost=924.05..924.05 rows=1 width=15) (actual time=3.166..3.166 rows=0 loops=1)

  • Sort Key: ov_1.animal_id, ov_1.data_hora_avaliacao DESC
  • Sort Method: quicksort Memory: 25kB
45. 0.001 3.158 ↓ 0.0 0 1

Nested Loop (cost=636.06..924.04 rows=1 width=15) (actual time=3.158..3.158 rows=0 loops=1)

46. 0.002 3.157 ↓ 0.0 0 1

Nested Loop (cost=635.79..923.72 rows=1 width=16) (actual time=3.157..3.157 rows=0 loops=1)

  • Join Filter: ((ov_1.animal_id = t_1.animal_id) AND ((ov_1.data_hora_avaliacao)::date = t_1.data_protocolo))
47. 0.001 3.155 ↓ 0.0 0 1

Nested Loop (cost=635.22..798.82 rows=20 width=24) (actual time=3.155..3.155 rows=0 loops=1)

  • Join Filter: (ov_1.data_hora_avaliacao >= me_2.data_inicio)
48. 0.002 3.154 ↓ 0.0 0 1

Nested Loop (cost=634.94..779.43 rows=61 width=28) (actual time=3.154..3.154 rows=0 loops=1)

  • Join Filter: (ov_1.animal_id = f_2.animal_id)
49. 1.055 3.152 ↓ 0.0 0 1

Hash Join (cost=634.51..672.24 rows=23 width=20) (actual time=3.151..3.152 rows=0 loops=1)

  • Hash Cond: (ap_2.id = ov_1.animal_id)
50. 1.082 1.082 ↓ 4.7 4,720 1

CTE Scan on animais_consulta ap_2 (cost=0.00..20.00 rows=1,000 width=4) (actual time=0.002..1.082 rows=4,720 loops=1)

51. 0.284 1.015 ↑ 1.0 789 1

Hash (cost=624.40..624.40 rows=809 width=16) (actual time=1.015..1.015 rows=789 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 49kB
52. 0.616 0.731 ↑ 1.0 789 1

Bitmap Heap Scan on mbw_avaliacao_ovariana ov_1 (cost=9.86..624.40 rows=809 width=16) (actual time=0.144..0.731 rows=789 loops=1)

  • Recheck Cond: (contrato_id = 16)
  • Heap Blocks: exact=21
53. 0.115 0.115 ↑ 1.0 789 1

Bitmap Index Scan on mbw_avaliacao_ovariana_868819a8 (cost=0.00..9.66 rows=809 width=0) (actual time=0.115..0.115 rows=789 loops=1)

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

Index Scan using mbw_estacaomontaiafemeas_33c37742 on mbw_estacaomontaiafemeas f_2 (cost=0.43..4.62 rows=3 width=8) (never executed)

  • Index Cond: (animal_id = ap_2.id)
55. 0.000 0.000 ↓ 0.0 0

Index Scan using mbw_estacaomontaia_pkey on mbw_estacaomontaia me_2 (cost=0.29..0.31 rows=1 width=8) (never executed)

  • Index Cond: (id = f_2.estacao_ia_id)
56. 0.000 0.000 ↓ 0.0 0

Index Scan using mbw_tratamentoanimal_33c37742 on mbw_tratamentoanimal t_1 (cost=0.56..5.51 rows=42 width=8) (never executed)

  • Index Cond: (animal_id = f_2.animal_id)
57. 0.000 0.000 ↓ 0.0 0

Index Scan using mbw_corpoluteo_pkey on mbw_corpoluteo c_3 (cost=0.28..0.32 rows=1 width=7) (never executed)

  • Index Cond: (id = ov_1.corpo_luteo_id)
58. 0.023 6.955 ↓ 113.0 113 1

Subquery Scan on *SELECT* 2 (cost=144.39..144.44 rows=1 width=52) (actual time=6.829..6.955 rows=113 loops=1)

59. 0.113 6.932 ↓ 113.0 113 1

WindowAgg (cost=144.39..144.43 rows=1 width=52) (actual time=6.826..6.932 rows=113 loops=1)

60. 0.083 6.819 ↓ 113.0 113 1

Sort (cost=144.39..144.39 rows=1 width=12) (actual time=6.810..6.819 rows=113 loops=1)

  • Sort Key: c_4.femea_id, r_1.data_exame
  • Sort Method: quicksort Memory: 30kB
61. 0.125 6.736 ↓ 113.0 113 1

Nested Loop (cost=34.08..144.38 rows=1 width=12) (actual time=2.051..6.736 rows=113 loops=1)

  • Join Filter: (r_1.data_exame >= me_3.data_inicio)
  • Rows Removed by Join Filter: 423
62. 0.057 5.539 ↓ 536.0 536 1

Nested Loop (cost=33.79..141.86 rows=1 width=16) (actual time=1.981..5.539 rows=536 loops=1)

63. 0.321 3.386 ↓ 524.0 524 1

Nested Loop (cost=33.36..141.38 rows=1 width=12) (actual time=1.945..3.386 rows=524 loops=1)

  • Join Filter: (f_3.animal_id = c_4.femea_id)
64. 0.106 2.051 ↓ 78.0 78 1

Hash Join (cost=32.93..133.28 rows=1 width=12) (actual time=1.904..2.051 rows=78 loops=1)

  • Hash Cond: (f_3.animal_id = ap_3.id)
65. 0.138 0.138 ↑ 1.1 78 1

Index Scan using mbw_estacaomontaiafemeas_5a04dd8d on mbw_estacaomontaiafemeas f_3 (cost=0.43..89.80 rows=86 width=8) (actual time=0.076..0.138 rows=78 loops=1)

  • Index Cond: (estacao_ia_id = 25081)
66. 0.937 1.807 ↓ 4.7 4,720 1

Hash (cost=20.00..20.00 rows=1,000 width=4) (actual time=1.807..1.807 rows=4,720 loops=1)

  • Buckets: 8192 (originally 1024) Batches: 1 (originally 1) Memory Usage: 230kB
67. 0.870 0.870 ↓ 4.7 4,720 1

CTE Scan on animais_consulta ap_3 (cost=0.00..20.00 rows=1,000 width=4) (actual time=0.002..0.870 rows=4,720 loops=1)

68. 1.014 1.014 ↓ 1.2 7 78

Index Scan using mbw_cobertura_24f7cd40 on mbw_cobertura c_4 (cost=0.43..8.02 rows=6 width=8) (actual time=0.005..0.013 rows=7 loops=78)

  • Index Cond: (femea_id = ap_3.id)
69. 2.096 2.096 ↑ 1.0 1 524

Index Scan using mbw_resultadodiagnosticogestacao_33024c41 on mbw_resultadodiagnosticogestacao r_1 (cost=0.43..0.47 rows=1 width=12) (actual time=0.003..0.004 rows=1 loops=524)

  • Index Cond: (cobertura_id = c_4.id)
  • Filter: (contrato_id = 16)
70. 1.072 1.072 ↑ 1.0 1 536

Index Scan using mbw_estacaomontaia_pkey on mbw_estacaomontaia me_3 (cost=0.29..2.51 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=536)

  • Index Cond: (id = 25081)
71. 0.858 23,610.720 ↓ 113.0 113 1

Sort (cost=296.90..296.91 rows=1 width=385) (actual time=23,610.714..23,610.720 rows=113 loops=1)

  • Sort Key: a.identificacao_usual, po.descricao, a.id, a.identificacao_secundaria, t.identificacao_usual, t.id, f.data_entrada, f.data_saida, me.data_inicio, (CASE WHEN (ov.avalicacao_ovariana IS NOT NULL) THEN ov.avalicacao_ovariana WHEN (pf.resultado_exame = 0) THEN (CASE WHEN (pf.caracteristica_resultado = 0) THEN 'Normal'::text WHEN (pf.caracteristica_resultado = 1) THEN 'Reabsorvendo'::text WHEN (pf.caracteristica_resultado = 2) THEN 'Gemelar'::text ELSE NULL::text END)::character varying WHEN (pf.resultado_exame = 1) THEN (CASE WHEN (pf.caracteristica_resultado = 0) THEN 'Sem Avaliação'::text WHEN (pf.caracteristica_resultado = 1) THEN 'Em Anestro'::text WHEN (pf.caracteristica_resultado = 2) THEN 'C.Lúteo'::text WHEN (pf.caracteristica_resultado = 3) THEN 'Folículo'::text WHEN (pf.caracteristica_resultado = 4) THEN 'Cisto'::text ELSE NULL::text END)::character varying ELSE NULL::character varying END), po.responsavel_id, po.data_protocolo, po.id, (CASE WHEN ((po.primerira_retirada_implante IS NOT NULL) AND (po.primerira_retirada_implante = 1)) THEN 'Retirou'::text WHEN ((po.primerira_retirada_implante IS NOT NULL) AND (po.primerira_retirada_implante = 2)) THEN 'Perdeu'::text ELSE NULL::text END), pm.valor, c.id, c.data_hora_cobertura, (CASE WHEN (c.situacao = 0) THEN 'Vazia'::text WHEN (c.situacao = 1) THEN 'Servida'::text WHEN (c.situacao = 2) THEN 'Gestante'::text WHEN (c.situacao = 3) THEN 'Parida'::text ELSE NULL::text END), insem.nome, pf.data_exame, pf.caracteristica_resultado, (CASE WHEN (pf.resultado_exame = 0) THEN 'Positivo'::text WHEN (pf.resultado_exame = 1) THEN 'Negativo'::text ELSE NULL::text END), pa.data_parto, (CASE WHEN (me.origem_informacao = 1) THEN 'MB BOOK'::text WHEN (me.origem_informacao = 2) THEN 'MB GENETICS'::text WHEN (me.origem_informacao = 3) THEN 'SISBOV'::text WHEN (me.origem_informacao = 4) THEN 'MS TASKS'::text WHEN (me.origem_informacao = 5) THEN 'MB IVF'::text WHEN (me.origem_informacao = 6) THEN 'MS COMERCIAL'::text WHEN (me.origem_informacao = 7) THEN 'MB CURRAL'::text ELSE NULL::text END)
  • Sort Method: quicksort Memory: 55kB
72. 1.227 23,609.862 ↓ 113.0 113 1

Nested Loop Left Join (cost=193.11..296.89 rows=1 width=385) (actual time=19,578.233..23,609.862 rows=113 loops=1)

73. 2.636 23,605.584 ↓ 113.0 113 1

Nested Loop Left Join (cost=192.68..294.31 rows=1 width=247) (actual time=19,578.135..23,605.584 rows=113 loops=1)

  • Join Filter: ((ov.femea_id = f.animal_id) AND (ov.data_avaliacao = po.data_protocolo))
  • Rows Removed by Join Filter: 12735
74. 0.966 23,589.840 ↓ 113.0 113 1

Nested Loop Left Join (cost=192.68..294.24 rows=1 width=219) (actual time=19,567.753..23,589.840 rows=113 loops=1)

75. 175.302 23,585.258 ↓ 113.0 113 1

Nested Loop Left Join (cost=192.25..291.59 rows=1 width=215) (actual time=19,567.707..23,585.258 rows=113 loops=1)

  • Join Filter: (pf.cobertura_id = c.id)
  • Rows Removed by Join Filter: 1301647
76. 1.296 22,925.412 ↓ 113.0 113 1

Nested Loop Left Join (cost=192.25..291.55 rows=1 width=207) (actual time=19,353.466..22,925.412 rows=113 loops=1)

77. 272.281 22,918.579 ↓ 113.0 113 1

Nested Loop Left Join (cost=191.69..288.76 rows=1 width=199) (actual time=19,353.378..22,918.579 rows=113 loops=1)

  • Join Filter: ((po.data <= c.data_hora_cobertura) AND (po.femea_id = f.animal_id) AND (po.data >= ((c.data_hora_cobertura)::date + '-5 days'::interval)))
  • Rows Removed by Join Filter: 1064912
78. 0.585 12.963 ↓ 113.0 113 1

Nested Loop (cost=191.69..288.60 rows=1 width=65) (actual time=3.380..12.963 rows=113 loops=1)

79. 0.822 10.796 ↓ 113.0 113 1

Nested Loop (cost=191.25..285.95 rows=1 width=58) (actual time=3.335..10.796 rows=113 loops=1)

80. 0.469 6.584 ↓ 113.0 113 1

Nested Loop (cost=190.82..283.29 rows=1 width=44) (actual time=1.823..6.584 rows=113 loops=1)

81. 0.649 2.838 ↓ 113.0 113 1

Hash Join (cost=190.53..280.78 rows=1 width=46) (actual time=1.791..2.838 rows=113 loops=1)

  • Hash Cond: (f.animal_id = c.femea_id)
82. 0.457 0.457 ↑ 1.1 78 1

Index Scan using mbw_estacaomontaiafemeas_5a04dd8d on mbw_estacaomontaiafemeas f (cost=0.43..89.80 rows=86 width=16) (actual time=0.045..0.457 rows=78 loops=1)

  • Index Cond: (estacao_ia_id = 25081)
83. 0.039 1.732 ↑ 1.5 113 1

Hash (cost=188.02..188.02 rows=167 width=30) (actual time=1.732..1.732 rows=113 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 16kB
84. 1.693 1.693 ↑ 1.5 113 1

Index Scan using mbw_cobertura_5a04dd8d on mbw_cobertura c (cost=0.43..188.02 rows=167 width=30) (actual time=1.562..1.693 rows=113 loops=1)

  • Index Cond: (estacao_ia_id = 25081)
85. 3.277 3.277 ↑ 1.0 1 113

Index Scan using mbw_estacaomontaia_pkey on mbw_estacaomontaia me (cost=0.29..2.51 rows=1 width=10) (actual time=0.023..0.029 rows=1 loops=113)

  • Index Cond: (id = 25081)
86. 3.390 3.390 ↑ 1.0 1 113

Index Scan using mbw_animal_pkey on mbw_animal a (cost=0.43..2.65 rows=1 width=18) (actual time=0.030..0.030 rows=1 loops=113)

  • Index Cond: (id = c.femea_id)
87. 1.582 1.582 ↑ 1.0 1 113

Index Scan using mbw_animal_pkey on mbw_animal t (cost=0.43..2.65 rows=1 width=11) (actual time=0.014..0.014 rows=1 loops=113)

  • Index Cond: (id = c.macho_id)
88. 22,633.335 22,633.335 ↓ 9,425.0 9,425 113

CTE Scan on procotoco_cobertura po (cost=0.00..0.14 rows=1 width=142) (actual time=171.147..200.295 rows=9,425 loops=113)

  • Filter: (rn = 1)
  • Rows Removed by Filter: 99022
89. 5.537 5.537 ↑ 1.0 1 113

Index Scan using mbw_pesagem_medicao_data_avaliacao_animal_aquisicao on mbw_pesagem_medicao pm (cost=0.56..2.79 rows=1 width=16) (actual time=0.046..0.049 rows=1 loops=113)

  • Index Cond: ((animal_id = f.animal_id) AND (data_avaliacao = po.data_protocolo) AND (avaliacao_id = 91))
90. 484.544 484.544 ↓ 11,520.0 11,520 113

CTE Scan on ultimo_dg pf (cost=0.00..0.02 rows=1 width=12) (actual time=1.291..4.288 rows=11,520 loops=113)

91. 3.616 3.616 ↓ 0.0 0 113

Index Scan using mbw_parto_33024c41 on mbw_parto pa (cost=0.43..2.64 rows=1 width=8) (actual time=0.032..0.032 rows=0 loops=113)

  • Index Cond: (c.id = cobertura_id)
92. 13.108 13.108 ↓ 56.5 113 113

CTE Scan on av_ovariana ov (cost=0.00..0.04 rows=2 width=40) (actual time=0.091..0.116 rows=113 loops=113)

93. 3.051 3.051 ↑ 1.0 1 113

Index Scan using mbw_entidade_pkey on mbw_entidade insem (cost=0.42..2.52 rows=1 width=28) (actual time=0.027..0.027 rows=1 loops=113)

  • Index Cond: (id = c.responsavel_id)
Planning time : 37.193 ms
Execution time : 23,622.547 ms