explain.depesz.com

PostgreSQL's explain analyze made readable

Result: q7PW

Settings
# exclusive inclusive rows x rows loops node
1. 0.060 19,945.759 ↓ 113.0 113 1

Unique (cost=12,474.22..12,474.29 rows=1 width=385) (actual time=19,945.694..19,945.759 rows=113 loops=1)

2.          

CTE animais_consulta

3. 18,451.608 18,451.608 ↓ 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=18,451.157..18,451.608 rows=4,720 loops=1)

4.          

CTE procotoco_cobertura

5. 0.026 18,488.208 ↑ 3.0 10 1

Unique (cost=130.54..131.44 rows=30 width=110) (actual time=18,488.179..18,488.208 rows=10 loops=1)

6. 0.081 18,488.182 ↓ 2.5 76 1

Sort (cost=130.54..130.61 rows=30 width=110) (actual time=18,488.178..18,488.182 rows=76 loops=1)

  • Sort Key: (first_value(t2.retirou_implante) OVER (?)), c_1.data_hora_cobertura, p.id, p.descricao, c_1.id, a_1.identificacao_usual, t2.data_protocolo, t2.responsavel_id, t2.inicio_id, t2.retirou_implante, (CASE WHEN ((t2.inicio_id IS NOT NULL) AND (t2.retirou_implante = 1)) THEN 'Retirou'::text WHEN ((t2.inicio_id IS NOT NULL) AND (t2.retirou_implante = 2)) THEN 'Perdeu'::text ELSE NULL::text END)
  • Sort Method: quicksort Memory: 35kB
7. 0.074 18,488.101 ↓ 2.5 76 1

WindowAgg (cost=128.98..129.80 rows=30 width=110) (actual time=18,488.042..18,488.101 rows=76 loops=1)

8. 0.085 18,488.027 ↓ 2.5 76 1

Sort (cost=128.98..129.05 rows=30 width=70) (actual time=18,488.022..18,488.027 rows=76 loops=1)

  • Sort Key: c_1.data_hora_cobertura, t2.inicio_id
  • Sort Method: quicksort Memory: 35kB
9. 0.033 18,487.942 ↓ 2.5 76 1

Nested Loop (cost=2.85..128.24 rows=30 width=70) (actual time=18,462.332..18,487.942 rows=76 loops=1)

10. 18,452.635 18,452.635 ↑ 5.0 1 1

CTE Scan on animais_consulta ap (cost=0.00..22.50 rows=5 width=4) (actual time=18,451.162..18,452.635 rows=1 loops=1)

  • Filter: (id = 887889)
  • Rows Removed by Filter: 4719
11. 0.078 35.274 ↓ 12.7 76 1

Materialize (cost=2.85..105.38 rows=6 width=74) (actual time=11.165..35.274 rows=76 loops=1)

12. 0.069 35.196 ↓ 12.7 76 1

Nested Loop (cost=2.85..105.35 rows=6 width=74) (actual time=11.159..35.196 rows=76 loops=1)

13. 0.068 29.959 ↓ 12.7 76 1

Nested Loop (cost=2.43..89.52 rows=6 width=78) (actual time=9.467..29.959 rows=76 loops=1)

14. 0.341 28.067 ↓ 9.5 76 1

Nested Loop (cost=2.15..73.19 rows=8 width=51) (actual time=9.440..28.067 rows=76 loops=1)

  • Join Filter: ((t2.data <= c_1.data_hora_cobertura) AND (t2.data >= ((c_1.data_hora_cobertura)::date + '-5 days'::interval)))
  • Rows Removed by Join Filter: 509
15. 18.483 18.483 ↓ 3.2 39 1

Index Scan using mbw_tratamentoanimal_33c37742 on mbw_tratamentoanimal t2 (cost=0.56..48.06 rows=12 width=32) (actual time=1.657..18.483 rows=39 loops=1)

  • Index Cond: (animal_id = 887889)
  • Filter: (data_protocolo IS NOT NULL)
  • Rows Removed by Filter: 31
16. 0.084 9.243 ↓ 2.5 15 39

Materialize (cost=1.58..23.52 rows=6 width=27) (actual time=0.137..0.237 rows=15 loops=39)

17. 0.051 9.159 ↓ 2.5 15 1

Nested Loop (cost=1.58..23.49 rows=6 width=27) (actual time=5.317..9.159 rows=15 loops=1)

  • Join Filter: ((c_1.data_hora_cobertura)::date >= me_1.data_inicio)
  • Rows Removed by Join Filter: 17
18. 4.844 4.844 ↓ 1.3 8 1

Index Scan using mbw_cobertura_24f7cd40 on mbw_cobertura c_1 (cost=0.43..8.12 rows=6 width=16) (actual time=2.610..4.844 rows=8 loops=1)

  • Index Cond: (femea_id = 887889)
