explain.depesz.com

PostgreSQL's explain analyze made readable

Result: UvLL

Settings
# exclusive inclusive rows x rows loops node
1. 2.539 65,834.674 ↓ 161.5 9,365 1

Subquery Scan on pc (cost=7,287.39..662,972.92 rows=58 width=748) (actual time=70.491..65,834.674 rows=9,365 loops=1)

  • Filter: ((pc.it_empresa)::integer = 1)
  • Rows Removed by Filter: 41
2. 50.814 65,832.135 ↑ 1.2 9,406 1

WindowAgg (cost=7,287.39..662,828.82 rows=11,528 width=752) (actual time=70.489..65,832.135 rows=9,406 loops=1)

3. 19.127 53.435 ↑ 1.2 9,406 1

Sort (cost=7,287.39..7,316.21 rows=11,528 width=649) (actual time=46.690..53.435 rows=9,406 loops=1)

  • Sort Key: spi.it_processo
  • Sort Method: external merge Disk: 5,072kB
4. 2.317 34.308 ↑ 1.2 9,406 1

Hash Left Join (cost=2,173.14..3,160.17 rows=11,528 width=649) (actual time=17.755..34.308 rows=9,406 loops=1)

  • Hash Cond: ((proc.it_pep)::integer = pep.sr_id)
  • Join Filter: ((i.ch_rib)::bpchar <> '1'::bpchar)
5. 2.483 31.976 ↑ 1.2 9,406 1

Hash Left Join (cost=2,171.20..3,127.18 rows=11,528 width=653) (actual time=17.736..31.976 rows=9,406 loops=1)

  • Hash Cond: ((proc.it_poa)::integer = poa.sr_id)
6. 3.212 29.360 ↑ 1.2 9,406 1

Hash Left Join (cost=2,147.95..3,073.50 rows=11,528 width=630) (actual time=17.598..29.360 rows=9,406 loops=1)

  • Hash Cond: (proc.sr_id = (pa.it_processo)::integer)
7. 2.527 24.149 ↑ 1.2 9,406 1

Hash Left Join (cost=1,760.85..2,528.39 rows=11,528 width=596) (actual time=15.593..24.149 rows=9,406 loops=1)

  • Hash Cond: ((spi.it_contrato)::integer = c.sr_id)
8. 4.949 20.115 ↑ 1.2 9,406 1

Hash Right Join (cost=1,344.37..2,081.62 rows=11,528 width=592) (actual time=14.079..20.115 rows=9,406 loops=1)

  • Hash Cond: ((spi.it_processo)::integer = proc.sr_id)
9. 1.104 1.104 ↑ 1.5 8,126 1

Seq Scan on tb_processos_itens spi (cost=0.00..585.39 rows=11,839 width=19) (actual time=0.006..1.104 rows=8,126 loops=1)

10. 1.766 14.062 ↓ 1.0 4,859 1

Hash (cost=1,285.09..1,285.09 rows=4,742 width=573) (actual time=14.062..14.062 rows=4,859 loops=1)

  • Buckets: 8,192 Batches: 1 Memory Usage: 2,492kB
11. 1.206 12.296 ↓ 1.0 4,859 1

Hash Left Join (cost=1,068.81..1,285.09 rows=4,742 width=573) (actual time=5.595..12.296 rows=4,859 loops=1)

  • Hash Cond: ((pr.it_analista)::integer = ua.sr_id)
12. 1.047 10.893 ↓ 1.0 4,859 1

Hash Join (cost=971.73..1,175.53 rows=4,742 width=548) (actual time=5.391..10.893 rows=4,859 loops=1)

  • Hash Cond: ((proc.it_moeda)::integer = m.sr_id)
13. 1.162 9.829 ↓ 1.0 4,860 1

Hash Join (cost=958.36..1,149.44 rows=4,742 width=510) (actual time=5.369..9.829 rows=4,860 loops=1)

  • Hash Cond: ((proj.it_instituicao)::integer = i.sr_id)
