explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Mskr

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

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

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

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

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

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

4. 3.770 72.919 ↓ 210.1 4,832 1

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

5. 5.569 54.653 ↓ 210.1 4,832 1

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

6. 3.733 34.588 ↓ 210.1 4,832 1

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

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

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

8. 4.828 8.901 ↓ 201.7 4,841 1

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

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

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

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

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

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

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

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

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

Seq Scan on tb_moedas m (cost=0.00..11.50 rows=150 width=42) (actual time=0.007..0.008 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.095 0.178 ↑ 1.2 625 1

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

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

Seq Scan on tb_poas poa (cost=0.00..14.22 rows=722 width=27) (actual time=0.004..0.083 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. 17.805 72,359.200 ↑ 1.0 1 4,832

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

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

Nested Loop Left Join (cost=0.28..661.19 rows=2 width=17) (actual time=0.705..1.067 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.701..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,417.896 ↓ 0.0 0 1,164

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

29. 28,416.732 28,416.732 ↓ 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.413..24.413 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,767.755 ↓ 0.0 0 6,929

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

31. 38,760.826 38,760.826 ↓ 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.594..5.594 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.555 ms
Execution time : 72,484.666 ms