19. 0.021 4.264 ↓ 1.3 4 8

Materialize (cost=1.15..15.07 rows=3 width=19) (actual time=0.337..0.533 rows=4 loops=8)

20. 0.055 4.243 ↓ 1.3 4 1

Nested Loop (cost=1.15..15.05 rows=3 width=19) (actual time=2.686..4.243 rows=4 loops=1)

21. 0.008 1.804 ↓ 1.3 4 1

Nested Loop (cost=0.86..7.54 rows=3 width=19) (actual time=1.782..1.804 rows=4 loops=1)

22. 0.027 0.027 ↑ 1.0 1 1

Index Scan using mbw_animal_pkey on mbw_animal a_1 (cost=0.43..2.66 rows=1 width=11) (actual time=0.025..0.027 rows=1 loops=1)

  • Index Cond: (id = 887889)
  • Filter: (contrato_id = 16)
23. 1.769 1.769 ↓ 1.3 4 1

Index Scan using mbw_estacaomontaiafemeas_33c37742 on mbw_estacaomontaiafemeas f_1 (cost=0.43..4.85 rows=3 width=8) (actual time=1.753..1.769 rows=4 loops=1)

  • Index Cond: (animal_id = 887889)
24. 2.384 2.384 ↑ 1.0 1 4

Index Scan using mbw_estacaomontaia_pkey on mbw_estacaomontaia me_1 (cost=0.29..2.51 rows=1 width=8) (actual time=0.596..0.596 rows=1 loops=4)

  • Index Cond: (id = f_1.estacao_ia_id)
25. 1.824 1.824 ↑ 1.0 1 76

Index Scan using mbw_protocolo_pkey on mbw_protocolo p (cost=0.28..2.04 rows=1 width=31) (actual time=0.024..0.024 rows=1 loops=76)

  • Index Cond: (id = t2.protocolo_id)
  • Filter: (tipo <> 0)
26. 5.168 5.168 ↑ 1.0 1 76

Index Only Scan using mbw_material_pkey on mbw_material (cost=0.42..2.64 rows=1 width=4) (actual time=0.068..0.068 rows=1 loops=76)

  • Index Cond: (id = t2.tratamento_id)
  • Heap Fetches: 76
27.          

CTE dg

28. 21.463 818.867 ↓ 84.7 15,492 1

WindowAgg (cost=10,949.21..10,952.87 rows=183 width=28) (actual time=794.611..818.867 rows=15,492 loops=1)

29. 11.485 797.404 ↓ 84.7 15,492 1

Sort (cost=10,949.21..10,949.67 rows=183 width=20) (actual time=794.588..797.404 rows=15,492 loops=1)

  • Sort Key: r1.cobertura_id, r1.data_exame
  • Sort Method: quicksort Memory: 1595kB
30. 28.407 785.919 ↓ 84.7 15,492 1

WindowAgg (cost=10,938.68..10,942.34 rows=183 width=20) (actual time=754.252..785.919 rows=15,492 loops=1)

31. 15.017 757.512 ↓ 84.7 15,492 1

Sort (cost=10,938.68..10,939.14 rows=183 width=12) (actual time=754.229..757.512 rows=15,492 loops=1)

  • Sort Key: r1.cobertura_id, r1.data_exame DESC
  • Sort Method: quicksort Memory: 1111kB
32. 18.199 742.495 ↓ 84.7 15,492 1

Nested Loop (cost=0.87..10,931.80 rows=183 width=12) (actual time=2.505..742.495 rows=15,492 loops=1)

33. 4.404 331.824 ↓ 2.5 14,536 1

Nested Loop (cost=0.43..8,104.45 rows=5,869 width=4) (actual time=0.023..331.824 rows=14,536 loops=1)

34. 1.740 1.740 ↓ 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.000..1.740 rows=4,720 loops=1)

35. 325.680 325.680 ↑ 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.023..0.069 rows=3 loops=4,720)

  • Index Cond: (femea_id = ap_1.id)
36. 392.472 392.472 ↑ 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.027..0.027 rows=1 loops=14,536)

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

CTE ultimo_dg

38. 7.907 1,008.295 ↓ 11,520.0 11,520 1

Nested Loop (cost=0.43..6.77 rows=1 width=16) (actual time=797.506..1,008.295 rows=11,520 loops=1)

39. 827.588 827.588 ↓ 11,520.0 11,520 1

CTE Scan on dg d (cost=0.00..4.12 rows=1 width=4) (actual time=794.617..827.588 rows=11,520 loops=1)

  • Filter: (ordem_desc = 1)
  • Rows Removed by Filter: 3972
40. 172.800 172.800 ↑ 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.015..0.015 rows=1 loops=11,520)

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

CTE av_ovariana

