explain.depesz.com

PostgreSQL's explain analyze made readable

Result: cWM7 : 12s

Settings
# exclusive inclusive rows x rows loops node
1. 10,379.498 12,988.968 ↓ 40,999.0 40,999 1

Result (cost=34,244.26..34,244.56 rows=1 width=235) (actual time=2,599.745..12,988.968 rows=40,999 loops=1)

2. 35.571 2,609.470 ↓ 40,999.0 40,999 1

Sort (cost=34,244.26..34,244.27 rows=1 width=235) (actual time=2,599.282..2,609.470 rows=40,999 loops=1)

  • Sort Key: p.dt_inicio, p.id_rd
  • Sort Method: quicksort Memory: 10860kB
3. 139.113 2,573.899 ↓ 40,999.0 40,999 1

Nested Loop Left Join (cost=53.80..34,244.25 rows=1 width=235) (actual time=29.315..2,573.899 rows=40,999 loops=1)

4. 24.270 2,434.786 ↓ 40,999.0 40,999 1

Nested Loop Left Join (cost=53.66..34,244.07 rows=1 width=125) (actual time=29.289..2,434.786 rows=40,999 loops=1)

5. 31.529 2,410.516 ↓ 40,999.0 40,999 1

Nested Loop Left Join (cost=53.23..34,242.57 rows=1 width=125) (actual time=29.287..2,410.516 rows=40,999 loops=1)

6. 33.253 2,378.987 ↓ 40,999.0 40,999 1

Nested Loop (cost=52.80..34,241.14 rows=1 width=81) (actual time=29.284..2,378.987 rows=40,999 loops=1)

  • Join Filter: ((rd.id_veiculo)::integer = (v.id_veiculo)::integer)
7. 11.400 2,304.735 ↓ 40,999.0 40,999 1

Nested Loop (cost=52.51..34,239.89 rows=1 width=74) (actual time=29.276..2,304.735 rows=40,999 loops=1)

8. 5.545 2,211.337 ↓ 40,999.0 40,999 1

Nested Loop (cost=52.08..34,237.78 rows=1 width=72) (actual time=29.266..2,211.337 rows=40,999 loops=1)

9. 1.539 1.539 ↓ 2.0 1,269 1

Index Only Scan using ind_tb_rd_idfilial_dtini_idveiculo_idrd on tb_rd rd (cost=0.43..24.60 rows=647 width=8) (actual time=0.014..1.539 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: 678
10. 5.076 2,204.253 ↓ 32.0 32 1,269

Append (cost=51.64..52.87 rows=1 width=68) (actual time=1.698..1.737 rows=32 loops=1,269)

11. 52.029 2,199.177 ↓ 32.0 32 1,269

Bitmap Heap Scan on tb_parada p (cost=51.64..52.87 rows=1 width=68) (actual time=1.697..1.733 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. 7.887 2,147.148 ↓ 0.0 0 1,269

BitmapAnd (cost=51.64..51.64 rows=1 width=0) (actual time=1.692..1.692 rows=0 loops=1,269)

13. 27.918 27.918 ↓ 2.1 162 1,269

Bitmap Index Scan on ind_dt_inicio_veiculo_tb_parada (cost=0.00..2.75 rows=79 width=0) (actual time=0.022..0.022 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. 2,111.343 2,111.343 ↑ 1.5 48 1,259

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

  • Index Cond: ((id_rd)::integer = (rd.id_rd)::integer)
15. 81.998 81.998 ↑ 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.002..0.002 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. 0.000 0.000 ↓ 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.000..0.000 rows=0 loops=40,999)

  • Index Cond: ((tv.id_local_clt)::integer = (id_geometria)::integer)
18. 0.000 0.000 ↓ 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.000..0.000 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 : 3.067 ms
Execution time : 12,994.841 ms