explain.depesz.com

PostgreSQL's explain analyze made readable

Result: G7Pi

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 155.334 ↓ 0.0 0 1

HashAggregate (cost=5,392.18..5,392.19 rows=1 width=36) (actual time=155.334..155.334 rows=0 loops=1)

2. 0.000 155.332 ↓ 0.0 0 1

GroupAggregate (cost=4,990.88..5,392.17 rows=1 width=18) (actual time=155.332..155.332 rows=0 loops=1)

3. 0.001 155.332 ↓ 0.0 0 1

Nested Loop (cost=4,990.88..5,392.15 rows=1 width=18) (actual time=155.332..155.332 rows=0 loops=1)

  • Join Filter: (ipdc.id_item_despesa = du.id_item_despesa)
4. 0.001 155.331 ↓ 0.0 0 1

Nested Loop (cost=4,990.88..5,379.32 rows=1 width=20) (actual time=155.331..155.331 rows=0 loops=1)

  • Join Filter: (desp.id_despesa = d.id_despesa)
5. 0.026 0.026 ↑ 1.0 9 1

Index Scan using pk_tb_despesas on tb_despesa d (cost=0.14..12.33 rows=9 width=4) (actual time=0.014..0.026 rows=9 loops=1)

  • Filter: (flg_status = 'A'::bpchar)
  • Rows Removed by Filter: 2
6. 0.009 155.304 ↓ 0.0 0 9

Materialize (cost=4,990.74..5,366.86 rows=1 width=20) (actual time=17.256..17.256 rows=0 loops=9)

7. 0.001 155.295 ↓ 0.0 0 1

Nested Loop (cost=4,990.74..5,366.85 rows=1 width=20) (actual time=155.295..155.295 rows=0 loops=1)

8. 0.000 155.294 ↓ 0.0 0 1

Nested Loop (cost=4,990.74..5,365.75 rows=1 width=24) (actual time=155.294..155.294 rows=0 loops=1)

9. 0.000 155.294 ↓ 0.0 0 1

Nested Loop (cost=4,990.46..5,365.37 rows=1 width=32) (actual time=155.294..155.294 rows=0 loops=1)

10. 0.033 155.294 ↓ 0.0 0 1

Hash Join (cost=4,990.32..5,365.20 rows=1 width=36) (actual time=155.294..155.294 rows=0 loops=1)

  • Hash Cond: ((max(tb_edicao_pdc.id_edicao_pdc)) = ipdc.id_edicao_pdc)
11. 46.305 77.635 ↑ 15,784.0 1 1

HashAggregate (cost=1,461.52..1,619.36 rows=15,784 width=8) (actual time=77.635..77.635 rows=1 loops=1)

12. 31.330 31.330 ↓ 1.0 53,182 1

Seq Scan on tb_edicao_pdc (cost=0.00..1,195.68 rows=53,168 width=8) (actual time=0.021..31.330 rows=53,182 loops=1)

13. 0.000 77.626 ↓ 0.0 0 1