42. 0.033 22.316 ↓ 56.5 113 1

Unique (cost=1,073.94..1,073.97 rows=2 width=52) (actual time=22.278..22.316 rows=113 loops=1)

43. 0.127 22.283 ↓ 56.5 113 1

Sort (cost=1,073.94..1,073.95 rows=2 width=52) (actual time=22.276..22.283 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
44. 0.018 22.156 ↓ 56.5 113 1

Append (cost=929.44..1,073.93 rows=2 width=52) (actual time=22.003..22.156 rows=113 loops=1)

45. 0.002 11.245 ↓ 0.0 0 1

Subquery Scan on *SELECT* 1 (cost=929.44..929.48 rows=1 width=23) (actual time=11.245..11.245 rows=0 loops=1)

46. 0.004 11.243 ↓ 0.0 0 1

WindowAgg (cost=929.44..929.47 rows=1 width=31) (actual time=11.243..11.243 rows=0 loops=1)

47. 0.006 11.239 ↓ 0.0 0 1

Sort (cost=929.44..929.45 rows=1 width=15) (actual time=11.239..11.239 rows=0 loops=1)

  • Sort Key: ov_1.animal_id, ov_1.data_hora_avaliacao DESC
  • Sort Method: quicksort Memory: 25kB
48. 0.000 11.233 ↓ 0.0 0 1

Nested Loop (cost=641.37..929.43 rows=1 width=15) (actual time=11.233..11.233 rows=0 loops=1)

49. 0.002 11.233 ↓ 0.0 0 1

Nested Loop (cost=641.09..929.11 rows=1 width=16) (actual time=11.233..11.233 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))
50. 0.001 11.231 ↓ 0.0 0 1

Nested Loop (cost=640.53..804.13 rows=20 width=24) (actual time=11.231..11.231 rows=0 loops=1)

  • Join Filter: (ov_1.data_hora_avaliacao >= me_2.data_inicio)
51. 0.000 11.230 ↓ 0.0 0 1

Nested Loop (cost=640.24..784.73 rows=61 width=28) (actual time=11.230..11.230 rows=0 loops=1)

  • Join Filter: (ov_1.animal_id = f_2.animal_id)
52. 0.739 11.230 ↓ 0.0 0 1

Hash Join (cost=639.81..677.54 rows=23 width=20) (actual time=11.229..11.230 rows=0 loops=1)

  • Hash Cond: (ap_2.id = ov_1.animal_id)
53. 0.605 0.605 ↓ 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.003..0.605 rows=4,720 loops=1)

54. 0.220 9.886 ↑ 1.0 789 1

Hash (cost=629.62..629.62 rows=815 width=16) (actual time=9.886..9.886 rows=789 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 49kB
55. 7.954 9.666 ↑ 1.0 789 1

Bitmap Heap Scan on mbw_avaliacao_ovariana ov_1 (cost=9.91..629.62 rows=815 width=16) (actual time=1.732..9.666 rows=789 loops=1)

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

Bitmap Index Scan on mbw_avaliacao_ovariana_868819a8 (cost=0.00..9.70 rows=815 width=0) (actual time=1.712..1.712 rows=789 loops=1)

  • Index Cond: (contrato_id = 16)
57. 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)
58. 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)
59. 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)
60. 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)
61. 0.022 10.893 ↓ 113.0 113 1

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

62. 0.131 10.871 ↓ 113.0 113 1

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

63. 0.125 10.740 ↓ 113.0 113 1

Sort (cost=144.39..144.39 rows=1 width=12) (actual time=10.729..10.740 rows=113 loops=1)

  • Sort Key: c_4.femea_id, r_1.data_exame
  • Sort Method: quicksort Memory: 30kB
64. 0.039 10.615 ↓ 113.0 113 1

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

  • Join Filter: (r_1.data_exame >= me_3.data_inicio)
  • Rows Removed by Join Filter: 423
65. 0.472 8.968 ↓ 536.0 536 1

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

66. 0.377 5.876 ↓ 524.0 524 1

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

  • Join Filter: (f_3.animal_id = c_4.femea_id)
67. 0.151 4.173 ↓ 78.0 78 1

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

  • Hash Cond: (f_3.animal_id = ap_3.id)
68. 1.371 1.371 ↑ 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.028..1.371 rows=78 loops=1)

  • Index Cond: (estacao_ia_id = 25081)
69. 1.392 2.651 ↓ 4.7 4,720 1

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

  • Buckets: 8192 (originally 1024) Batches: 1 (originally 1) Memory Usage: 230kB
70. 1.259 1.259 ↓ 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.001..1.259 rows=4,720 loops=1)

71. 1.326 1.326 ↓ 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.007..0.017 rows=7 loops=78)

  • Index Cond: (femea_id = ap_3.id)
