explain.depesz.com

PostgreSQL's explain analyze made readable

Result: WXDF

Settings
# exclusive inclusive rows x rows loops node
1. 0.006 5,565.215 ↑ 1.0 20 1

Limit (cost=271,451.86..271,451.91 rows=20 width=583) (actual time=5,565.208..5,565.215 rows=20 loops=1)

2.          

CTE eventosnaoatuados

3. 518.875 1,097.610 ↓ 8.4 34,707 1

Hash Join (cost=5,323.45..181,829.10 rows=4,148 width=24) (actual time=217.398..1,097.610 rows=34,707 loops=1)

  • Hash Cond: (evento.viagem_id = viagem.id)
4. 577.906 577.906 ↑ 1.0 6,590,049 1

Seq Scan on eventoviagem evento (cost=0.00..151,751.49 rows=6,590,049 width=16) (actual time=0.031..577.906 rows=6,590,049 loops=1)

5. 0.042 0.829 ↑ 10.0 82 1

Hash (cost=5,313.16..5,313.16 rows=823 width=16) (actual time=0.829..0.829 rows=82 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 12kB
6. 0.787 0.787 ↑ 10.0 82 1

Index Scan using idx_viagem_status on viagem (cost=0.43..5,313.16 rows=823 width=16) (actual time=0.057..0.787 rows=82 loops=1)

  • Index Cond: (status = ANY ('{V,I}'::bpchar[]))
  • Filter: (base_id = ANY ('{29,109,71,103,104,35,24,97,58,90,89,83,63,21,0}'::bigint[]))
  • Rows Removed by Filter: 1
7. 12.293 5,565.209 ↑ 1.1 20 1

Sort (cost=89,622.75..89,622.80 rows=21 width=583) (actual time=5,565.206..5,565.209 rows=20 loops=1)

  • Sort Key: ev.data DESC
  • Sort Method: top-N heapsort Memory: 27kB
8. 48.793 5,552.916 ↓ 1,551.7 32,586 1

Nested Loop Left Join (cost=1.71..89,622.29 rows=21 width=583) (actual time=219.954..5,552.916 rows=32,586 loops=1)

  • Join Filter: (rastreador.id = posicao.rastreador_id)
  • Rows Removed by Join Filter: 651720
9. 25.280 5,471.537 ↓ 1,551.7 32,586 1

Nested Loop Left Join (cost=1.71..89,614.74 rows=21 width=75) (actual time=219.938..5,471.537 rows=32,586 loops=1)

10. 1,821.213 5,381.085 ↓ 1,551.7 32,586 1

Nested Loop Left Join (cost=1.28..89,604.72 rows=21 width=75) (actual time=219.922..5,381.085 rows=32,586 loops=1)

  • Join Filter: (tp.id = ev.tipoevento_id)
  • Rows Removed by Join Filter: 23429334
11. 2.705 2,712.636 ↓ 1,551.7 32,586 1

Nested Loop Left Join (cost=1.28..89,356.92 rows=21 width=48) (actual time=219.821..2,712.636 rows=32,586 loops=1)

12. 128.613 2,644.759 ↓ 1,551.7 32,586 1

Nested Loop Left Join (cost=0.86..89,263.66 rows=21 width=48) (actual time=219.815..2,644.759 rows=32,586 loops=1)

  • Filter: (atuacaoalerta.* IS NULL)
  • Rows Removed by Filter: 2012198
13. 17.263 1,197.280 ↓ 8.4 34,707 1

Nested Loop (cost=0.43..33,079.04 rows=4,148 width=48) (actual time=217.426..1,197.280 rows=34,707 loops=1)

14. 1,110.603 1,110.603 ↓ 8.4 34,707 1

CTE Scan on eventosnaoatuados ena (cost=0.00..82.96 rows=4,148 width=24) (actual time=217.403..1,110.603 rows=34,707 loops=1)

15. 69.414 69.414 ↑ 1.0 1 34,707

Index Scan using eventoviagem_pkey on eventoviagem ev (cost=0.43..7.94 rows=1 width=32) (actual time=0.002..0.002 rows=1 loops=34,707)

  • Index Cond: (id = ena.idevento)
16. 1,318.866 1,318.866 ↑ 8.2 58 34,707

Index Scan using idx_atuacaoalerta_eventoviagem_id on atuacaoalerta (cost=0.43..8.78 rows=476 width=676) (actual time=0.002..0.038 rows=58 loops=34,707)

  • Index Cond: (eventoviagem_id = ev.id)
17. 65.172 65.172 ↑ 1.0 1 32,586

Index Scan using automovel_pkey on automovel auto (cost=0.42..4.43 rows=1 width=16) (actual time=0.002..0.002 rows=1 loops=32,586)

  • Index Cond: (ena.veiculo_id = id)
18. 847.119 847.236 ↑ 1.0 720 32,586

Materialize (cost=0.00..22.80 rows=720 width=43) (actual time=0.000..0.026 rows=720 loops=32,586)

19. 0.117 0.117 ↑ 1.0 720 1

Seq Scan on tipoevento tp (cost=0.00..19.20 rows=720 width=43) (actual time=0.006..0.117 rows=720 loops=1)

20. 65.172 65.172 ↑ 1.0 1 32,586

Index Scan using posicao_pkey on posicao (cost=0.43..0.47 rows=1 width=16) (actual time=0.002..0.002 rows=1 loops=32,586)

  • Index Cond: (id = ev.posicao_id)
21. 32.579 32.586 ↑ 1.0 20 32,586

Materialize (cost=0.00..1.30 rows=20 width=524) (actual time=0.000..0.001 rows=20 loops=32,586)

22. 0.007 0.007 ↑ 1.0 20 1

Seq Scan on rastreador (cost=0.00..1.20 rows=20 width=524) (actual time=0.006..0.007 rows=20 loops=1)

Planning time : 3.843 ms
Execution time : 5,565.857 ms