explain.depesz.com

PostgreSQL's explain analyze made readable

Result: kHmr

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

Hash Left Join (cost=1,067.67..55,045.10 rows=69 width=772) (actual time=8.216..71,763.178 rows=4,832 loops=1)

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

Hash Left Join (cost=1,065.72..1,583.05 rows=69 width=646) (actual time=6.820..75.277 rows=4,832 loops=1)

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

Nested Loop Left Join (cost=1,042.47..1,559.62 rows=69 width=623) (actual time=6.671..71.158 rows=4,832 loops=1)

4. 8.605 50.275 ↓ 70.0 4,832 1

Nested Loop Left Join (cost=1,042.19..1,231.13 rows=69 width=577) (actual time=6.664..50.275 rows=4,832 loops=1)

5. 4.212 27.174 ↓ 70.0 4,832 1

Hash Join (cost=1,041.91..1,206.50 rows=69 width=552) (actual time=6.650..27.174 rows=4,832 loops=1)

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

Hash Join (cost=1,028.54..1,192.94 rows=69 width=514) (actual time=6.625..22.945 rows=4,833 loops=1)

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

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

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

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

  • Hash Cond: ((pr.it_processo)::integer = proc.sr_id)
9. 1.288 1.288 ↓ 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.005..1.288 rows=4,870 loops=1)

10. 3.122 6.453 ↓ 68.2 4,843 1

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

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

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

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

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

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

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

14. 0.015 0.050 ↑ 1.4 51 1

Hash (cost=4.72..4.72 rows=72 width=68) (actual time=0.050..0.050 rows=51 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
15. 0.035 0.035 ↑ 1.4 51 1

Seq Scan on tb_instituicoes i (cost=0.00..4.72 rows=72 width=68) (actual time=0.004..0.035 rows=51 loops=1)

16. 0.004 0.017 ↑ 37.5 4 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
17. 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)

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.002..0.003 rows=1 loops=4,832)

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

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

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

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

22. 0.009 0.017 ↓ 1.2 50 1

Hash (cost=1.42..1.42 rows=42 width=36) (actual time=0.017..0.017 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.946 71,663.392 ↑ 1.0 1 4,832

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

26. 19.203 5,083.264 ↑ 1.0 2 4,832

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

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

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

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

31. 28,073.352 28,073.352 ↓ 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.118..24.118 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. 6.929 38,483.666 ↓ 0.0 0 6,929

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

33. 38,476.737 38,476.737 ↓ 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.553..5.553 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.894 ms
Execution time : 71,764.165 ms