72. 2.620 2.620 ↑ 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.005..0.005 rows=1 loops=524)

  • Index Cond: (cobertura_id = c_4.id)
  • Filter: (contrato_id = 16)
73. 1.608 1.608 ↑ 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.003 rows=1 loops=536)

  • Index Cond: (id = 25081)
74. 0.736 19,945.699 ↓ 113.0 113 1

Sort (cost=298.92..298.93 rows=1 width=385) (actual time=19,945.692..19,945.699 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: 41kB
75. 1.089 19,944.963 ↓ 113.0 113 1

Nested Loop Left Join (cost=194.24..298.91 rows=1 width=385) (actual time=19,542.802..19,944.963 rows=113 loops=1)

76. 2.323 19,933.817 ↓ 113.0 113 1

Nested Loop Left Join (cost=193.81..296.33 rows=1 width=247) (actual time=19,539.911..19,933.817 rows=113 loops=1)

  • Join Filter: ((ov.femea_id = f.animal_id) AND (ov.data_avaliacao = po.data_protocolo))
  • Rows Removed by Join Filter: 12769
77. 0.757 19,906.747 ↓ 113.0 113 1

Nested Loop Left Join (cost=193.81..296.26 rows=1 width=219) (actual time=19,517.549..19,906.747 rows=113 loops=1)

78. 148.804 19,900.340 ↓ 113.0 113 1

Nested Loop Left Join (cost=193.38..293.61 rows=1 width=215) (actual time=19,515.881..19,900.340 rows=113 loops=1)

  • Join Filter: (pf.cobertura_id = c.id)
  • Rows Removed by Join Filter: 1301647
79. 0.523 18,516.446 ↓ 113.0 113 1

Nested Loop Left Join (cost=193.38..293.57 rows=1 width=207) (actual time=18,508.004..18,516.446 rows=113 loops=1)

80. 0.614 18,515.810 ↓ 113.0 113 1

Nested Loop Left Join (cost=192.82..290.78 rows=1 width=199) (actual time=18,507.995..18,515.810 rows=113 loops=1)

  • Join Filter: ((po.femea_id = f.animal_id) AND (po.cobertura_id = c.id))
  • Rows Removed by Join Filter: 1130
81. 0.473 26.588 ↓ 113.0 113 1

Nested Loop (cost=192.82..289.73 rows=1 width=65) (actual time=19.773..26.588 rows=113 loops=1)

82. 0.517 17.866 ↓ 113.0 113 1

Nested Loop (cost=192.38..287.07 rows=1 width=58) (actual time=12.823..17.866 rows=113 loops=1)

83. 0.258 13.507 ↓ 113.0 113 1

Nested Loop (cost=191.95..284.42 rows=1 width=44) (actual time=10.633..13.507 rows=113 loops=1)

84. 0.563 10.537 ↓ 113.0 113 1

Hash Join (cost=191.66..281.91 rows=1 width=46) (actual time=9.722..10.537 rows=113 loops=1)

  • Hash Cond: (f.animal_id = c.femea_id)
85. 1.820 1.820 ↑ 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=1.543..1.820 rows=78 loops=1)

  • Index Cond: (estacao_ia_id = 25081)
86. 0.130 8.154 ↑ 1.5 113 1

Hash (cost=189.13..189.13 rows=168 width=30) (actual time=8.154..8.154 rows=113 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 16kB
87. 8.024 8.024 ↑ 1.5 113 1

Index Scan using mbw_cobertura_5a04dd8d on mbw_cobertura c (cost=0.43..189.13 rows=168 width=30) (actual time=2.695..8.024 rows=113 loops=1)

  • Index Cond: (estacao_ia_id = 25081)
88. 2.712 2.712 ↑ 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.021..0.024 rows=1 loops=113)

  • Index Cond: (id = 25081)
89. 3.842 3.842 ↑ 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.034..0.034 rows=1 loops=113)

  • Index Cond: (id = c.femea_id)
90. 8.249 8.249 ↑ 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.073..0.073 rows=1 loops=113)

  • Index Cond: (id = c.macho_id)
91. 18,488.608 18,488.608 ↑ 3.0 10 113

CTE Scan on procotoco_cobertura po (cost=0.00..0.60 rows=30 width=142) (actual time=163.613..163.616 rows=10 loops=113)

92. 0.113 0.113 ↓ 0.0 0 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.001..0.001 rows=0 loops=113)

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

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

94. 5.650 5.650 ↓ 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.050..0.050 rows=0 loops=113)

  • Index Cond: (c.id = cobertura_id)
95. 24.747 24.747 ↓ 56.5 113 113

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

96. 10.057 10.057 ↑ 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.089..0.089 rows=1 loops=113)

  • Index Cond: (id = c.responsavel_id)
Planning time : 19.194 ms
Execution time : 19,950.200 ms