explain.depesz.com

PostgreSQL's explain analyze made readable

Result: csp6

Settings
# exclusive inclusive rows x rows loops node
1. 0.024 931.075 ↓ 25.0 25 1

HashAggregate (cost=459.38..459.39 rows=1 width=36) (actual time=931.072..931.075 rows=25 loops=1)

2. 10.697 931.051 ↓ 25.0 25 1

HashAggregate (cost=459.35..459.36 rows=1 width=18) (actual time=931.048..931.051 rows=25 loops=1)

3. 283.252 920.354 ↓ 4,968.0 4,968 1

Nested Loop (cost=379.99..459.34 rows=1 width=18) (actual time=368.852..920.354 rows=4,968 loops=1)

  • Join Filter: (ipdc.id_item_despesa = du.id_item_despesa)
  • Rows Removed by Join Filter: 2568456
4. 5.853 448.318 ↓ 4,968.0 4,968 1

Nested Loop (cost=379.99..443.69 rows=1 width=20) (actual time=368.820..448.318 rows=4,968 loops=1)

5. 9.824 432.529 ↓ 4,968.0 4,968 1

Nested Loop (cost=379.85..443.51 rows=1 width=20) (actual time=368.813..432.529 rows=4,968 loops=1)

6. 2.448 417.737 ↓ 4,968.0 4,968 1

Nested Loop (cost=379.85..442.49 rows=1 width=24) (actual time=368.806..417.737 rows=4,968 loops=1)

7. 5.402 400.385 ↓ 4,968.0 4,968 1

Nested Loop (cost=379.57..442.12 rows=1 width=32) (actual time=368.795..400.385 rows=4,968 loops=1)

8. 11.076 379.962 ↓ 5,007.0 5,007 1

Hash Join (cost=379.44..441.96 rows=1 width=36) (actual time=368.782..379.962 rows=5,007 loops=1)

  • Hash Cond: ((max(tb_edicao_pdc.id_edicao_pdc)) = ipdc.id_edicao_pdc)
9. 2.359 2.780 ↓ 1.0 2,633 1

HashAggregate (cost=157.16..183.48 rows=2,632 width=8) (actual time=2.124..2.780 rows=2,633 loops=1)

10. 0.421 0.421 ↑ 1.0 5,744 1

Seq Scan on tb_edicao_pdc (cost=0.00..128.44 rows=5,744 width=8) (actual time=0.004..0.421 rows=5,744 loops=1)

11. 19.981 366.106 ↓ 38,233.0 38,233 1

Hash (cost=222.27..222.27 rows=1 width=36) (actual time=366.106..366.106 rows=38,233 loops=1)

  • Buckets: 1024 Batches: 4 (originally 1) Memory Usage: 1025kB
12. 12.229 346.125 ↓ 38,233.0 38,233 1

Nested Loop (cost=150.00..222.27 rows=1 width=36) (actual time=7.596..346.125 rows=38,233 loops=1)

13. 17.314 257.880 ↓ 38,008.0 38,008 1

Nested Loop (cost=149.57..221.77 rows=1 width=34) (actual time=7.588..257.880 rows=38,008 loops=1)

14. 35.051 164.550 ↓ 38,008.0 38,008 1

Nested Loop (cost=149.15..221.23 rows=1 width=16) (actual time=7.573..164.550 rows=38,008 loops=1)

  • Join Filter: (subitem.id_subitem_plt = desp.id_subitem_plt)
15. 28.361 91.491 ↓ 38,008.0 38,008 1

Nested Loop (cost=148.87..220.91 rows=1 width=24) (actual time=7.564..91.491 rows=38,008 loops=1)

  • Join Filter: (item.id_item_plt = subitem.id_item_plt)
16. 5.252 25.122 ↓ 4,751.0 38,008 1

Nested Loop (cost=148.72..219.45 rows=8 width=28) (actual time=7.554..25.122 rows=38,008 loops=1)

17. 0.056 0.433 ↑ 1.0 1 1

Hash Join (cost=31.36..39.80 rows=1 width=16) (actual time=0.387..0.433 rows=1 loops=1)

  • Hash Cond: (item.id_plt_edicao = (max(tb_plt_edicao.id_plt_edicao)))
18. 0.027 0.027 ↑ 1.0 322 1

Seq Scan on tb_item_plt item (cost=0.00..7.22 rows=322 width=8) (actual time=0.002..0.027 rows=322 loops=1)

19. 0.001 0.350 ↑ 1.0 1 1

