explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Xx2J

Settings
# exclusive inclusive rows x rows loops node
1. 15,944.587 21,493.230 ↓ 40,999.0 40,999 1

Result (cost=16,209.01..16,209.31 rows=1 width=235) (actual time=5,576.621..21,493.230 rows=40,999 loops=1)

2. 45.372 5,548.643 ↓ 40,999.0 40,999 1

Sort (cost=16,209.01..16,209.02 rows=1 width=235) (actual time=5,533.072..5,548.643 rows=40,999 loops=1)

  • Sort Key: p.dt_inicio, p.id_rd
  • Sort Method: quicksort Memory: 10860kB
3. 157.436 5,503.271 ↓ 40,999.0 40,999 1

Nested Loop Left Join (cost=24.78..16,209.00 rows=1 width=235) (actual time=92.324..5,503.271 rows=40,999 loops=1)

4. 5.896 5,345.835 ↓ 40,999.0 40,999 1

Nested Loop Left Join (cost=24.64..16,208.82 rows=1 width=125) (actual time=92.266..5,345.835 rows=40,999 loops=1)

5. 24.050 5,298.940 ↓ 40,999.0 40,999 1

Nested Loop Left Join (cost=24.21..16,207.32 rows=1 width=125) (actual time=92.258..5,298.940 rows=40,999 loops=1)

6. 40.508 5,192.892 ↓ 40,999.0 40,999 1

Nested Loop (cost=23.78..16,205.89 rows=1 width=81) (actual time=92.248..5,192.892 rows=40,999 loops=1)

  • Join Filter: ((rd.id_veiculo)::integer = (v.id_veiculo)::integer)
7. 19.509 5,111.385 ↓ 40,999.0 40,999 1

Nested Loop (cost=23.49..16,204.63 rows=1 width=74) (actual time=92.209..5,111.385 rows=40,999 loops=1)

8. 7.706 4,558.889 ↓ 40,999.0 40,999 1

Nested Loop (cost=23.06..16,202.52 rows=1 width=72) (actual time=89.688..4,558.889 rows=40,999 loops=1)

9. 60.192 60.192 ↓ 1.9 1,269 1

Index Only Scan using ind_tb_rd_idfilial_dtini_idveiculo_idrd on tb_rd rd (cost=0.43..26.04 rows=678 width=8) (actual time=5.524..60.192 rows=1,269 loops=1)

  • Index Cond: ((id_filial = 194) AND (dt_inicio_terminal >= '2019-10-18 00:00:00'::timestamp without time zone) AND (dt_inicio_terminal <= '2019-10-21 23:59:00-03'::timestamp with time zone))
  • Heap Fetches: 582
10. 5.076 4,490.991 ↓ 32.0 32 1,269

Append (cost=22.62..23.85 rows=1 width=68) (actual time=1.400..3.539 rows=32 loops=1,269)

11. 2,747.385 4,485.915 ↓ 32.0 32 1,269

Bitmap Heap Scan on tb_parada p (cost=22.62..23.85 rows=1 width=68) (actual time=1.399..3.535 rows=32 loops=1,269)

  • Recheck Cond: (((id_veiculo)::integer = (rd.id_veiculo)::integer) AND (dt_inicio >= '2019-10-19 00:00:00-03'::timestamp with time zone) AND (dt_inicio < '2019-10-21 23:59:00-03'::timestamp with time zone) AND ((id_rd)::integer = (rd.id_rd)::integer))
  • Filter: ((dt_fim - dt_inicio) >= '00:00:00'::interval)
  • Rows Removed by Filter: 0
  • Heap Blocks: exact=36601
12. 11.026 1,738.530 ↓ 0.0 0 1,269

BitmapAnd (cost=22.62..22.62 rows=1 width=0) (actual time=1.370..1.370 rows=0 loops=1,269)

13. 978.399 978.399 ↓ 2.1 162 1,269

Bitmap Index Scan on ind_dt_inicio_veiculo_tb_parada (cost=0.00..2.74 rows=78 width=0) (actual time=0.771..0.771 rows=162 loops=1,269)

  • Index Cond: (((id_veiculo)::integer = (rd.id_veiculo)::integer) AND (dt_inicio >= '2019-10-19 00:00:00-03'::timestamp with time zone) AND (dt_inicio < '2019-10-21 23:59:00-03'::timestamp with time zone))
14. 749.105 749.105 ↑ 1.5 48 1,259

Bitmap Index Scan on ind_tb_parada_idrd_gin (cost=0.00..19.64 rows=73 width=0) (actual time=0.595..0.595 rows=48 loops=1,259)

  • Index Cond: ((id_rd)::integer = (rd.id_rd)::integer)
15. 532.987 532.987 ↑ 1.0 1 40,999

Index Scan using pk00_tb_trecho_viagem on tb_trecho_viagem tv (cost=0.43..2.11 rows=1 width=10) (actual time=0.013..0.013 rows=1 loops=40,999)

  • Index Cond: ((id_trecho_viagem)::integer = (p.id_trecho_viagem)::integer)
16. 40.999 40.999 ↑ 1.0 1 40,999

Index Scan using pk00_tb_veiculo on tb_veiculo v (cost=0.29..1.24 rows=1 width=15) (actual time=0.001..0.001 rows=1 loops=40,999)

  • Index Cond: ((id_veiculo)::integer = (p.id_veiculo)::integer)
17. 81.998 81.998 ↓ 0.0 0 40,999

Index Scan using pk00_tb_geometria on tb_geometria lc (cost=0.43..1.43 rows=1 width=48) (actual time=0.002..0.002 rows=0 loops=40,999)

  • Index Cond: ((tv.id_local_clt)::integer = (id_geometria)::integer)
18. 40.999 40.999 ↓ 0.0 0 40,999

Index Scan using pk00_tb_ocorrencia on tb_ocorrencia o (cost=0.43..1.50 rows=1 width=8) (actual time=0.001..0.001 rows=0 loops=40,999)

  • Index Cond: ((id_ocorrencia)::integer = (p.id_ocorrencia)::integer)
19. 0.000 0.000 ↓ 0.0 0 40,999

Index Scan using pk_tb_modelo_ocorrencia on tb_modelo_ocorrencia m (cost=0.14..0.16 rows=1 width=21) (actual time=0.000..0.000 rows=0 loops=40,999)

  • Index Cond: ((o.id_modelo_ocorrencia)::integer = (id_modelo_ocorrencia)::integer)
Planning time : 108.972 ms
Execution time : 21,515.042 ms