explain.depesz.com

PostgreSQL's explain analyze made readable

Result: IW5F

Settings
# exclusive inclusive rows x rows loops node
1. 28.741 72,061.632 ↓ 210.1 4,832 1

Hash Left Join (cost=56.18..19,078.14 rows=23 width=772) (actual time=147.277..72,061.632 rows=4,832 loops=1)

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

Hash Left Join (cost=54.23..1,256.16 rows=23 width=646) (actual time=0.269..98.892 rows=4,832 loops=1)

  • Hash Cond: ((proc.it_poa)::integer = poa.sr_id)
3. 5.952 94.007 ↓ 210.1 4,832 1

Nested Loop Left Join (cost=30.99..1,232.86 rows=23 width=623) (actual time=0.116..94.007 rows=4,832 loops=1)

4. 3.640 73.559 ↓ 210.1 4,832 1

Nested Loop Left Join (cost=30.71..1,080.06 rows=23 width=577) (actual time=0.109..73.559 rows=4,832 loops=1)

5. 5.593 55.423 ↓ 210.1 4,832 1

Nested Loop Left Join (cost=30.43..1,071.85 rows=23 width=552) (actual time=0.102..55.423 rows=4,832 loops=1)

6. 4.192 35.334 ↓ 210.1 4,832 1

Hash Join (cost=30.15..926.72 rows=23 width=511) (actual time=0.095..35.334 rows=4,832 loops=1)

  • Hash Cond: ((proc.it_moeda)::integer = m.sr_id)
7. 7.417 31.133 ↓ 210.1 4,833 1

Nested Loop (cost=16.77..913.28 rows=23 width=473) (actual time=0.078..31.133 rows=4,833 loops=1)

8. 4.980 9.193 ↓ 201.7 4,841 1

Hash Join (cost=16.63..904.57 rows=24 width=409) (actual time=0.067..9.193 rows=4,841 loops=1)

  • Hash Cond: ((proc.it_projeto)::integer = proj.sr_id)
9. 4.157 4.157 ↓ 201.8 4,843 1

Seq Scan on tb_processos proc (cost=0.00..887.88 rows=24 width=364) (actual time=0.004..4.157 rows=4,843 loops=1)

  • Filter: ((it_empresa)::integer = 1)
  • Rows Removed by Filter: 27
10. 0.019 0.056 ↓ 1.0 118 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 18kB
11. 0.037 0.037 ↓ 1.0 118 1

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

12. 14.523 14.523 ↑ 1.0 1 4,841

Index Scan using tb_instituicoes_pkey on tb_instituicoes i (cost=0.14..0.36 rows=1 width=68) (actual time=0.003..0.003 rows=1 loops=4,841)

  • Index Cond: (sr_id = (proj.it_instituicao)::integer)
13. 0.004 0.009 ↑ 37.5 4 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
14. 0.005 0.005 ↑ 37.5 4 1

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

15. 14.496 14.496 ↑ 1.0 1 4,832

Index Scan using tb_processos_recepcao_it_processo_idx on tb_processos_recepcao pr (cost=0.28..6.30 rows=1 width=45) (actual time=0.003..0.003 rows=1 loops=4,832)

  • Index Cond: ((it_processo)::integer = proc.sr_id)
16. 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)
17. 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..6.63 rows=1 width=50) (actual time=0.002..0.003 rows=1 loops=4,832)

  • Index Cond: ((it_processo)::integer = proc.sr_id)
18. 0.079 0.147 ↑ 1.2 625 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 44kB
19. 0.068 0.068 ↑ 1.2 625 1

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

20. 0.007 0.015 ↓ 1.2 50 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
21. 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.003..0.008 rows=50 loops=1)

22.          

SubPlan (for Hash Left Join)

23. 15.372 71,933.984 ↑ 1.0 1 4,832

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

24. 24.035 5,146.080 ↑ 1.0 2 4,832

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

25. 5,097.760 5,097.760 ↑ 1.0 2 4,832

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

  • Filter: (((it_processo)::integer = proc.sr_id) AND ((ch_cancelado)::bpchar = '0'::bpchar))
  • Rows Removed by Filter: 8,124
26. 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)
27.          

SubPlan (for Aggregate)

28. 1.164 28,164.144 ↓ 0.0 0 1,164

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

29. 28,162.980 28,162.980 ↓ 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.195..24.195 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
30. 6.929 38,608.388 ↓ 0.0 0 6,929

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

31. 38,601.459 38,601.459 ↓ 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.571..5.571 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 : 6.151 ms
Execution time : 72,062.633 ms