14. 1.135 8.604 ↑ 1.0 4,868 1

Hash Join (cost=953.21..1,130.47 rows=4,870 width=446) (actual time=5.301..8.604 rows=4,868 loops=1)

  • Hash Cond: ((proc.it_projeto)::integer = proj.sr_id)
15. 1.689 7.367 ↑ 1.0 4,870 1

Hash Right Join (cost=936.58..1,100.59 rows=4,870 width=401) (actual time=5.195..7.367 rows=4,870 loops=1)

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

17. 2.318 5.179 ↑ 1.0 4,870 1

Hash (cost=875.70..875.70 rows=4,870 width=360) (actual time=5.179..5.179 rows=4,870 loops=1)

  • Buckets: 8,192 Batches: 1 Memory Usage: 1,963kB
18. 2.861 2.861 ↑ 1.0 4,870 1

Seq Scan on tb_processos proc (cost=0.00..875.70 rows=4,870 width=360) (actual time=0.007..2.861 rows=4,870 loops=1)

19. 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
20. 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.008..0.066 rows=118 loops=1)

21. 0.016 0.063 ↑ 1.0 51 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
22. 0.047 0.047 ↑ 1.0 51 1

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

23. 0.005 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
24. 0.012 0.012 ↑ 37.5 4 1

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

25. 0.052 0.197 ↑ 2.7 458 1

Hash (cost=81.48..81.48 rows=1,248 width=29) (actual time=0.197..0.197 rows=458 loops=1)

  • Buckets: 2,048 Batches: 1 Memory Usage: 45kB
26. 0.145 0.145 ↑ 2.7 458 1

Seq Scan on tb_usuarios ua (cost=0.00..81.48 rows=1,248 width=29) (actual time=0.004..0.145 rows=458 loops=1)

27. 0.420 1.507 ↑ 1.0 4,377 1

Hash (cost=361.77..361.77 rows=4,377 width=8) (actual time=1.507..1.507 rows=4,377 loops=1)

  • Buckets: 8,192 Batches: 1 Memory Usage: 235kB
28. 1.087 1.087 ↑ 1.0 4,377 1

Seq Scan on tb_contratos c (cost=0.00..361.77 rows=4,377 width=8) (actual time=0.005..1.087 rows=4,377 loops=1)

29. 0.781 1.999 ↓ 1.0 4,870 1

Hash (cost=326.49..326.49 rows=4,849 width=38) (actual time=1.998..1.999 rows=4,870 loops=1)

  • Buckets: 8,192 Batches: 1 Memory Usage: 426kB
30. 1.218 1.218 ↓ 1.0 4,870 1

Seq Scan on tb_processos_agendamento pa (cost=0.00..326.49 rows=4,849 width=38) (actual time=0.005..1.218 rows=4,870 loops=1)

31. 0.065 0.133 ↑ 1.2 625 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 44kB
32. 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.006..0.068 rows=625 loops=1)

33. 0.006 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
34. 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.005..0.009 rows=50 loops=1)

35.          

SubPlan (for WindowAgg)

36. 2.342 27,952.941 ↓ 0.0 0 1,171

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

37. 27,950.599 27,950.599 ↓ 0.0 0 1,171

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=23.869..23.869 rows=0 loops=1,171)

  • Index Cond: ((dt_data)::date < now())
  • Filter: ((it_moeda)::integer = (spi.it_moeda)::integer)
  • Rows Removed by Filter: 103,172
38. 0.000 37,774.945 ↓ 0.0 0 6,935

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

39. 37,774.945 37,774.945 ↓ 0.0 0 6,935

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.447..5.447 rows=0 loops=6,935)

  • Index Cond: ((dt_data)::date < (c.dt_data)::date)
  • Filter: ((it_moeda)::integer = (spi.it_moeda)::integer)
  • Rows Removed by Filter: 29,743
Planning time : 5.198 ms
Execution time : 65,836.368 ms