explain.depesz.com

PostgreSQL's explain analyze made readable

Result: cPmZ

Settings
# exclusive inclusive rows x rows loops node
1. 6,426.377 292,106.608 ↓ 8.0 8 1

Nested Loop (cost=173,088.32..252,836.16 rows=1 width=194) (actual time=281,897.287..292,106.608 rows=8 loops=1)

2. 0.145 269,215.889 ↓ 8.0 8 1

Nested Loop Left Join (cost=166,496.03..166,496.26 rows=1 width=198) (actual time=269,046.143..269,215.889 rows=8 loops=1)

3. 52.819 269,170.088 ↓ 8.0 8 1

Hash Right Join (cost=166,495.75..166,495.95 rows=1 width=175) (actual time=269,046.011..269,170.088 rows=8 loops=1)

  • Hash Cond: ((em.empnumeroprocesso)::text = (pp.prpnumeroprocesso)::text)
4. 1,330.086 227,898.029 ↓ 4,524.6 31,672 1

HashAggregate (cost=60,181.68..60,181.76 rows=7 width=27) (actual time=227,698.066..227,898.029 rows=31,672 loops=1)

  • Group Key: em.empnumeroprocesso, pg.pagstatus
5. 782.602 226,567.943 ↓ 5,056.0 111,233 1

Nested Loop (cost=0.42..60,181.51 rows=22 width=27) (actual time=2.336..226,567.943 rows=111,233 loops=1)

6. 16,884.133 16,884.133 ↓ 3,271.6 111,236 1

Seq Scan on pagamento pg (cost=0.00..59,894.21 rows=34 width=14) (actual time=0.782..16,884.133 rows=111,236 loops=1)

  • Filter: ((pagstatus = 'A'::bpchar) AND (btrim((pagsituacaopagamento)::text) ~~* '%EFETIVADO%'::text))
  • Rows Removed by Filter: 19,563
7. 208,901.208 208,901.208 ↑ 1.0 1 111,236

Index Scan using empenho_idx_empid on empenho em (cost=0.42..8.44 rows=1 width=21) (actual time=1.873..1.878 rows=1 loops=111,236)

  • Index Cond: (empid = pg.empid)
  • Filter: (empstatus = 'A'::bpchar)
  • Rows Removed by Filter: 0
8. 0.058 41,219.240 ↓ 8.0 8 1