Hash (cost=3,528.79..3,528.79 rows=1 width=36) (actual time=77.626..77.626 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 0kB
14. 0.002 77.626 ↓ 0.0 0 1

Nested Loop (cost=881.31..3,528.79 rows=1 width=36) (actual time=77.626..77.626 rows=0 loops=1)

15. 0.001 77.624 ↓ 0.0 0 1

Nested Loop (cost=880.88..3,528.26 rows=1 width=34) (actual time=77.624..77.624 rows=0 loops=1)

16. 0.015 77.623 ↓ 0.0 0 1

Nested Loop (cost=880.45..3,527.70 rows=1 width=16) (actual time=77.623..77.623 rows=0 loops=1)

  • Join Filter: ((item.id_plt_edicao = plt_pdc.id_plt_edicao) AND (subitem.id_item_plt = plt_pdc.id_item_plt))
17. 15.882 62.658 ↑ 15.0 1 1

Hash Join (cost=880.02..3,457.08 rows=15 width=36) (actual time=45.660..62.658 rows=1 loops=1)

  • Hash Cond: (desp.id_subitem_plt = subitem.id_subitem_plt)
18. 18.819 18.819 ↑ 1.0 104,357 1

Seq Scan on tb_desp_subitem desp (cost=0.00..2,185.57 rows=104,357 width=12) (actual time=0.023..18.819 rows=104,357 loops=1)

19. 0.004 27.957 ↑ 1.0 1 1

Hash (cost=880.01..880.01 rows=1 width=24) (actual time=27.957..27.957 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
20. 1.515 27.953 ↑ 1.0 1 1

Hash Join (cost=691.21..880.01 rows=1 width=24) (actual time=25.310..27.953 rows=1 loops=1)

  • Hash Cond: (subitem.id_item_plt = item.id_item_plt)
21. 1.824 1.824 ↑ 1.0 6,894 1

Seq Scan on tb_subitem_plt subitem (cost=0.00..162.94 rows=6,894 width=8) (actual time=0.021..1.824 rows=6,894 loops=1)

22. 0.004 24.614 ↑ 1.0 1 1

Hash (cost=691.19..691.19 rows=1 width=16) (actual time=24.614..24.614 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
23. 1.333 24.610 ↑ 1.0 1 1

Hash Join (cost=480.40..691.19 rows=1 width=16) (actual time=22.430..24.610 rows=1 loops=1)

  • Hash Cond: (item.id_plt_edicao = (max(tb_plt_edicao.id_plt_edicao)))
24. 2.517 2.517 ↑ 1.0 6,239 1

Seq Scan on tb_item_plt item (cost=0.00..187.39 rows=6,239 width=8) (actual time=0.017..2.517 rows=6,239 loops=1)

25. 0.003 20.760 ↑ 1.0 1 1

Hash (cost=480.39..480.39 rows=1 width=8) (actual time=20.760..20.760 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
26. 0.589 20.757 ↑ 1.0 1 1

Hash Join (cost=429.43..480.39 rows=1 width=8) (actual time=19.851..20.757 rows=1 loops=1)

  • Hash Cond: (tb_plt_edicao.id_plt_entidade = plt_conv.id_plt_entidade)
27. 3.876 18.739 ↓ 1.5 3,315 1

HashAggregate (cost=376.85..398.30 rows=2,145 width=8) (actual time=17.851..18.739 rows=3,315 loops=1)

28. 0.766 14.863 ↓ 1.5 3,315 1

Append (cost=170.95..366.12 rows=2,145 width=8) (actual time=9.975..14.863 rows=3,315 loops=1)

29. 5.581 11.687 ↓ 1.7 2,902 1

HashAggregate (cost=170.95..188.19 rows=1,724 width=8) (actual time=9.975..11.687 rows=2,902 loops=1)

30. 6.106 6.106 ↓ 1.0 2,902 1

Seq Scan on tb_plt_edicao (cost=0.00..156.48 rows=2,894 width=8) (actual time=0.072..6.106 rows=2,902 loops=1)

  • Filter: ((id_edicao_aditivo = 0) AND (id_status_plt = 5))
  • Rows Removed by Filter: 2730
31. 2.410 2.410 ↑ 1.0 413 1

Seq Scan on tb_plt_edicao tb_plt_edicao_1 (cost=0.00..156.48 rows=421 width=8) (actual time=0.206..2.410 rows=413 loops=1)

  • Filter: ((id_edicao_aditivo > 0) AND (id_status_plt = 5))
  • Rows Removed by Filter: 5219
32. 0.008 1.429 ↑ 1.0 1 1

Hash (cost=52.58..52.58 rows=1 width=8) (actual time=1.429..1.429 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
33. 1.421 1.421 ↑ 1.0 1 1

Seq Scan on tb_plt_convenio plt_conv (cost=0.00..52.58 rows=1 width=8) (actual time=0.682..1.421 rows=1 loops=1)

  • Filter: (id_convenio = 1201)
  • Rows Removed by Filter: 2925
34. 14.950 14.950 ↓ 0.0 0 1

Index Scan using ix_tb_plt_pdc_id_desp_subitem on tb_plt_pdc plt_pdc (cost=0.43..4.69 rows=1 width=24) (actual time=14.950..14.950 rows=0 loops=1)

  • Index Cond: (id_desp_subitem = desp.id_desp_subitem)
  • Filter: ((id_fonte_recurso = 2) AND (desp.id_subitem_plt = id_subitem_plt))
  • Rows Removed by Filter: 2
35. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_tb_item_prestacao_contas on tb_item_pdc ipdc (cost=0.43..0.55 rows=1 width=18) (never executed)

  • Index Cond: (id_item_pdc = plt_pdc.id_item_pdc)
36. 0.000 0.000 ↓ 0.0 0

Index Scan using fki_id_item_pdc on tb_status_item_pdc sipdc (cost=0.43..0.51 rows=2 width=14) (never executed)

  • Index Cond: (id_item_pdc = ipdc.id_item_pdc)
37. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_tb_status_item on tb_status_item si (cost=0.13..0.16 rows=1 width=4) (never executed)

  • Index Cond: (id_status_item = sipdc.id_status_item)
  • Filter: (flg_calcula_total = 'S'::bpchar)
38. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_id_prestacao_contas1 on tb_prestacao_contas pdc (cost=0.29..0.37 rows=1 width=8) (never executed)

  • Index Cond: (id_prestacao_contas = tb_edicao_pdc.id_prestacao_contas)
  • Filter: ((id_convenio = 1201) AND (id_tipo_movimento_pdc = 3))
39. 0.000 0.000 ↓ 0.0 0

Seq Scan on tb_fonte_recurso fr (cost=0.00..1.09 rows=1 width=4) (never executed)

  • Filter: ((id_fonte_recurso_sub = 2) AND (id_unidade_adm = 4))
40. 0.000 0.000 ↓ 0.0 0

Seq Scan on tb_despesa_unidade du (cost=0.00..7.37 rows=437 width=6) (never executed)