explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Iq8g

Settings
# exclusive inclusive rows x rows loops node
1. 4.521 26,475.292 ↓ 331.8 4,645 1

WindowAgg (cost=366,279.51..366,279.96 rows=14 width=57) (actual time=26,470.147..26,475.292 rows=4,645 loops=1)

  • Buffers: shared hit=150112
2.          

CTE femeas_paridas_antes_em

3. 24.629 353.107 ↓ 24.9 33,935 1

WindowAgg (cost=183,045.06..183,072.30 rows=1,362 width=33) (actual time=323.366..353.107 rows=33,935 loops=1)

  • Buffers: shared hit=75056
4. 24.789 328.478 ↓ 24.9 33,935 1

Sort (cost=183,045.06..183,048.46 rows=1,362 width=25) (actual time=323.346..328.478 rows=33,935 loops=1)

  • Sort Key: vw_1.femea_id, vw_1.data_hora_cobertura DESC
  • Sort Method: quicksort Memory: 4155kB
  • Buffers: shared hit=75056
5. 303.689 303.689 ↓ 24.9 33,935 1

Index Scan using vw_modelo_reprodutivo_parto_id_idx2 on vw_modelo_reprodutivo vw_1 (cost=0.56..182,974.16 rows=1,362 width=25) (actual time=47.531..303.689 rows=33,935 loops=1)

  • Index Cond: (propriedade_id = 3162)
  • Filter: ((data_hora_cobertura < '2019-11-10 00:00:00-03'::timestamp with time zone) AND (contrato_id = 16))
  • Rows Removed by Filter: 4645
  • Buffers: shared hit=75056
6. 10.865 26,470.771 ↓ 331.8 4,645 1

Sort (cost=183,207.21..183,207.24 rows=14 width=45) (actual time=26,470.121..26,470.771 rows=4,645 loops=1)

  • Sort Key: vw.femea_id, vw.data_hora_cobertura
  • Sort Method: quicksort Memory: 667kB
  • Buffers: shared hit=150112
7. 1,669.592 26,459.906 ↓ 331.8 4,645 1

Nested Loop Left Join (cost=0.56..183,206.94 rows=14 width=45) (actual time=499.996..26,459.906 rows=4,645 loops=1)

  • Join Filter: (vw.femea_id = fp.femea_id)
  • Rows Removed by Join Filter: 17035137
  • Buffers: shared hit=150112
8. 325.099 325.099 ↓ 331.8 4,645 1

Index Scan using vw_modelo_reprodutivo_parto_id_idx2 on vw_modelo_reprodutivo vw (cost=0.56..183,172.59 rows=14 width=41) (actual time=140.277..325.099 rows=4,645 loops=1)

  • Index Cond: (propriedade_id = 3162)
  • Filter: ((data_hora_cobertura >= '2019-11-10 00:00:00-03'::timestamp with time zone) AND (data_hora_cobertura <= '2020-03-15 00:00:00-03'::timestamp with time zone) AND (contrato_id = 16) AND (tipo_cobertura = 'IA'::text))
  • Rows Removed by Filter: 33935
  • Buffers: shared hit=75056
9. 24,465.215 24,465.215 ↓ 3,668.0 3,668 4,645

CTE Scan on femeas_paridas_antes_em fp (cost=0.00..34.05 rows=1 width=8) (actual time=0.070..5.267 rows=3,668 loops=4,645)

  • Filter: ((ordem = 1) AND (situacao_cria = 'Vivo'::text))
  • Rows Removed by Filter: 30267
  • Buffers: shared hit=75056
Planning time : 0.431 ms
Execution time : 26,476.958 ms