explain.depesz.com

PostgreSQL's explain analyze made readable

Result: mr5O

Settings
# exclusive inclusive rows x rows loops node
1. 38.846 291.739 ↓ 14.6 2,922 1

HashAggregate (cost=21,969.12..21,971.62 rows=200 width=36) (actual time=290.415..291.739 rows=2,922 loops=1)

  • Group Key: wvfd.cd_ficha
2.          

CTE with_veiculo_ficha_diaria

3. 33.913 33.913 ↑ 1.0 88,433 1

Seq Scan on mv_veiculo_ficha_diaria vfd (cost=0.00..4,417.33 rows=88,433 width=282) (actual time=0.011..33.913 rows=88,433 loops=1)

4. 10.931 252.893 ↑ 8.4 26,400 1

Hash Join (cost=5,691.50..11,466.59 rows=221,280 width=36) (actual time=218.876..252.893 rows=26,400 loops=1)

  • Hash Cond: (v.cd_viagem = vr.cd_viagem)
5. 23.406 184.023 ↑ 5.2 3,020 1

Hash Join (cost=3,306.07..5,685.53 rows=15,771 width=8) (actual time=160.895..184.023 rows=3,020 loops=1)

  • Hash Cond: (v.cd_veiculo = wvfd.cd_veiculo)
  • Join Filter: (v.dt_saida < (wvfd.dt_evento)::date)
  • Rows Removed by Join Filter: 86142
6. 0.512 0.512 ↑ 1.0 107 1

Seq Scan on viagem v (cost=0.00..52.76 rows=107 width=12) (actual time=0.418..0.512 rows=107 loops=1)

  • Filter: (dt_chegada IS NULL)
  • Rows Removed by Filter: 1969
7. 38.279 160.105 ↑ 1.0 88,433 1

Hash (cost=1,768.66..1,768.66 rows=88,433 width=16) (actual time=160.105..160.105 rows=88,433 loops=1)

  • Buckets: 131072 Batches: 2 Memory Usage: 3099kB
8. 121.826 121.826 ↑ 1.0 88,433 1

CTE Scan on with_veiculo_ficha_diaria wvfd (cost=0.00..1,768.66 rows=88,433 width=16) (actual time=0.015..121.826 rows=88,433 loops=1)

9. 11.790 57.939 ↑ 1.0 29,128 1

Hash (cost=2,021.33..2,021.33 rows=29,128 width=36) (actual time=57.939..57.939 rows=29,128 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 2265kB
10. 25.089 46.149 ↑ 1.0 29,128 1

Hash Left Join (cost=667.32..2,021.33 rows=29,128 width=36) (actual time=12.961..46.149 rows=29,128 loops=1)

  • Hash Cond: (vr.cd_viagem_receita = vrs.cd_viagem_receita)
11. 8.159 8.159 ↑ 1.0 29,128 1

Seq Scan on viagem_receita vr (cost=0.00..986.28 rows=29,128 width=32) (actual time=0.013..8.159 rows=29,128 loops=1)

12. 4.952 12.901 ↑ 1.0 19,792 1

Hash (cost=419.92..419.92 rows=19,792 width=12) (actual time=12.901..12.901 rows=19,792 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 1161kB
13. 7.949 7.949 ↑ 1.0 19,792 1

Seq Scan on viagem_receita_saldo vrs (cost=0.00..419.92 rows=19,792 width=12) (actual time=0.010..7.949 rows=19,792 loops=1)

Planning time : 0.946 ms
Execution time : 297.364 ms