explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 2kqO

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

Hash Left Join (cost=56.18..19,078.08 rows=23 width=744) (actual time=151.808..72,324.109 rows=4,832 loops=1)

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

Hash Left Join (cost=54.23..1,256.16 rows=23 width=630) (actual time=0.592..98.572 rows=4,832 loops=1)

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

Nested Loop Left Join (cost=30.99..1,232.86 rows=23 width=607) (actual time=0.236..93.793 rows=4,832 loops=1)

4. 3.677 73.418 ↓ 210.1 4,832 1

Nested Loop Left Join (cost=30.71..1,080.06 rows=23 width=573) (actual time=0.224..73.418 rows=4,832 loops=1)

5. 5.665 55.245 ↓ 210.1 4,832 1

Nested Loop Left Join (cost=30.43..1,071.85 rows=23 width=548) (actual time=0.209..55.245 rows=4,832 loops=1)

6. 3.973 35.084 ↓ 210.1 4,832 1

Hash Join (cost=30.15..926.72 rows=23 width=507) (actual time=0.197..35.084 rows=4,832 loops=1)

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

Nested Loop (cost=16.77..913.28 rows=23 width=469) (actual time=0.155..31.087 rows=4,833 loops=1)

8. 5.128 9.314 ↓ 201.7 4,841 1

Hash Join (cost=16.63..904.57 rows=24 width=405) (actual time=0.135..9.314 rows=4,841 loops=1)

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

Seq Scan on tb_processos proc (cost=0.00..887.88 rows=24 width=360) (actual time=0.008..4.074 rows=4,843 loops=1)

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

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

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

Seq Scan on tb_projetos proj (cost=0.00..15.17 rows=117 width=49) (actual time=0.009..0.069 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.011 0.024 ↑ 37.5 4 1

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

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

Seq Scan on tb_moedas m (cost=0.00..11.50 rows=150 width=42) (actual time=0.011..0.013 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=38) (actual time=0.002..0.003 rows=1 loops=4,832)

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

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

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

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

20. 0.011 0.020 ↓ 1.2 50 1

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

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

22.          

SubPlan (for Hash Left Join)

23. 25.866 72,199.744 ↑ 1.0 1 4,832

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

24. 19.203 5,150.912 ↑ 1.0 2 4,832

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

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

Seq Scan on tb_processos_itens spi (cost=0.00..644.59 rows=2 width=13) (actual time=0.700..1.057 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,289.856 ↓ 0.0 0 1,164

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

29. 28,288.692 28,288.692 ↓ 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.303..24.303 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. 0.000 38,733.110 ↓ 0.0 0 6,929

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

31. 38,733.110 38,733.110 ↓ 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.590..5.590 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.547 ms
Execution time : 72,325.327 ms