explain.depesz.com

PostgreSQL's explain analyze made readable

Result: vUs2

Settings
# exclusive inclusive rows x rows loops node
1. 29.204 71,517.487 ↓ 70.0 4,832 1

Hash Left Join (cost=1,067.19..55,044.62 rows=69 width=772) (actual time=6.373..71,517.487 rows=4,832 loops=1)

  • Hash Cond: ((proc.it_pep)::integer = pep.sr_id)
  • Join Filter: ((i.ch_rib)::bpchar <> '1'::bpchar)
2. 4.574 76.137 ↓ 70.0 4,832 1

Hash Left Join (cost=1,065.25..1,582.58 rows=69 width=646) (actual time=4.695..76.137 rows=4,832 loops=1)

  • Hash Cond: ((proc.it_poa)::integer = poa.sr_id)
3. 7.534 71.406 ↓ 70.0 4,832 1

Nested Loop Left Join (cost=1,042.00..1,559.15 rows=69 width=623) (actual time=4.530..71.406 rows=4,832 loops=1)

4. 9.159 49.376 ↓ 70.0 4,832 1

Nested Loop Left Join (cost=1,041.72..1,230.66 rows=69 width=577) (actual time=4.519..49.376 rows=4,832 loops=1)

5. 3.718 25.721 ↓ 70.0 4,832 1

Hash Join (cost=1,041.44..1,206.02 rows=69 width=552) (actual time=4.504..25.721 rows=4,832 loops=1)

  • Hash Cond: ((proc.it_moeda)::integer = m.sr_id)
6. 4.401 21.990 ↓ 70.0 4,833 1

Hash Join (cost=1,028.07..1,192.47 rows=69 width=514) (actual time=4.475..21.990 rows=4,833 loops=1)

  • Hash Cond: ((proj.it_instituicao)::integer = i.sr_id)
7. 3.811 17.552 ↓ 68.2 4,841 1

Hash Join (cost=1,022.92..1,187.12 rows=71 width=450) (actual time=4.431..17.552 rows=4,841 loops=1)

  • Hash Cond: ((proc.it_projeto)::integer = proj.sr_id)
8. 7.937 13.675 ↓ 68.2 4,843 1

Hash Right Join (cost=1,006.29..1,170.29 rows=71 width=405) (actual time=4.358..13.675 rows=4,843 loops=1)

  • Hash Cond: ((pr.it_processo)::integer = proc.sr_id)
9. 1.400 1.400 ↓ 1.0 4,870 1

Seq Scan on tb_processos_recepcao pr (cost=0.00..151.32 rows=4,832 width=45) (actual time=0.010..1.400 rows=4,870 loops=1)

10. 2.045 4.338 ↓ 68.2 4,843 1

Hash (cost=1,005.40..1,005.40 rows=71 width=364) (actual time=4.338..4.338 rows=4,843 loops=1)

  • Buckets: 8,192 (originally 1024) Batches: 1 (originally 1) Memory Usage: 1,978kB
11. 2.293 2.293 ↓ 68.2 4,843 1

Seq Scan on tb_processos proc (cost=0.00..1,005.40 rows=71 width=364) (actual time=0.007..2.293 rows=4,843 loops=1)

  • Filter: ((it_empresa)::integer = 1)
  • Rows Removed by Filter: 27
12. 0.021 0.066 ↓ 1.0 118 1