Hash (cost=106,314.06..106,314.06 rows=1 width=143) (actual time=41,219.240..41,219.240 rows=8 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 2kB
9. 10.675 41,219.182 ↓ 8.0 8 1

Hash Join (cost=106,066.80..106,314.06 rows=1 width=143) (actual time=41,142.392..41,219.182 rows=8 loops=1)

  • Hash Cond: (d_1.dopid = dp.dopid)
10. 317.676 40,050.164 ↓ 2.9 23,309 1

HashAggregate (cost=51,234.64..51,373.10 rows=7,912 width=108) (actual time=39,964.935..40,050.164 rows=23,309 loops=1)

  • Group Key: d_1.dopid
11. 21.440 39,732.488 ↓ 5.1 40,607 1

Hash Left Join (cost=50,784.79..51,135.74 rows=7,912 width=108) (actual time=39,372.183..39,732.488 rows=40,607 loops=1)

  • Hash Cond: (emp.empid = emr.empidpai)
12. 25.222 39,708.893 ↓ 5.1 40,607 1

Hash Left Join (cost=50,709.62..51,030.88 rows=7,912 width=80) (actual time=39,369.991..39,708.893 rows=40,607 loops=1)

  • Hash Cond: (e.empid = er.empidpai)
13. 229.681 39,653.370 ↓ 5.1 40,607 1

Hash Right Join (cost=50,634.49..50,926.07 rows=7,912 width=52) (actual time=39,339.618..39,653.370 rows=40,607 loops=1)

  • Hash Cond: (empenho.empidpai = e.empid)
14. 418.608 4,708.218 ↓ 2.9 30,861 1

HashAggregate (cost=11,313.12..11,448.47 rows=10,828 width=29) (actual time=4,624.033..4,708.218 rows=30,861 loops=1)

  • Group Key: empenho.empnumeroprocesso, empenho.empidpai
15. 4,289.610 4,289.610 ↑ 1.0 33,177 1

Seq Scan on empenho (cost=0.00..11,061.32 rows=33,573 width=29) (actual time=0.029..4,289.610 rows=33,177 loops=1)

  • Filter: ((empsituacao <> 'CANCELADO'::bpchar) AND (empcodigoespecie = ANY ('{03,13,04}'::bpchar[])))
  • Rows Removed by Filter: 80,894
16. 235.943 34,715.471 ↓ 5.1 40,607 1

Hash (cost=39,222.47..39,222.47 rows=7,912 width=20) (actual time=34,715.471..34,715.471 rows=40,607 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 2,143kB
17. 289.192 34,479.528 ↓ 5.1 40,607 1

Nested Loop (cost=26,541.62..39,222.47 rows=7,912 width=20) (actual time=9,247.589..34,479.528 rows=40,607 loops=1)

18. 456.165 10,150.992 ↓ 3.6 40,607 1

Hash Join (cost=26,541.21..28,655.75 rows=11,276 width=12) (actual time=9,247.480..10,150.992 rows=40,607 loops=1)

  • Hash Cond: (ems.empid = emp.empid)
19. 447.438 447.438 ↓ 1.0 45,137 1

Seq Scan on empenhosubacao ems (cost=0.00..1,663.26 rows=45,136 width=4) (actual time=0.032..447.438 rows=45,137 loops=1)

  • Filter: (eobstatus = 'A'::bpchar)
  • Rows Removed by Filter: 1,044
20. 141.813 9,247.389 ↓ 1.4 40,536 1

Hash (cost=26,176.98..26,176.98 rows=29,138 width=8) (actual time=9,247.389..9,247.389 rows=40,536 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 1,584kB
21. 451.706 9,105.576 ↓ 1.4 40,536 1

Hash Join (cost=14,167.18..26,176.98 rows=29,138 width=8) (actual time=3,690.271..9,105.576 rows=40,536 loops=1)

  • Hash Cond: ((emp.empnumeroprocesso)::text = (prp.prpnumeroprocesso)::text)
22. 4,963.724 4,963.724 ↑ 1.0 79,674 1

Seq Scan on empenho emp (cost=0.00..11,207.11 rows=81,809 width=21) (actual time=0.025..4,963.724 rows=79,674 loops=1)

  • Filter: ((empstatus = 'A'::bpchar) AND (empcodigoespecie <> ALL ('{03,13,02,04}'::bpchar[])))
  • Rows Removed by Filter: 34,397
23. 32.877 3,690.146 ↓ 1.0 23,317 1

Hash (cost=13,888.55..13,888.55 rows=22,291 width=21) (actual time=3,690.146..3,690.146 rows=23,317 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 1,230kB
24. 122.824 3,657.269 ↓ 1.0 23,317 1

Hash Join (cost=10,191.36..13,888.55 rows=22,291 width=21) (actual time=2,075.072..3,657.269 rows=23,317 loops=1)

  • Hash Cond: (d_1.prpid = prp.prpid)
25. 1,462.268 1,577.458 ↓ 1.0 26,292 1

Bitmap Heap Scan on documentopar d_1 (cost=900.18..4,045.81 rows=26,291 width=8) (actual time=117.875..1,577.458 rows=26,292 loops=1)

  • Recheck Cond: (dopstatus = 'A'::bpchar)
  • Heap Blocks: exact=2,605
26. 115.190 115.190 ↓ 1.0 26,761 1

Bitmap Index Scan on ix_documentopar_dopstatus (cost=0.00..893.60 rows=26,291 width=0) (actual time=115.190..115.190 rows=26,761 loops=1)

  • Index Cond: (dopstatus = 'A'::bpchar)
27. 41.727 1,956.987 ↑ 2.5 24,750 1

Hash (cost=8,508.86..8,508.86 rows=62,586 width=21) (actual time=1,956.987..1,956.987 rows=24,750 loops=1)

  • Buckets: 8,192 Batches: 1 Memory Usage: 1,306kB
28. 1,915.260 1,915.260 ↑ 2.5 24,750 1

Seq Scan on processopar prp (cost=0.00..8,508.86 rows=62,586 width=21) (actual time=0.033..1,915.260 rows=24,750 loops=1)

29. 24,039.344 24,039.344 ↑ 1.0 1 40,607

Index Scan using pk_empenho on empenho e (cost=0.42..0.93 rows=1 width=12) (actual time=0.590..0.592 rows=1 loops=40,607)

  • Index Cond: (empid = emp.empid)
  • Filter: ((empsituacao <> 'CANCELADO'::bpchar) AND (empcodigoespecie <> ALL ('{03,13,02,04}'::bpchar[])))
30. 0.019 30.301 ↓ 2.9 20 1

Hash (cost=75.04..75.04 rows=7 width=36) (actual time=30.301..30.301 rows=20 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
31. 0.004 30.282 ↓ 2.9 20 1

Subquery Scan on er (cost=74.88..75.04 rows=7 width=36) (actual time=30.264..30.282 rows=20 loops=1)

32. 0.189 30.278 ↓ 2.9 20 1

HashAggregate (cost=74.88..74.97 rows=7 width=29) (actual time=30.261..30.278 rows=20 loops=1)

  • Group Key: empenho_1.empnumeroprocesso, empenho_1.empidpai
33. 30.089 30.089 ↑ 1.0 20 1

Index Scan using empenho_idx_empcodigoespecie on empenho empenho_1 (cost=0.42..74.73 rows=20 width=29) (actual time=14.299..30.089 rows=20 loops=1)

  • Index Cond: (empcodigoespecie = '02'::bpchar)
  • Filter: (empsituacao <> 'CANCELADO'::bpchar)
34. 0.087 2.155 ↓ 2.9 20 1

Hash (cost=75.09..75.09 rows=7 width=36) (actual time=2.155..2.155 rows=20 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
35. 0.008 2.068 ↓ 2.9 20 1

Subquery Scan on emr (cost=74.93..75.09 rows=7 width=36) (actual time=2.004..2.068 rows=20 loops=1)

36. 0.199 2.060 ↓ 2.9 20 1

HashAggregate (cost=74.93..75.02 rows=7 width=32) (actual time=2.003..2.060 rows=20 loops=1)

  • Group Key: empenho_2.empnumeroprocesso, empenho_2.empcodigoespecie, empenho_2.empidpai
37. 1.861 1.861 ↑ 1.0 20 1

Index Scan using empenho_idx_empcodigoespecie on empenho empenho_2 (cost=0.42..74.73 rows=20 width=32) (actual time=1.293..1.861 rows=20 loops=1)

  • Index Cond: (empcodigoespecie = '02'::bpchar)
  • Filter: (empstatus = 'A'::bpchar)
38. 0.067 1,158.343 ↓ 1.3 8 1

Hash (cost=54,832.09..54,832.09 rows=6 width=143) (actual time=1,158.343..1,158.343 rows=8 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 2kB
39. 0.073 1,158.276 ↓ 1.3 8 1

Hash Left Join (cost=53,757.36..54,832.09 rows=6 width=143) (actual time=1,015.172..1,158.276 rows=8 loops=1)

  • Hash Cond: (dp.dopid = pgs.dopid)
40. 0.069 308.563 ↓ 1.3 8 1

Nested Loop Left Join (cost=511.53..1,585.84 rows=6 width=143) (actual time=165.489..308.563 rows=8 loops=1)

41. 0.057 307.822 ↓ 1.3 8 1

Nested Loop Left Join (cost=510.97..1,536.19 rows=6 width=143) (actual time=165.468..307.822 rows=8 loops=1)

42. 0.050 306.429 ↓ 1.3 8 1

Nested Loop Left Join (cost=510.69..1,534.34 rows=6 width=124) (actual time=165.362..306.429 rows=8 loops=1)

43. 0.059 301.635 ↓ 1.3 8 1

Nested Loop (cost=510.12..1,484.69 rows=6 width=124) (actual time=165.324..301.635 rows=8 loops=1)

44. 0.173 301.416 ↓ 1.1 8 1

Nested Loop (cost=509.98..1,483.42 rows=7 width=68) (actual time=165.298..301.416 rows=8 loops=1)

45. 54.629 283.203 ↑ 2.5 8 1

Hash Right Join (cost=505.51..928.73 rows=20 width=34) (actual time=165.175..283.203 rows=8 loops=1)

  • Hash Cond: (opc.prpid = pp.prpid)
46. 71.087 71.087 ↑ 1.0 22,047 1

Seq Scan on situacaoopc opc (cost=0.00..340.47 rows=22,047 width=8) (actual time=2.832..71.087 rows=22,047 loops=1)

47. 0.030 157.487 ↑ 2.5 8 1

Hash (cost=505.26..505.26 rows=20 width=30) (actual time=157.487..157.487 rows=8 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
48. 82.955 157.457 ↑ 2.5 8 1

Hash Right Join (cost=82.05..505.26 rows=20 width=30) (actual time=4.660..157.457 rows=8 loops=1)

  • Hash Cond: (pc.prpid = pp.prpid)
49. 74.263 74.263 ↑ 1.0 22,047 1

Seq Scan on situacaoprestacaocontas pc (cost=0.00..340.47 rows=22,047 width=8) (actual time=0.028..74.263 rows=22,047 loops=1)

50. 0.035 0.239 ↑ 2.5 8 1

Hash (cost=81.80..81.80 rows=20 width=26) (actual time=0.239..0.239 rows=8 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
51. 0.084 0.204 ↑ 2.5 8 1

Bitmap Heap Scan on processopar pp (cost=4.57..81.80 rows=20 width=26) (actual time=0.147..0.204 rows=8 loops=1)

  • Recheck Cond: (inuid = 474)
  • Heap Blocks: exact=8
52. 0.120 0.120 ↑ 2.5 8 1

Bitmap Index Scan on idx_processopar_inuid (cost=0.00..4.57 rows=20 width=0) (actual time=0.120..0.120 rows=8 loops=1)

  • Index Cond: (inuid = 474)
53. 0.608 18.040 ↑ 1.0 1 8

Bitmap Heap Scan on documentopar dp (cost=4.47..27.72 rows=1 width=34) (actual time=2.231..2.255 rows=1 loops=8)

  • Recheck Cond: (prpid = pp.prpid)
  • Filter: ((dopid IS NOT NULL) AND (dopstatus = 'A'::bpchar))
  • Rows Removed by Filter: 3
  • Heap Blocks: exact=34
54. 17.432 17.432 ↑ 1.5 4 8

Bitmap Index Scan on ix_documentopar_prpid (cost=0.00..4.46 rows=6 width=0) (actual time=2.179..2.179 rows=4 loops=8)

  • Index Cond: (prpid = pp.prpid)
55. 0.160 0.160 ↑ 1.0 1 8

Index Scan using pk_modelosdocumentos on modelosdocumentos d (cost=0.14..0.17 rows=1 width=60) (actual time=0.017..0.020 rows=1 loops=8)

  • Index Cond: (mdoid = dp.mdoid)
  • Filter: (tpdcod = ANY ('{102,21,16,105}'::integer[]))
56. 4.744 4.744 ↑ 1.0 1 8

Index Scan using ix_documento_docid on documento dpc (cost=0.56..8.26 rows=1 width=8) (actual time=0.592..0.593 rows=1 loops=8)

  • Index Cond: (docid = pc.docid)
57. 1.336 1.336 ↑ 1.0 1 8

Index Scan using ix_esdid on estadodocumento epc (cost=0.28..0.30 rows=1 width=27) (actual time=0.166..0.167 rows=1 loops=8)

  • Index Cond: (dpc.esdid = esdid)
58. 0.672 0.672 ↑ 1.0 1 8

Index Scan using ix_documento_docid on documento dopc (cost=0.56..8.26 rows=1 width=8) (actual time=0.081..0.084 rows=1 loops=8)

  • Index Cond: (opc.docid = docid)
59. 0.032 849.640 ↑ 29.9 18 1

Hash (cost=53,239.08..53,239.08 rows=539 width=4) (actual time=849.640..849.640 rows=18 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
60. 0.010 849.608 ↑ 29.9 18 1

Subquery Scan on pgs (cost=53,226.96..53,239.08 rows=539 width=4) (actual time=849.538..849.608 rows=18 loops=1)

61. 0.219 849.598 ↑ 29.9 18 1

HashAggregate (cost=53,226.96..53,233.69 rows=539 width=24) (actual time=849.533..849.598 rows=18 loops=1)

  • Group Key: d_2.dopid, pag.pagsituacaopagamento
62. 0.063 849.379 ↑ 29.9 18 1

Nested Loop (cost=37,510.11..53,222.91 rows=539 width=24) (actual time=158.435..849.379 rows=18 loops=1)

63. 0.135 805.720 ↑ 84.1 18 1

Nested Loop (cost=37,509.69..52,036.58 rows=1,514 width=24) (actual time=158.396..805.720 rows=18 loops=1)

64. 0.111 774.103 ↑ 84.1 18 1

Nested Loop (cost=37,509.27..50,674.77 rows=1,514 width=37) (actual time=158.259..774.103 rows=18 loops=1)

65. 73.913 765.208 ↑ 185.7 18 1

Hash Join (cost=37,508.86..41,429.46 rows=3,342 width=24) (actual time=158.019..765.208 rows=18 loops=1)

  • Hash Cond: (ps.pagid = pag.pagid)
66. 539.547 539.547 ↑ 2.2 37,096 1

Seq Scan on pagamentosubacao ps (cost=0.00..2,882.95 rows=80,339 width=11) (actual time=0.015..539.547 rows=37,096 loops=1)

  • Filter: (pobstatus = 'A'::bpchar)
  • Rows Removed by Filter: 4,385
67. 0.457 151.748 ↑ 72.3 221 1

Hash (cost=37,309.19..37,309.19 rows=15,973 width=21) (actual time=151.748..151.748 rows=221 loops=1)

  • Buckets: 2,048 Batches: 1 Memory Usage: 15kB
68. 148.108 151.291 ↑ 72.3 221 1

Bitmap Heap Scan on pagamento pag (cost=2,730.25..37,309.19 rows=15,973 width=21) (actual time=3.233..151.291 rows=221 loops=1)

  • Recheck Cond: ((pagstatus = 'A'::bpchar) AND ((pagsituacaopagamento)::text = ANY ('{"8 - SOLICITAÇÃO APROVADA","SOLICITAÇÃO APROVADA","ENVIADO AO SIAFI","0 - AUTORI (...)
  • Heap Blocks: exact=177
69. 3.183 3.183 ↑ 71.3 224 1

Bitmap Index Scan on ix_pagamento_pagstatus_pagsituacao (cost=0.00..2,726.26 rows=15,973 width=0) (actual time=3.183..3.183 rows=224 loops=1)

  • Index Cond: ((pagstatus = 'A'::bpchar) AND ((pagsituacaopagamento)::text = ANY ('{"8 - SOLICITAÇÃO APROVADA","SOLICITAÇÃO APROVADA","ENVIADO AO SIAFI","0 - AU (...)
70. 8.784 8.784 ↑ 1.0 1 18

Index Scan using pk_empenho on empenho emp_1 (cost=0.42..2.76 rows=1 width=21) (actual time=0.487..0.488 rows=1 loops=18)

  • Index Cond: (empid = pag.empid)
  • Filter: ((empstatus = 'A'::bpchar) AND (empcodigoespecie <> ALL ('{03,13,02,04}'::bpchar[])))
71. 31.482 31.482 ↑ 1.0 1 18

Index Scan using processopar_pronumeroprocesso_key on processopar prp_1 (cost=0.41..0.89 rows=1 width=21) (actual time=1.748..1.749 rows=1 loops=18)

  • Index Cond: ((prpnumeroprocesso)::text = (emp_1.empnumeroprocesso)::text)
72. 43.596 43.596 ↑ 1.0 1 18

Index Scan using ix_documentopar_prpid on documentopar d_2 (cost=0.42..0.77 rows=1 width=8) (actual time=2.197..2.422 rows=1 loops=18)

  • Index Cond: (prpid = prp_1.prpid)
  • Filter: (dopstatus = 'A'::bpchar)
  • Rows Removed by Filter: 5
73. 45.656 45.656 ↑ 1.0 1 8

Index Scan using ix_esdid on estadodocumento eopc (cost=0.28..0.30 rows=1 width=27) (actual time=5.703..5.707 rows=1 loops=8)

  • Index Cond: (dopc.esdid = esdid)
74. 1.720 1.720 ↑ 1.0 1 8

Index Only Scan using idx_instrumentounidade_inuid on instrumentounidade iu (cost=0.28..4.30 rows=1 width=4) (actual time=0.207..0.215 rows=1 loops=8)

  • Index Cond: (inuid = 474)
  • Heap Fetches: 0
75.          

SubPlan (for Nested Loop)

76. 0.112 13.288 ↑ 1.0 1 8

Aggregate (cost=8.31..8.32 rows=1 width=4) (actual time=1.661..1.661 rows=1 loops=8)

77. 13.176 13.176 ↑ 1.0 1 8

Index Scan using ix_documentoparvalidacao_dopid on documentoparvalidacao (cost=0.29..8.31 rows=1 width=4) (actual time=1.645..1.647 rows=1 loops=8)

  • Index Cond: (dopid = dp.dopid)
  • Filter: ((dpvstatus)::text = 'A'::text)
78. 0.048 26.048 ↑ 1.0 1 8

Limit (cost=78.90..78.91 rows=1 width=4) (actual time=3.256..3.256 rows=1 loops=8)

79. 0.904 26.000 ↑ 6.0 1 8

Subquery Scan on foo (cost=78.90..79.00 rows=6 width=4) (actual time=3.250..3.250 rows=1 loops=8)

80. 0.616 25.096 ↑ 6.0 1 8

Sort (cost=78.90..78.91 rows=6 width=22) (actual time=3.137..3.137 rows=1 loops=8)

  • Sort Key: d_3.dopid, (CASE WHEN ((dpv.dpvid IS NOT NULL) AND (d_3.dopstatus = 'A'::bpchar)) THEN 0 WHEN ((dpv.dpvid IS NULL) AND (d_3.dopstatus = 'A'::bpchar) AND (d_3.mdoid = ANY ('{69,82,81,41,80,68,42,67,65,76,79,74,44,78,56,62,52, (...)
  • Sort Method: quicksort Memory: 25kB
81. 0.863 24.480 ↑ 1.5 4 8

Nested Loop Left Join (cost=0.71..78.82 rows=6 width=22) (actual time=1.067..3.060 rows=4 loops=8)

82. 12.312 12.312 ↑ 1.5 4 8

Index Scan using ix_documentopar_prpid on documentopar d_3 (cost=0.42..28.48 rows=6 width=18) (actual time=0.992..1.539 rows=4 loops=8)

  • Index Cond: (prpid = pp.prpid)
  • Filter: ((dopdatafimvigencia IS NOT NULL) AND (dopstatus <> 'E'::bpchar))
83. 11.305 11.305 ↑ 1.0 1 35

Index Scan using ix_documentoparvalidacao_dopid on documentoparvalidacao dpv (cost=0.29..8.31 rows=1 width=8) (actual time=0.319..0.323 rows=1 loops=35)

  • Index Cond: (d_3.dopid = dopid)
  • Filter: ((dpvstatus)::text = 'A'::text)
84. 0.030 17.280 ↑ 1.0 1 6

Limit (cost=78.90..78.91 rows=1 width=4) (actual time=2.880..2.880 rows=1 loops=6)

85. 0.240 17.250 ↑ 6.0 1 6

Subquery Scan on foo_1 (cost=78.90..79.00 rows=6 width=4) (actual time=2.875..2.875 rows=1 loops=6)

86. 0.252 17.010 ↑ 6.0 1 6

Sort (cost=78.90..78.91 rows=6 width=22) (actual time=2.835..2.835 rows=1 loops=6)

  • Sort Key: d_4.dopid, (CASE WHEN ((dpv_1.dpvid IS NOT NULL) AND (d_4.dopstatus = 'A'::bpchar)) THEN 0 WHEN ((dpv_1.dpvid IS NULL) AND (d_4.dopstatus = 'A'::bpchar) AND (d_4.mdoid = ANY ('{69,82,81,41,80,68,42,67,65,76,79,74,44,78,56,62 (...)
  • Sort Method: quicksort Memory: 25kB
87. 0.420 16.758 ↑ 2.0 3 6

Nested Loop Left Join (cost=0.71..78.82 rows=6 width=22) (actual time=0.993..2.793 rows=3 loops=6)

88. 10.452 10.452 ↑ 2.0 3 6

Index Scan using ix_documentopar_prpid on documentopar d_4 (cost=0.42..28.48 rows=6 width=18) (actual time=0.039..1.742 rows=3 loops=6)

  • Index Cond: (prpid = pp.prpid)
  • Filter: ((dopdatafimvigencia IS NOT NULL) AND (dopstatus <> 'E'::bpchar))
89. 5.886 5.886 ↑ 1.0 1 18

Index Scan using ix_documentoparvalidacao_dopid on documentoparvalidacao dpv_1 (cost=0.29..8.31 rows=1 width=8) (actual time=0.325..0.327 rows=1 loops=18)

  • Index Cond: (d_4.dopid = dopid)
  • Filter: ((dpvstatus)::text = 'A'::text)
90. 0.000 0.000 ↓ 0.0 0

Limit (cost=78.90..78.91 rows=1 width=4) (never executed)

91. 0.000 0.000 ↓ 0.0 0

Subquery Scan on foo_2 (cost=78.90..79.00 rows=6 width=4) (never executed)

92. 0.000 0.000 ↓ 0.0 0

Sort (cost=78.90..78.91 rows=6 width=22) (never executed)

  • Sort Key: d_5.dopid, (CASE WHEN ((dpv_2.dpvid IS NOT NULL) AND (d_5.dopstatus = 'A'::bpchar)) THEN 0 WHEN ((dpv_2.dpvid IS NULL) AND (d_5.dopstatus = 'A'::bpchar) AND (d_5.mdoid = ANY ('{69,82,81,41,80,68,42,67,65,76,79,74,44,78,56,62 (...)
93. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=0.71..78.82 rows=6 width=22) (never executed)

94. 0.000 0.000 ↓ 0.0 0

Index Scan using ix_documentopar_prpid on documentopar d_5 (cost=0.42..28.48 rows=6 width=18) (never executed)

  • Index Cond: (prpid = pp.prpid)
  • Filter: ((dopdatafimvigencia IS NOT NULL) AND (dopstatus <> 'E'::bpchar))
95. 0.000 0.000 ↓ 0.0 0

Index Scan using ix_documentoparvalidacao_dopid on documentoparvalidacao dpv_2 (cost=0.29..8.31 rows=1 width=8) (never executed)

  • Index Cond: (d_5.dopid = dopid)
  • Filter: ((dpvstatus)::text = 'A'::text)
96. 24.064 102.024 ↑ 1.0 1 8

Limit (cost=78.90..78.91 rows=1 width=4) (actual time=12.752..12.753 rows=1 loops=8)

97. 0.192 77.960 ↑ 6.0 1 8

Subquery Scan on foo_3 (cost=78.90..79.00 rows=6 width=4) (actual time=9.745..9.745 rows=1 loops=8)

98. 0.320 77.768 ↑ 6.0 1 8

Sort (cost=78.90..78.91 rows=6 width=22) (actual time=9.721..9.721 rows=1 loops=8)

  • Sort Key: d_6.dopid, (CASE WHEN ((dpv_3.dpvid IS NOT NULL) AND (d_6.dopstatus = 'A'::bpchar)) THEN 0 WHEN ((dpv_3.dpvid IS NULL) AND (d_6.dopstatus = 'A'::bpchar) AND (d_6.mdoid = ANY ('{69,82,81,41,80,68,42,67,65,76,79,74,44,78,56,62 (...)
  • Sort Method: quicksort Memory: 25kB
99. 1.329 77.448 ↑ 1.5 4 8

Nested Loop Left Join (cost=0.71..78.82 rows=6 width=22) (actual time=1.881..9.681 rows=4 loops=8)

100. 4.264 4.264 ↑ 1.5 4 8

Index Scan using ix_documentopar_prpid on documentopar d_6 (cost=0.42..28.48 rows=6 width=18) (actual time=0.042..0.533 rows=4 loops=8)

  • Index Cond: (prpid = pp.prpid)
  • Filter: ((dopdatafimvigencia IS NOT NULL) AND (dopstatus <> 'E'::bpchar))
101. 71.855 71.855 ↑ 1.0 1 35

Index Scan using ix_documentoparvalidacao_dopid on documentoparvalidacao dpv_3 (cost=0.29..8.31 rows=1 width=8) (actual time=2.051..2.053 rows=1 loops=35)

  • Index Cond: (d_6.dopid = dopid)
  • Filter: ((dpvstatus)::text = 'A'::text)
102. 0.208 1,073.552 ↑ 1.0 1 8

Nested Loop (cost=0.56..1,467.94 rows=1 width=0) (actual time=134.194..134.194 rows=1 loops=8)

103. 1,072.960 1,072.960 ↑ 1.0 1 8

Seq Scan on documentoparprestacaodecontas dpp11 (cost=0.00..1,459.34 rows=1 width=4) (actual time=28.941..134.120 rows=1 loops=8)

  • Filter: (prpid = dp.prpid)
  • Rows Removed by Filter: 14,557
104. 0.384 0.384 ↑ 1.0 1 8

Index Scan using ix_documento_docid on documento doc11 (cost=0.56..8.59 rows=1 width=4) (actual time=0.048..0.048 rows=1 loops=8)

  • Index Cond: (docid = dpp11.docid)
  • Filter: (esdid <> 2005)
  • Rows Removed by Filter: 0
105. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.56..184,433.00 rows=22,105 width=4) (never executed)

106. 0.000 0.000 ↓ 0.0 0

Seq Scan on documentoparprestacaodecontas dpp11_1 (cost=0.00..1,404.07 rows=22,107 width=8) (never executed)

107. 0.000 0.000 ↓ 0.0 0

Index Scan using ix_documento_docid on documento doc11_1 (cost=0.56..8.27 rows=1 width=4) (never executed)

  • Index Cond: (docid = dpp11_1.docid)
  • Filter: (esdid <> 2005)
108. 0.027 2.160 ↑ 1.0 1 3

Limit (cost=78.90..78.91 rows=1 width=4) (actual time=0.720..0.720 rows=1 loops=3)

109. 0.159 2.133 ↑ 6.0 1 3

Subquery Scan on foo_4 (cost=78.90..79.00 rows=6 width=4) (actual time=0.711..0.711 rows=1 loops=3)

110. 0.363 1.974 ↑ 6.0 1 3

Sort (cost=78.90..78.91 rows=6 width=22) (actual time=0.658..0.658 rows=1 loops=3)

  • Sort Key: d_7.dopid, (CASE WHEN ((dpv_4.dpvid IS NOT NULL) AND (d_7.dopstatus = 'A'::bpchar)) THEN 0 WHEN ((dpv_4.dpvid IS NULL) AND (d_7.dopstatus = 'A'::bpchar) AND (d_7.mdoid = ANY ('{69,82,81,41,80,68,42,67,65,76,79,74,44,78,56,62 (...)
  • Sort Method: quicksort Memory: 25kB
111. 0.486 1.611 ↓ 1.2 7 3

Nested Loop Left Join (cost=0.71..78.82 rows=6 width=22) (actual time=0.224..0.537 rows=7 loops=3)

112. 0.537 0.537 ↓ 1.2 7 3

Index Scan using ix_documentopar_prpid on documentopar d_7 (cost=0.42..28.48 rows=6 width=18) (actual time=0.100..0.179 rows=7 loops=3)

  • Index Cond: (prpid = pp.prpid)
  • Filter: ((dopdatafimvigencia IS NOT NULL) AND (dopstatus <> 'E'::bpchar))
113. 0.588 0.588 ↑ 1.0 1 21

Index Scan using ix_documentoparvalidacao_dopid on documentoparvalidacao dpv_4 (cost=0.29..8.31 rows=1 width=8) (actual time=0.025..0.028 rows=1 loops=21)

  • Index Cond: (d_7.dopid = dopid)
  • Filter: ((dpvstatus)::text = 'A'::text)
114. 0.080 28.064 ↑ 1.0 1 8

Limit (cost=78.53..78.54 rows=1 width=12) (actual time=3.508..3.508 rows=1 loops=8)

115. 0.320 27.984 ↑ 5.0 1 8

Sort (cost=78.53..78.55 rows=5 width=12) (actual time=3.498..3.498 rows=1 loops=8)

  • Sort Key: d_8.dopid
  • Sort Method: top-N heapsort Memory: 25kB
116. 0.276 27.664 ↑ 1.2 4 8

Nested Loop (cost=0.71..78.51 rows=5 width=12) (actual time=3.378..3.458 rows=4 loops=8)

117. 20.528 20.528 ↑ 1.5 4 8

Index Scan using ix_documentopar_prpid on documentopar d_8 (cost=0.42..28.55 rows=6 width=12) (actual time=2.537..2.566 rows=4 loops=8)

  • Index Cond: (prpid = pp.prpid)
  • Filter: ((dopstatus <> 'E'::bpchar) AND (mdoid <> ALL ('{79,65,66,68,76,80,67,73,82}'::integer[])))
118. 6.860 6.860 ↑ 1.0 1 35

Index Scan using ix_documentoparvalidacao_dopid on documentoparvalidacao v (cost=0.29..8.32 rows=1 width=4) (actual time=0.195..0.196 rows=1 loops=35)

  • Index Cond: (dopid = d_8.dopid)
  • Filter: ((dpvstatus)::text = 'A'::text)
119. 0.352 6,220.696 ↑ 1.0 1 8

Aggregate (cost=11,689.01..11,689.02 rows=1 width=72) (actual time=777.587..777.587 rows=1 loops=8)

120. 0.182 6,220.344 ↑ 1.0 2 8

Hash Left Join (cost=11,404.73..11,688.99 rows=2 width=72) (actual time=751.857..777.543 rows=2 loops=8)

  • Hash Cond: (e_1.empid = er_1.empidpai)
121. 118.080 6,192.232 ↑ 1.0 2 8

Hash Right Join (cost=11,329.60..11,613.85 rows=2 width=44) (actual time=748.346..774.029 rows=2 loops=8)

  • Hash Cond: (empenho_3.empidpai = e_1.empid)
122. 1,174.966 6,026.096 ↓ 2.9 30,861 8

HashAggregate (cost=11,313.12..11,448.47 rows=10,828 width=29) (actual time=652.306..753.262 rows=30,861 loops=8)

  • Group Key: empenho_3.empnumeroprocesso, empenho_3.empidpai
123. 4,851.130 4,851.130 ↑ 1.0 33,177 1

Seq Scan on empenho empenho_3 (cost=0.00..11,061.32 rows=33,573 width=29) (actual time=0.016..4,851.130 rows=33,177 loops=1)

  • Filter: ((empsituacao <> 'CANCELADO'::bpchar) AND (empcodigoespecie = ANY ('{03,13,04}'::bpchar[])))
  • Rows Removed by Filter: 80,894
124. 0.136 48.056 ↑ 1.0 2 8

Hash (cost=16.46..16.46 rows=2 width=12) (actual time=6.007..6.007 rows=2 loops=8)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
125. 47.920 47.920 ↑ 1.0 2 8

Index Scan using idx_empnumeroprocesso on empenho e_1 (cost=0.42..16.46 rows=2 width=12) (actual time=5.983..5.990 rows=2 loops=8)

  • Index Cond: ((empnumeroprocesso)::text = (pp.prpnumeroprocesso)::text)
  • Filter: ((empsituacao <> 'CANCELADO'::bpchar) AND (empcodigoespecie <> ALL ('{03,13,02,04}'::bpchar[])))
  • Rows Removed by Filter: 1
126. 0.140 27.930 ↓ 2.9 20 1

Hash (cost=75.04..75.04 rows=7 width=36) (actual time=27.930..27.930 rows=20 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
127. 0.004 27.790 ↓ 2.9 20 1

Subquery Scan on er_1 (cost=74.88..75.04 rows=7 width=36) (actual time=27.766..27.790 rows=20 loops=1)

128. 0.216 27.786 ↓ 2.9 20 1

HashAggregate (cost=74.88..74.97 rows=7 width=29) (actual time=27.764..27.786 rows=20 loops=1)

  • Group Key: empenho_4.empnumeroprocesso, empenho_4.empidpai
129. 27.570 27.570 ↑ 1.0 20 1

Index Scan using empenho_idx_empcodigoespecie on empenho empenho_4 (cost=0.42..74.73 rows=20 width=29) (actual time=15.754..27.570 rows=20 loops=1)

  • Index Cond: (empcodigoespecie = '02'::bpchar)
  • Filter: (empsituacao <> 'CANCELADO'::bpchar)
130. 0.216 608.288 ↑ 1.0 1 8

Limit (cost=0.43..11,030.82 rows=1 width=17) (actual time=76.035..76.036 rows=1 loops=8)

131. 62.562 608.072 ↑ 1.0 1 8

Index Scan using ix_processo on dadosfinanceirosconvenios p (cost=0.43..11,030.82 rows=1 width=17) (actual time=76.009..76.009 rows=1 loops=8)

  • Index Cond: ((dfiprocesso)::text = (pp.prpnumeroprocesso)::text)
  • Filter: (to_char(dfidatasaldo, 'YYYY-MM-DD'::text) = (SubPlan 11))
  • Rows Removed by Filter: 8
132.          

SubPlan (for Index Scan)

133. 5.110 545.510 ↑ 1.0 1 70

Aggregate (cost=208.01..208.03 rows=1 width=8) (actual time=7.792..7.793 rows=1 loops=70)

134. 509.110 540.400 ↑ 2.1 25 70

Bitmap Heap Scan on dadosfinanceirosconvenios (cost=4.83..207.88 rows=52 width=8) (actual time=0.483..7.720 rows=25 loops=70)

  • Recheck Cond: ((dfiprocesso)::text = (p.dfiprocesso)::text)
  • Heap Blocks: exact=1,730
135. 31.290 31.290 ↑ 2.1 25 70

Bitmap Index Scan on ix_processo (cost=0.00..4.82 rows=52 width=0) (actual time=0.447..0.447 rows=25 loops=70)

  • Index Cond: ((dfiprocesso)::text = (p.dfiprocesso)::text)
136. 0.064 20.800 ↑ 1.0 1 8

Limit (cost=78.90..78.91 rows=1 width=4) (actual time=2.600..2.600 rows=1 loops=8)

137. 0.264 20.736 ↑ 6.0 1 8

Subquery Scan on foo_5 (cost=78.90..79.00 rows=6 width=4) (actual time=2.592..2.592 rows=1 loops=8)

138. 0.392 20.472 ↑ 6.0 1 8

Sort (cost=78.90..78.91 rows=6 width=22) (actual time=2.559..2.559 rows=1 loops=8)

  • Sort Key: d_9.dopid, (CASE WHEN ((dpv_5.dpvid IS NOT NULL) AND (d_9.dopstatus = 'A'::bpchar)) THEN 0 WHEN ((dpv_5.dpvid IS NULL) AND (d_9.dopstatus = 'A'::bpchar) AND (d_9.mdoid = ANY ('{69,82,81,41,80,68,42,67,65,76,79,74,44,78,56,62 (...)
  • Sort Method: quicksort Memory: 25kB
139. 0.668 20.080 ↑ 1.5 4 8

Nested Loop Left Join (cost=0.71..78.82 rows=6 width=22) (actual time=0.859..2.510 rows=4 loops=8)

140. 18.432 18.432 ↑ 1.5 4 8

Index Scan using ix_documentopar_prpid on documentopar d_9 (cost=0.42..28.48 rows=6 width=18) (actual time=0.770..2.304 rows=4 loops=8)

  • Index Cond: (prpid = pp.prpid)
  • Filter: ((dopdatafimvigencia IS NOT NULL) AND (dopstatus <> 'E'::bpchar))
141. 0.980 0.980 ↑ 1.0 1 35

Index Scan using ix_documentoparvalidacao_dopid on documentoparvalidacao dpv_5 (cost=0.29..8.31 rows=1 width=8) (actual time=0.027..0.028 rows=1 loops=35)

  • Index Cond: (d_9.dopid = dopid)
  • Filter: ((dpvstatus)::text = 'A'::text)
142. 2,094.177 2,094.177 ↓ 1.0 3,781 1

Seq Scan on documentoparreprogramacao (cost=0.00..6,582.55 rows=3,780 width=4) (actual time=0.025..2,094.177 rows=3,781 loops=1)

  • Filter: (dprstatus = 'P'::bpchar)
  • Rows Removed by Filter: 89,310
143. 0.056 524.200 ↓ 0.0 0 2

Nested Loop (cost=0.56..1,467.94 rows=1 width=0) (actual time=262.100..262.100 rows=0 loops=2)

144. 524.054 524.054 ↑ 1.0 1 2

Seq Scan on documentoparprestacaodecontas dpp11_2 (cost=0.00..1,459.34 rows=1 width=4) (actual time=11.883..262.027 rows=1 loops=2)

  • Filter: (prpid = dp.prpid)
  • Rows Removed by Filter: 22,106
145. 0.090 0.090 ↓ 0.0 0 2

Index Scan using ix_documento_docid on documento doc11_2 (cost=0.56..8.59 rows=1 width=4) (actual time=0.045..0.045 rows=0 loops=2)

  • Index Cond: (docid = dpp11_2.docid)
  • Filter: (esdid <> 2005)
  • Rows Removed by Filter: 1
146. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.56..184,433.00 rows=22,105 width=4) (never executed)

147. 0.000 0.000 ↓ 0.0 0

Seq Scan on documentoparprestacaodecontas dpp11_3 (cost=0.00..1,404.07 rows=22,107 width=8) (never executed)

148. 0.000 0.000 ↓ 0.0 0

Index Scan using ix_documento_docid on documento doc11_3 (cost=0.56..8.27 rows=1 width=4) (never executed)

  • Index Cond: (docid = dpp11_3.docid)
  • Filter: (esdid <> 2005)
149. 0.772 0.772 ↑ 1.0 1 2

Index Scan using ix_documentopar_dopid on documentopar (cost=0.42..8.46 rows=1 width=8) (actual time=0.381..0.386 rows=1 loops=2)

  • Index Cond: (dopid = dp.dopid)
150. 3.618 3.618 ↑ 1.0 1 2

Index Scan using ix_documentopar_dopid on documentopar documentopar_1 (cost=0.42..8.46 rows=1 width=8) (actual time=1.808..1.809 rows=1 loops=2)

  • Index Cond: (dopid = dp.dopid)
151. 0.192 521.760 ↑ 1.0 1 6

Nested Loop (cost=0.56..1,467.94 rows=1 width=0) (actual time=86.960..86.960 rows=1 loops=6)

152. 521.232 521.232 ↑ 1.0 1 6

Seq Scan on documentoparprestacaodecontas dpp11_4 (cost=0.00..1,459.34 rows=1 width=4) (actual time=21.993..86.872 rows=1 loops=6)

  • Filter: (prpid = dp.prpid)
  • Rows Removed by Filter: 12,041
153. 0.336 0.336 ↑ 1.0 1 6

Index Scan using ix_documento_docid on documento doc11_4 (cost=0.56..8.59 rows=1 width=4) (actual time=0.056..0.056 rows=1 loops=6)

  • Index Cond: (docid = dpp11_4.docid)
  • Filter: (esdid <> 2005)
  • Rows Removed by Filter: 0
154. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.56..184,433.00 rows=22,105 width=4) (never executed)

155. 0.000 0.000 ↓ 0.0 0

Seq Scan on documentoparprestacaodecontas dpp11_5 (cost=0.00..1,404.07 rows=22,107 width=8) (never executed)

156. 0.000 0.000 ↓ 0.0 0

Index Scan using ix_documento_docid on documento doc11_5 (cost=0.56..8.27 rows=1 width=4) (never executed)

  • Index Cond: (docid = dpp11_5.docid)
  • Filter: (esdid <> 2005)
157. 0.087 833.670 ↓ 0.0 0 3

Nested Loop (cost=0.56..1,467.94 rows=1 width=0) (actual time=277.890..277.890 rows=0 loops=3)

158. 817.179 817.179 ↑ 1.0 1 3

Seq Scan on documentoparprestacaodecontas dpp11_6 (cost=0.00..1,459.34 rows=1 width=4) (actual time=6.423..272.393 rows=1 loops=3)

  • Filter: (prpid = dp.prpid)
  • Rows Removed by Filter: 22,106
159. 16.404 16.404 ↓ 0.0 0 3

Index Scan using ix_documento_docid on documento doc11_6 (cost=0.56..8.59 rows=1 width=4) (actual time=5.468..5.468 rows=0 loops=3)

  • Index Cond: (docid = dpp11_6.docid)
  • Filter: (esdid <> 2005)
  • Rows Removed by Filter: 1
160. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.56..184,433.00 rows=22,105 width=4) (never executed)

161. 0.000 0.000 ↓ 0.0 0

Seq Scan on documentoparprestacaodecontas dpp11_7 (cost=0.00..1,404.07 rows=22,107 width=8) (never executed)

162. 0.000 0.000 ↓ 0.0 0

Index Scan using ix_documento_docid on documento doc11_7 (cost=0.56..8.27 rows=1 width=4) (never executed)

  • Index Cond: (docid = dpp11_7.docid)
  • Filter: (esdid <> 2005)
163. 0.130 103.260 ↑ 1.0 1 5

Nested Loop (cost=21,816.16..23,513.48 rows=1 width=0) (actual time=20.652..20.652 rows=1 loops=5)

164. 0.102 83.755 ↑ 1.0 1 5

Nested Loop (cost=21,815.88..23,513.17 rows=1 width=4) (actual time=16.751..16.751 rows=1 loops=5)

165. 0.125 83.125 ↓ 2.0 2 5

Nested Loop (cost=21,815.46..23,512.69 rows=1 width=8) (actual time=16.613..16.625 rows=2 loops=5)

166. 0.320 75.185 ↑ 1.0 1 5

Hash Join (cost=21,815.03..23,511.90 rows=1 width=16) (actual time=15.037..15.037 rows=1 loops=5)

  • Hash Cond: (tc.sbdid = sd.sbdid)
167. 0.095 0.220 ↑ 1,487.0 1 5

Bitmap Heap Scan on termocomposicao tc (cost=31.95..1,723.23 rows=1,487 width=4) (actual time=0.044..0.044 rows=1 loops=5)

  • Recheck Cond: (dopid = dp.dopid)
  • Heap Blocks: exact=5
168. 0.125 0.125 ↑ 1,487.0 1 5

Bitmap Index Scan on ix_termocomposicao_dopid (cost=0.00..31.57 rows=1,487 width=0) (actual time=0.025..0.025 rows=1 loops=5)

  • Index Cond: (dopid = dp.dopid)
169. 0.085 74.645 ↑ 846.2 4 5

Hash (cost=21,740.77..21,740.77 rows=3,385 width=20) (actual time=14.929..14.929 rows=4 loops=5)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
170. 0.102 74.560 ↑ 846.2 4 5

Nested Loop (cost=14,664.67..21,740.77 rows=3,385 width=20) (actual time=14.856..14.912 rows=4 loops=5)

171. 0.204 39.290 ↑ 1,487.0 1 5

Nested Loop (cost=14,664.23..20,829.56 rows=1,487 width=8) (actual time=7.834..7.858 rows=1 loops=5)

172. 0.180 38.820 ↑ 1,487.0 1 5

HashAggregate (cost=14,663.80..14,678.67 rows=1,487 width=4) (actual time=7.751..7.764 rows=1 loops=5)

  • Group Key: s_1.sbaid
173. 0.090 38.640 ↑ 1,487.0 1 5

Nested Loop (cost=33.23..14,660.09 rows=1,487 width=4) (actual time=6.961..7.728 rows=1 loops=5)

174. 10.025 10.025 ↑ 1.0 1 5

Index Only Scan using ix_documentopar_dopid on documentopar dp_1 (cost=0.42..8.44 rows=1 width=4) (actual time=2.003..2.005 rows=1 loops=5)

  • Index Cond: (dopid = dp.dopid)
  • Heap Fetches: 3
175. 0.103 28.525 ↑ 1,487.0 1 5

Nested Loop (cost=32.81..14,636.78 rows=1,487 width=8) (actual time=4.940..5.705 rows=1 loops=5)

176. 0.156 27.855 ↑ 1,487.0 1 5

Nested Loop (cost=32.38..13,942.97 rows=1,487 width=8) (actual time=4.836..5.571 rows=1 loops=5)

177. 0.140 14.385 ↑ 1,487.0 1 5

Bitmap Heap Scan on termocomposicao tc_1 (cost=31.95..1,723.23 rows=1,487 width=8) (actual time=2.876..2.877 rows=1 loops=5)

  • Recheck Cond: (dopid = dp.dopid)
  • Heap Blocks: exact=5
178. 14.245 14.245 ↑ 1,487.0 1 5

Bitmap Index Scan on ix_termocomposicao_dopid (cost=0.00..31.57 rows=1,487 width=0) (actual time=2.849..2.849 rows=1 loops=5)

  • Index Cond: (dopid = dp.dopid)
179. 13.314 13.314 ↑ 1.0 1 7

Index Scan using idx_subacaodetalhe_sbdid on subacaodetalhe sd_1 (cost=0.43..8.21 rows=1 width=8) (actual time=1.901..1.902 rows=1 loops=7)

  • Index Cond: (sbdid = tc_1.sbdid)
180. 0.567 0.567 ↑ 1.0 1 7

Index Only Scan using pk_subacao on subacao s_1 (cost=0.43..0.46 rows=1 width=4) (actual time=0.075..0.081 rows=1 loops=7)

  • Index Cond: (sbaid = sd_1.sbaid)
  • Heap Fetches: 0
181. 0.266 0.266 ↑ 1.0 1 7

Index Only Scan using idx_subacao_sbaid on subacao s (cost=0.43..4.12 rows=1 width=4) (actual time=0.036..0.038 rows=1 loops=7)

  • Index Cond: (sbaid = s_1.sbaid)
  • Heap Fetches: 0
182. 35.168 35.168 ↓ 1.5 3 7

Index Scan using idx_subacaodetalhe_sbaid_sbdano on subacaodetalhe sd (cost=0.43..0.59 rows=2 width=12) (actual time=5.006..5.024 rows=3 loops=7)

  • Index Cond: (sbaid = s.sbaid)
183. 7.815 7.815 ↑ 1.5 2 5

Index Scan using idx_subacaoitenscomposicao_sbaid_icoano on subacaoitenscomposicao si (cost=0.43..0.76 rows=3 width=16) (actual time=1.553..1.563 rows=2 loops=5)

  • Index Cond: ((sbaid = sd.sbaid) AND (icoano = sd.sbdano))
184. 0.528 0.528 ↓ 0.0 0 12

Index Only Scan using ix_subacaoitenscomposicaocontratos_icoid on subacaoitenscomposicaocontratos sicc (cost=0.42..0.46 rows=2 width=4) (actual time=0.044..0.044 rows=0 loops=12)

  • Index Cond: (icoid = si.icoid)
  • Heap Fetches: 0
185. 19.375 19.375 ↑ 1.0 1 5

Index Only Scan using pk_propostaitemcomposicao on propostaitemcomposicao pic (cost=0.28..0.30 rows=1 width=4) (actual time=3.875..3.875 rows=1 loops=5)

  • Index Cond: (picid = si.picid)
  • Heap Fetches: 0
186. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.56..1,467.94 rows=1 width=0) (never executed)

187. 0.000 0.000 ↓ 0.0 0

Seq Scan on documentoparprestacaodecontas dpp11_8 (cost=0.00..1,459.34 rows=1 width=4) (never executed)

  • Filter: (prpid = dp.prpid)
188. 0.000 0.000 ↓ 0.0 0

Index Scan using ix_documento_docid on documento doc11_8 (cost=0.56..8.59 rows=1 width=4) (never executed)

  • Index Cond: (docid = dpp11_8.docid)
  • Filter: (esdid <> 2005)
189. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.56..184,433.00 rows=22,105 width=4) (never executed)

190. 0.000 0.000 ↓ 0.0 0

Seq Scan on documentoparprestacaodecontas dpp11_9 (cost=0.00..1,404.07 rows=22,107 width=8) (never executed)

191. 0.000 0.000 ↓ 0.0 0

Index Scan using ix_documento_docid on documento doc11_9 (cost=0.56..8.27 rows=1 width=4) (never executed)

  • Index Cond: (docid = dpp11_9.docid)
  • Filter: (esdid <> 2005)
192. 57.768 57.768 ↓ 0.0 0 8

Seq Scan on termossigpcpar (cost=0.00..35.14 rows=1 width=0) (actual time=7.221..7.221 rows=0 loops=8)

  • Filter: (prpid = dp.prpid)
  • Rows Removed by Filter: 1,691
193. 0.000 0.000 ↓ 0.0 0

Seq Scan on termossigpcpar termossigpcpar_1 (cost=0.00..30.91 rows=1,691 width=4) (never executed)

194. 0.232 2,136.184 ↑ 1.0 1 8

Nested Loop (cost=0.56..1,467.93 rows=1 width=4) (actual time=20.395..267.023 rows=1 loops=8)

195. 2,134.184 2,134.184 ↑ 1.0 1 8

Seq Scan on documentoparprestacaodecontas pc_1 (cost=0.00..1,459.34 rows=1 width=4) (actual time=20.148..266.773 rows=1 loops=8)

  • Filter: (prpid = dp.prpid)
  • Rows Removed by Filter: 22,106
196. 1.768 1.768 ↑ 1.0 1 8

Index Scan using ix_documento_docid on documento d_10 (cost=0.56..8.58 rows=1 width=8) (actual time=0.219..0.221 rows=1 loops=8)

  • Index Cond: (docid = pc_1.docid)
197. 0.039 50.751 ↑ 1.0 1 3

Aggregate (cost=14,932.76..14,932.77 rows=1 width=4) (actual time=16.917..16.917 rows=1 loops=3)

198. 0.167 50.712 ↓ 0.0 0 3

Hash Semi Join (cost=35.95..14,932.31 rows=180 width=4) (actual time=16.904..16.904 rows=0 loops=3)

  • Hash Cond: (s_2.prgid = programaformacao.prgid)
199. 0.052 40.659 ↑ 393.5 2 3

Nested Loop (cost=32.81..14,925.11 rows=787 width=8) (actual time=2.846..13.553 rows=2 loops=3)

200. 0.090 36.357 ↑ 743.5 2 3

Nested Loop (cost=32.38..13,942.97 rows=1,487 width=4) (actual time=1.438..12.119 rows=2 loops=3)

201. 0.075 4.122 ↑ 743.5 2 3

Bitmap Heap Scan on termocomposicao tc_2 (cost=31.95..1,723.23 rows=1,487 width=4) (actual time=1.373..1.374 rows=2 loops=3)

  • Recheck Cond: (dopid = dp.dopid)
  • Heap Blocks: exact=3
202. 4.047 4.047 ↑ 743.5 2 3

Bitmap Index Scan on ix_termocomposicao_dopid (cost=0.00..31.57 rows=1,487 width=0) (actual time=1.349..1.349 rows=2 loops=3)

  • Index Cond: (dopid = dp.dopid)
203. 32.145 32.145 ↑ 1.0 1 5

Index Scan using idx_subacaodetalhe_sbdid on subacaodetalhe sd_2 (cost=0.43..8.21 rows=1 width=8) (actual time=6.427..6.429 rows=1 loops=5)

  • Index Cond: (sbdid = tc_2.sbdid)
204. 4.250 4.250 ↑ 1.0 1 5

Index Scan using pk_subacao on subacao s_2 (cost=0.43..0.65 rows=1 width=8) (actual time=0.848..0.850 rows=1 loops=5)

  • Index Cond: (sbaid = sd_2.sbaid)
  • Filter: (sbastatus = 'A'::bpchar)
205. 0.024 9.886 ↑ 1.0 45 1

Hash (cost=2.58..2.58 rows=45 width=4) (actual time=9.886..9.886 rows=45 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 2kB
206. 0.064 9.862 ↑ 1.0 45 1

HashAggregate (cost=1.68..2.12 rows=45 width=4) (actual time=9.852..9.862 rows=45 loops=1)

  • Group Key: programaformacao.prgid
207. 9.798 9.798 ↑ 1.0 45 1

Seq Scan on programaformacao (cost=0.00..1.56 rows=45 width=4) (actual time=9.779..9.798 rows=45 loops=1)

  • Filter: ((frmstatus)::text = 'A'::text)
208. 0.064 6.752 ↑ 1.0 1 8

Limit (cost=78.90..78.91 rows=1 width=4) (actual time=0.844..0.844 rows=1 loops=8)

209. 0.328 6.688 ↑ 6.0 1 8

Subquery Scan on foo_6 (cost=78.90..79.00 rows=6 width=4) (actual time=0.836..0.836 rows=1 loops=8)

210. 0.464 6.360 ↑ 6.0 1 8

Sort (cost=78.90..78.91 rows=6 width=22) (actual time=0.795..0.795 rows=1 loops=8)

  • Sort Key: d_11.dopid, (CASE WHEN ((dpv_6.dpvid IS NOT NULL) AND (d_11.dopstatus = 'A'::bpchar)) THEN 0 WHEN ((dpv_6.dpvid IS NULL) AND (d_11.dopstatus = 'A'::bpchar) AND (d_11.mdoid = ANY ('{69,82,81,41,80,68,42,67,65,76,79,74,44,78,5 (...)
  • Sort Method: quicksort Memory: 25kB
211. 0.729 5.896 ↑ 1.5 4 8

Nested Loop Left Join (cost=0.71..78.82 rows=6 width=22) (actual time=0.510..0.737 rows=4 loops=8)

212. 3.592 3.592 ↑ 1.5 4 8

Index Scan using ix_documentopar_prpid on documentopar d_11 (cost=0.42..28.48 rows=6 width=18) (actual time=0.413..0.449 rows=4 loops=8)

  • Index Cond: (prpid = pp.prpid)
  • Filter: ((dopdatafimvigencia IS NOT NULL) AND (dopstatus <> 'E'::bpchar))
213. 1.575 1.575 ↑ 1.0 1 35

Index Scan using ix_documentoparvalidacao_dopid on documentoparvalidacao dpv_6 (cost=0.29..8.31 rows=1 width=8) (actual time=0.043..0.045 rows=1 loops=35)

  • Index Cond: (d_11.dopid = dopid)
  • Filter: ((dpvstatus)::text = 'A'::text)
214. 0.036 0.036 ↓ 0.0 0 2

Index Scan using ix_documentoparvalidacao_dopid on documentoparvalidacao documentoparvalidacao_1 (cost=0.29..8.31 rows=1 width=0) (actual time=0.018..0.018 rows=0 loops=2)

  • Index Cond: (dopid = dp.dopid)
  • Filter: ((dpvstatus)::text = 'A'::text)
215. 0.000 0.000 ↓ 0.0 0

Seq Scan on documentoparvalidacao documentoparvalidacao_2 (cost=0.00..2,380.86 rows=114,149 width=4) (never executed)

  • Filter: ((dpvstatus)::text = 'A'::text)
216. 7.282 2,002.426 ↑ 89.0 1 1

HashAggregate (cost=8,674.74..8,675.63 rows=89 width=1) (actual time=2,002.426..2,002.426 rows=1 loops=1)

  • Group Key: processopar.prpfinalizado
217. 1.288 1,995.144 ↓ 77.9 6,932 1

Append (cost=0.00..8,674.52 rows=89 width=1) (actual time=0.023..1,995.144 rows=6,932 loops=1)

218. 1,993.809 1,993.809 ↓ 78.8 6,932 1

Seq Scan on processopar (cost=0.00..8,665.33 rows=88 width=1) (actual time=0.022..1,993.809 rows=6,932 loops=1)

  • Filter: (prpfinalizado AND ((prpnumeroprocesso)::text = (prpnumeroprocesso)::text))
  • Rows Removed by Filter: 17,818
219. 0.047 0.047 ↓ 0.0 0 1

Index Scan using ix_processoobraspar_pronumeroprocesso on processoobraspar (cost=0.29..8.30 rows=1 width=1) (actual time=0.047..0.047 rows=0 loops=1)

  • Index Cond: ((pronumeroprocesso)::text = (pp.prpnumeroprocesso)::text)
  • Filter: profinalizado
220. 0.000 0.000 ↓ 0.0 0

Limit (cost=78.90..78.91 rows=1 width=4) (never executed)

221. 0.000 0.000 ↓ 0.0 0

Subquery Scan on foo_7 (cost=78.90..79.00 rows=6 width=4) (never executed)

222. 0.000 0.000 ↓ 0.0 0

Sort (cost=78.90..78.91 rows=6 width=22) (never executed)

  • Sort Key: d_12.dopid, (CASE WHEN ((dpv_7.dpvid IS NOT NULL) AND (d_12.dopstatus = 'A'::bpchar)) THEN 0 WHEN ((dpv_7.dpvid IS NULL) AND (d_12.dopstatus = 'A'::bpchar) AND (d_12.mdoid = ANY ('{69,82,81,41,80,68,42,67,65,76,79,74,44,78,5 (...)
223. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=0.71..78.82 rows=6 width=22) (never executed)

224. 0.000 0.000 ↓ 0.0 0

Index Scan using ix_documentopar_prpid on documentopar d_12 (cost=0.42..28.48 rows=6 width=18) (never executed)

  • Index Cond: (prpid = pp.prpid)
  • Filter: ((dopdatafimvigencia IS NOT NULL) AND (dopstatus <> 'E'::bpchar))
225. 0.000 0.000 ↓ 0.0 0

Index Scan using ix_documentoparvalidacao_dopid on documentoparvalidacao dpv_7 (cost=0.29..8.31 rows=1 width=8) (never executed)

  • Index Cond: (d_12.dopid = dopid)
  • Filter: ((dpvstatus)::text = 'A'::text)
226. 0.000 0.000 ↓ 0.0 0

Limit (cost=78.90..78.91 rows=1 width=4) (never executed)

227. 0.000 0.000 ↓ 0.0 0

Subquery Scan on foo_8 (cost=78.90..79.00 rows=6 width=4) (never executed)

228. 0.000 0.000 ↓ 0.0 0

Sort (cost=78.90..78.91 rows=6 width=22) (never executed)

  • Sort Key: d_13.dopid, (CASE WHEN ((dpv_8.dpvid IS NOT NULL) AND (d_13.dopstatus = 'A'::bpchar)) THEN 0 WHEN ((dpv_8.dpvid IS NULL) AND (d_13.dopstatus = 'A'::bpchar) AND (d_13.mdoid = ANY ('{69,82,81,41,80,68,42,67,65,76,79,74,44,78,5 (...)
229. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=0.71..78.82 rows=6 width=22) (never executed)

230. 0.000 0.000 ↓ 0.0 0

Index Scan using ix_documentopar_prpid on documentopar d_13 (cost=0.42..28.48 rows=6 width=18) (never executed)

  • Index Cond: (prpid = pp.prpid)
  • Filter: ((dopdatafimvigencia IS NOT NULL) AND (dopstatus <> 'E'::bpchar))
231. 0.000 0.000 ↓ 0.0 0

Index Scan using ix_documentoparvalidacao_dopid on documentoparvalidacao dpv_8 (cost=0.29..8.31 rows=1 width=8) (never executed)

  • Index Cond: (d_13.dopid = dopid)
  • Filter: ((dpvstatus)::text = 'A'::text)
232. 0.010 15.048 ↑ 1.0 1 2

Limit (cost=78.90..78.91 rows=1 width=4) (actual time=7.524..7.524 rows=1 loops=2)

233. 0.134 15.038 ↑ 6.0 1 2

Subquery Scan on foo_9 (cost=78.90..79.00 rows=6 width=4) (actual time=7.519..7.519 rows=1 loops=2)

234. 0.162 14.904 ↑ 6.0 1 2

Sort (cost=78.90..78.91 rows=6 width=22) (actual time=7.452..7.452 rows=1 loops=2)

  • Sort Key: d_14.dopid, (CASE WHEN ((dpv_9.dpvid IS NOT NULL) AND (d_14.dopstatus = 'A'::bpchar)) THEN 0 WHEN ((dpv_9.dpvid IS NULL) AND (d_14.dopstatus = 'A'::bpchar) AND (d_14.mdoid = ANY ('{69,82,81,41,80,68,42,67,65,76,79,74,44,78,5 (...)
  • Sort Method: quicksort Memory: 25kB
235. 0.376 14.742 ↓ 1.3 8 2

Nested Loop Left Join (cost=0.71..78.82 rows=6 width=22) (actual time=0.164..7.371 rows=8 loops=2)

236. 14.026 14.026 ↓ 1.3 8 2

Index Scan using ix_documentopar_prpid on documentopar d_14 (cost=0.42..28.48 rows=6 width=18) (actual time=0.078..7.013 rows=8 loops=2)

  • Index Cond: (prpid = pp.prpid)
  • Filter: ((dopdatafimvigencia IS NOT NULL) AND (dopstatus <> 'E'::bpchar))
237. 0.340 0.340 ↑ 1.0 1 17

Index Scan using ix_documentoparvalidacao_dopid on documentoparvalidacao dpv_9 (cost=0.29..8.31 rows=1 width=8) (actual time=0.019..0.020 rows=1 loops=17)

  • Index Cond: (d_14.dopid = dopid)
  • Filter: ((dpvstatus)::text = 'A'::text)
238. 0.000 0.000 ↓ 0.0 0

Limit (cost=78.90..78.91 rows=1 width=4) (never executed)

239. 0.000 0.000 ↓ 0.0 0

Subquery Scan on foo_10 (cost=78.90..79.00 rows=6 width=4) (never executed)

240. 0.000 0.000 ↓ 0.0 0

Sort (cost=78.90..78.91 rows=6 width=22) (never executed)

  • Sort Key: d_15.dopid, (CASE WHEN ((dpv_10.dpvid IS NOT NULL) AND (d_15.dopstatus = 'A'::bpchar)) THEN 0 WHEN ((dpv_10.dpvid IS NULL) AND (d_15.dopstatus = 'A'::bpchar) AND (d_15.mdoid = ANY ('{69,82,81,41,80,68,42,67,65,76,79,74,44,78 (...)
241. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=0.71..78.82 rows=6 width=22) (never executed)

242. 0.000 0.000 ↓ 0.0 0

Index Scan using ix_documentopar_prpid on documentopar d_15 (cost=0.42..28.48 rows=6 width=18) (never executed)

  • Index Cond: (prpid = pp.prpid)
  • Filter: ((dopdatafimvigencia IS NOT NULL) AND (dopstatus <> 'E'::bpchar))
243. 0.000 0.000 ↓ 0.0 0

Index Scan using ix_documentoparvalidacao_dopid on documentoparvalidacao dpv_10 (cost=0.29..8.31 rows=1 width=8) (never executed)

  • Index Cond: (d_15.dopid = dopid)
  • Filter: ((dpvstatus)::text = 'A'::text)
244. 0.000 0.000 ↓ 0.0 0

Limit (cost=78.90..78.91 rows=1 width=4) (never executed)

245. 0.000 0.000 ↓ 0.0 0

Subquery Scan on foo_11 (cost=78.90..79.00 rows=6 width=4) (never executed)

246. 0.000 0.000 ↓ 0.0 0

Sort (cost=78.90..78.91 rows=6 width=22) (never executed)

  • Sort Key: d_16.dopid, (CASE WHEN ((dpv_11.dpvid IS NOT NULL) AND (d_16.dopstatus = 'A'::bpchar)) THEN 0 WHEN ((dpv_11.dpvid IS NULL) AND (d_16.dopstatus = 'A'::bpchar) AND (d_16.mdoid = ANY ('{69,82,81,41,80,68,42,67,65,76,79,74,44,78 (...)
247. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=0.71..78.82 rows=6 width=22) (never executed)

248. 0.000 0.000 ↓ 0.0 0

Index Scan using ix_documentopar_prpid on documentopar d_16 (cost=0.42..28.48 rows=6 width=18) (never executed)

  • Index Cond: (prpid = pp.prpid)
  • Filter: ((dopdatafimvigencia IS NOT NULL) AND (dopstatus <> 'E'::bpchar))
249. 0.000 0.000 ↓ 0.0 0

Index Scan using ix_documentoparvalidacao_dopid on documentoparvalidacao dpv_11 (cost=0.29..8.31 rows=1 width=8) (never executed)

  • Index Cond: (d_16.dopid = dopid)" Filter: ((dpvstatus)::text = 'A'::text)