Hash (cost=31.35..31.35 rows=1 width=8) (actual time=0.350..0.350 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
20. 0.025 0.349 ↑ 1.0 1 1

Hash Join (cost=27.38..31.35 rows=1 width=8) (actual time=0.332..0.349 rows=1 loops=1)

  • Hash Cond: (tb_plt_edicao.id_plt_entidade = plt_conv.id_plt_entidade)
21. 0.069 0.303 ↓ 1.1 191 1

HashAggregate (cost=22.95..24.62 rows=167 width=8) (actual time=0.285..0.303 rows=191 loops=1)

22. 0.013 0.234 ↓ 1.1 191 1

Append (cost=9.96..22.12 rows=167 width=8) (actual time=0.143..0.234 rows=191 loops=1)

23. 0.100 0.172 ↓ 1.2 191 1

HashAggregate (cost=9.96..11.62 rows=166 width=8) (actual time=0.143..0.172 rows=191 loops=1)

24. 0.072 0.072 ↑ 1.0 225 1

Seq Scan on tb_plt_edicao (cost=0.00..8.83 rows=225 width=8) (actual time=0.003..0.072 rows=225 loops=1)

  • Filter: ((id_edicao_aditivo = 0) AND (id_status_plt = 5))
  • Rows Removed by Filter: 97
25. 0.049 0.049 ↓ 0.0 0 1

Seq Scan on tb_plt_edicao tb_plt_edicao_1 (cost=0.00..8.83 rows=1 width=8) (actual time=0.049..0.049 rows=0 loops=1)

  • Filter: ((id_edicao_aditivo > 0) AND (id_status_plt = 5))
  • Rows Removed by Filter: 322
26. 0.001 0.021 ↑ 1.0 1 1

Hash (cost=4.41..4.41 rows=1 width=8) (actual time=0.021..0.021 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
27. 0.020 0.020 ↑ 1.0 1 1

Seq Scan on tb_plt_convenio plt_conv (cost=0.00..4.41 rows=1 width=8) (actual time=0.010..0.020 rows=1 loops=1)

  • Filter: (id_convenio = 1201)
  • Rows Removed by Filter: 192
28. 12.446 19.437 ↓ 1,583.7 38,008 1

Bitmap Heap Scan on tb_plt_pdc plt_pdc (cost=117.35..179.41 rows=24 width=24) (actual time=7.161..19.437 rows=38,008 loops=1)

  • Recheck Cond: ((id_item_plt = item.id_item_plt) AND (id_plt_edicao = item.id_plt_edicao))
  • Filter: (id_fonte_recurso = 2)
29. 0.083 6.991 ↓ 0.0 0 1

BitmapAnd (cost=117.35..117.35 rows=24 width=0) (actual time=6.991..6.991 rows=0 loops=1)

30. 3.116 3.116 ↓ 8.7 38,008 1

Bitmap Index Scan on idx_tb_plt_pdc_id_item_plt (cost=0.00..58.55 rows=4,364 width=0) (actual time=3.116..3.116 rows=38,008 loops=1)

  • Index Cond: (id_item_plt = item.id_item_plt)
31. 3.792 3.792 ↓ 8.7 38,008 1

Bitmap Index Scan on idx_tb_plt_pdc_id_plt_edicao (cost=0.00..58.55 rows=4,364 width=0) (actual time=3.792..3.792 rows=38,008 loops=1)

  • Index Cond: (id_plt_edicao = item.id_plt_edicao)
32. 38.008 38.008 ↑ 1.0 1 38,008

Index Scan using pk_tb_subitem_plt on tb_subitem_plt subitem (cost=0.15..0.17 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=38,008)

  • Index Cond: (id_subitem_plt = plt_pdc.id_subitem_plt)
  • Filter: (plt_pdc.id_item_plt = id_item_plt)
33. 38.008 38.008 ↑ 1.0 1 38,008

Index Scan using pk_tb_desp_subitem on tb_desp_subitem desp (cost=0.28..0.31 rows=1 width=12) (actual time=0.001..0.001 rows=1 loops=38,008)

  • Index Cond: (id_desp_subitem = plt_pdc.id_desp_subitem)
  • Filter: (plt_pdc.id_subitem_plt = id_subitem_plt)
34. 76.016 76.016 ↑ 1.0 1 38,008

Index Scan using pk_tb_item_prestacao_contas on tb_item_pdc ipdc (cost=0.42..0.54 rows=1 width=18) (actual time=0.002..0.002 rows=1 loops=38,008)

  • Index Cond: (id_item_pdc = plt_pdc.id_item_pdc)
35. 76.016 76.016 ↑ 1.0 1 38,008

Index Scan using fki_id_item_pdc on tb_status_item_pdc sipdc (cost=0.42..0.48 rows=1 width=14) (actual time=0.002..0.002 rows=1 loops=38,008)

  • Index Cond: (id_item_pdc = ipdc.id_item_pdc)
36. 15.021 15.021 ↑ 1.0 1 5,007

Index Scan using pk_tb_status_item on tb_status_item si (cost=0.13..0.16 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=5,007)

  • Index Cond: (id_status_item = sipdc.id_status_item)
  • Filter: (flg_calcula_total = 'S'::bpchar)
  • Rows Removed by Filter: 0
37. 14.904 14.904 ↑ 1.0 1 4,968

Index Scan using idx_id_prestacao_contas1 on tb_prestacao_contas pdc (cost=0.28..0.35 rows=1 width=8) (actual time=0.002..0.003 rows=1 loops=4,968)

  • Index Cond: (id_prestacao_contas = tb_edicao_pdc.id_prestacao_contas)
  • Filter: ((id_convenio = 1201) AND (id_tipo_movimento_pdc = 3))
38. 4.968 4.968 ↑ 1.0 1 4,968

Seq Scan on tb_fonte_recurso fr (cost=0.00..1.01 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=4,968)

  • Filter: ((id_fonte_recurso_sub = 2) AND (id_unidade_adm = 4))
39. 9.936 9.936 ↑ 1.0 1 4,968

Index Scan using pk_tb_despesas on tb_despesa d (cost=0.14..0.16 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=4,968)

  • Index Cond: (id_despesa = desp.id_despesa)
  • Filter: (flg_status = 'A'::bpchar)
40. 188.784 188.784 ↑ 1.0 518 4,968

Seq Scan on tb_despesa_unidade du (cost=0.00..9.18 rows=518 width=6) (actual time=0.001..0.038 rows=518 loops=4,968)