Hash (cost=15.17..15.17 rows=117 width=49) (actual time=0.066..0.066 rows=118 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 18kB
13. 0.045 0.045 ↓ 1.0 118 1

Seq Scan on tb_projetos proj (cost=0.00..15.17 rows=117 width=49) (actual time=0.007..0.045 rows=118 loops=1)

14. 0.010 0.037 ↑ 1.0 51 1

Hash (cost=4.51..4.51 rows=51 width=68) (actual time=0.037..0.037 rows=51 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
15. 0.027 0.027 ↑ 1.0 51 1

Seq Scan on tb_instituicoes i (cost=0.00..4.51 rows=51 width=68) (actual time=0.003..0.027 rows=51 loops=1)

16. 0.003 0.013 ↑ 37.5 4 1

Hash (cost=11.50..11.50 rows=150 width=42) (actual time=0.013..0.013 rows=4 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
17. 0.010 0.010 ↑ 37.5 4 1

Seq Scan on tb_moedas m (cost=0.00..11.50 rows=150 width=42) (actual time=0.009..0.010 rows=4 loops=1)

18. 14.496 14.496 ↑ 1.0 1 4,832

Index Scan using tb_usuarios_pkey on tb_usuarios ua (cost=0.28..0.36 rows=1 width=29) (actual time=0.003..0.003 rows=1 loops=4,832)

  • Index Cond: (sr_id = (pr.it_analista)::integer)
19. 14.496 14.496 ↑ 1.0 1 4,832

Index Scan using tb_processos_agendamento_it_processo_idx on tb_processos_agendamento pa (cost=0.28..4.75 rows=1 width=50) (actual time=0.003..0.003 rows=1 loops=4,832)

  • Index Cond: ((it_processo)::integer = proc.sr_id)
20. 0.083 0.157 ↑ 1.2 625 1

Hash (cost=14.22..14.22 rows=722 width=27) (actual time=0.157..0.157 rows=625 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 44kB
21. 0.074 0.074 ↑ 1.2 625 1

Seq Scan on tb_poas poa (cost=0.00..14.22 rows=722 width=27) (actual time=0.005..0.074 rows=625 loops=1)

22. 0.010 0.018 ↓ 1.2 50 1

Hash (cost=1.42..1.42 rows=42 width=36) (actual time=0.018..0.018 rows=50 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
23. 0.008 0.008 ↓ 1.2 50 1

Seq Scan on tb_pep_costcenter pep (cost=0.00..1.42 rows=42 width=36) (actual time=0.004..0.008 rows=50 loops=1)

24.          

SubPlan (for Hash Left Join)

25. 21.678 71,412.128 ↑ 1.0 1 4,832

Aggregate (cost=774.65..774.66 rows=1 width=32) (actual time=14.779..14.779 rows=1 loops=4,832)

26. 24.035 5,121.920 ↑ 1.0 2 4,832

Nested Loop Left Join (cost=0.28..661.19 rows=2 width=17) (actual time=0.699..1.060 rows=2 loops=4,832)

27. 5,073.600 5,073.600 ↑ 1.0 2 4,832

Seq Scan on tb_processos_itens spi (cost=0.00..644.59 rows=2 width=13) (actual time=0.694..1.050 rows=2 loops=4,832)

  • Filter: (((it_processo)::integer = proc.sr_id) AND ((ch_cancelado)::bpchar = '0'::bpchar))
  • Rows Removed by Filter: 8,124
28. 24.285 24.285 ↑ 1.0 1 8,095

Index Scan using tb_contratos_pkey on tb_contratos c (cost=0.28..8.30 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=8,095)

  • Index Cond: (sr_id = (spi.it_contrato)::integer)
29.          

SubPlan (for Aggregate)

30. 1.164 28,394.616 ↓ 0.0 0 1,164

Limit (cost=0.42..28.33 rows=1 width=22) (actual time=24.394..24.394 rows=0 loops=1,164)

31. 28,393.452 28,393.452 ↓ 0.0 0 1,164

Index Scan Backward using tb_cotacoes_dolar_dt_data_idx on tb_cotacoes_dolar cd1 (cost=0.42..17,442.64 rows=625 width=22) (actual time=24.393..24.393 rows=0 loops=1,164)

  • Index Cond: ((dt_data)::date < now())
  • Filter: ((it_moeda)::integer = (spi.it_moeda)::integer)
  • Rows Removed by Filter: 103,793
32. 0.000 37,873.914 ↓ 0.0 0 6,929

Limit (cost=0.42..28.38 rows=1 width=22) (actual time=5.466..5.466 rows=0 loops=6,929)

33. 37,873.914 37,873.914 ↓ 0.0 0 6,929

Index Scan Backward using tb_cotacoes_dolar_dt_data_idx on tb_cotacoes_dolar cd (cost=0.42..5,817.16 rows=208 width=22) (actual time=5.466..5.466 rows=0 loops=6,929)

  • Index Cond: ((dt_data)::date < (c.dt_data)::date)
  • Filter: ((it_moeda)::integer = (spi.it_moeda)::integer)
  • Rows Removed by Filter: 29,769
Planning time : 5.861 ms
Execution time : 71,518.575 ms