explain.depesz.com

PostgreSQL's explain analyze made readable

Result: uUsV

Settings
# exclusive inclusive rows x rows loops node
1. 1.898 3,762.221 ↑ 1.0 3,416 1

Hash Left Join (cost=3,856.36..5,069.94 rows=3,416 width=1,754) (actual time=59.011..3,762.221 rows=3,416 loops=1)

  • Hash Cond: (d.cd_demanda = nota.cd_demanda)
2. 1,230.735 3,760.309 ↑ 1.0 3,416 1

Nested Loop Left Join (cost=3,855.15..5,059.75 rows=3,416 width=1,706) (actual time=58.987..3,760.309 rows=3,416 loops=1)

  • Join Filter: (d.cd_demanda = a.cd_demanda)
  • Rows Removed by Join Filter: 11604170
3. 1,294.363 1,948.854 ↑ 1.0 3,416 1

Nested Loop Left Join (cost=3,276.53..3,974.94 rows=3,416 width=1,210) (actual time=51.152..1,948.854 rows=3,416 loops=1)

  • Join Filter: (d.cd_demanda = a_1.cd_demanda)
  • Rows Removed by Join Filter: 11341215
4. 2.706 63.523 ↑ 1.0 3,416 1

Hash Left Join (cost=2,761.86..2,954.08 rows=3,416 width=714) (actual time=45.990..63.523 rows=3,416 loops=1)

  • Hash Cond: (d.cd_demanda = resp.cd_demanda)
5. 2.540 35.592 ↑ 1.0 3,416 1

Hash Left Join (cost=1,830.82..2,014.07 rows=3,416 width=673) (actual time=20.747..35.592 rows=3,416 loops=1)

  • Hash Cond: (d.cd_demanda = ass.cd_demanda)
6. 1.514 31.910 ↑ 1.0 3,416 1

Hash Left Join (cost=1,716.80..1,853.44 rows=3,416 width=661) (actual time=19.586..31.910 rows=3,416 loops=1)

  • Hash Cond: (d.cd_projeto = ref.cd_projeto)
7. 1.522 30.375 ↑ 1.0 3,416 1

Hash Join (cost=1,715.26..1,842.89 rows=3,416 width=585) (actual time=19.543..30.375 rows=3,416 loops=1)

  • Hash Cond: (d.cd_origem = o.cd_origem)
8. 1.680 28.835 ↑ 1.0 3,416 1

Hash Join (cost=1,714.14..1,825.21 rows=3,416 width=553) (actual time=19.515..28.835 rows=3,416 loops=1)

  • Hash Cond: (d.cd_tarefa = td.cd_tarefa)
9. 1.691 27.136 ↑ 1.0 3,416 1

Hash Join (cost=1,712.40..1,813.35 rows=3,416 width=485) (actual time=19.487..27.136 rows=3,416 loops=1)

  • Hash Cond: (d.cd_lotacao = lot.cd_lotacao)
10. 1.481 25.425 ↑ 1.0 3,416 1

Hash Join (cost=1,710.68..1,801.47 rows=3,416 width=409) (actual time=19.455..25.425 rows=3,416 loops=1)

  • Hash Cond: (d.cd_lotacao = depart.cd_lotacao)
11. 2.514 23.937 ↑ 1.0 3,416 1

Hash Right Join (cost=1,709.52..1,785.92 rows=3,416 width=373) (actual time=19.437..23.937 rows=3,416 loops=1)

  • Hash Cond: (rs.cd_demanda = d.cd_demanda)
12. 4.368 19.474 ↓ 1.0 3,416 1

HashAggregate (cost=1,579.66..1,613.42 rows=3,376 width=168) (actual time=17.467..19.474 rows=3,416 loops=1)

  • Group Key: rs.cd_demanda, rs.cd_servidor, servidor.tx_nomecompleto, ('SER'::text), ((servidor.cd_arquivo)::text), servidor.tx_email, servidor.tx_ramal
13. 0.329 15.106 ↓ 1.0 3,416 1

Append (cost=7.64..1,520.58 rows=3,376 width=168) (actual time=0.150..15.106 rows=3,416 loops=1)

14. 1.300 1.773 ↑ 1.0 3,374 1

Hash Join (cost=7.64..82.35 rows=3,374 width=134) (actual time=0.150..1.773 rows=3,374 loops=1)

  • Hash Cond: (rs.cd_servidor = servidor.cd_servidor)
15. 0.362 0.362 ↑ 1.0 3,374 1

Seq Scan on requerenteservidor rs (cost=0.00..48.74 rows=3,374 width=8) (actual time=0.009..0.362 rows=3,374 loops=1)

16. 0.062 0.111 ↑ 1.0 162 1

Hash (cost=5.62..5.62 rows=162 width=70) (actual time=0.111..0.111 rows=162 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 25kB
17. 0.049 0.049 ↑ 1.0 162 1

Seq Scan on servidor (cost=0.00..5.62 rows=162 width=70) (actual time=0.006..0.049 rows=162 loops=1)

18. 0.866 12.987 ↓ 41.0 41 1

Hash Join (cost=1,194.21..1,402.40 rows=1 width=147) (actual time=10.734..12.987 rows=41 loops=1)

  • Hash Cond: ((deputado.iddeputado = d_1.iddeputado) AND ((max(deputado.idlegislatura)) = d_1.idlegislatura))
19. 6.885 8.630 ↑ 1.0 7,570 1

HashAggregate (cost=605.37..681.07 rows=7,570 width=8) (actual time=7.089..8.630 rows=7,570 loops=1)

  • Group Key: deputado.iddeputado
20. 1.745 1.745 ↑ 1.0 16,558 1

Seq Scan on deputado (cost=0.00..522.58 rows=16,558 width=8) (actual time=0.006..1.745 rows=16,558 loops=1)

21. 0.026 3.491 ↑ 1.9 47 1

Hash (cost=587.50..587.50 rows=90 width=123) (actual time=3.491..3.491 rows=47 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 16kB
22. 1.684 3.465 ↑ 1.9 47 1

Hash Join (cost=1.92..587.50 rows=90 width=123) (actual time=0.314..3.465 rows=47 loops=1)

  • Hash Cond: (d_1.iddeputado = rd.iddeputado)
23. 1.764 1.764 ↑ 1.0 16,558 1

Seq Scan on deputado d_1 (cost=0.00..522.58 rows=16,558 width=115) (actual time=0.007..1.764 rows=16,558 loops=1)

24. 0.010 0.017 ↑ 1.0 41 1

Hash (cost=1.41..1.41 rows=41 width=8) (actual time=0.017..0.017 rows=41 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
25. 0.007 0.007 ↑ 1.0 41 1

Seq Scan on requerentedeputado rd (cost=0.00..1.41 rows=41 width=8) (actual time=0.004..0.007 rows=41 loops=1)

26. 0.004 0.017 ↑ 1.0 1 1

Nested Loop (cost=0.00..2.08 rows=1 width=168) (actual time=0.016..0.017 rows=1 loops=1)

  • Join Filter: (re.cd_externo = ext.cd_externo)
  • Rows Removed by Join Filter: 1
27. 0.010 0.010 ↑ 1.0 1 1

Seq Scan on requerenteexterno re (cost=0.00..1.01 rows=1 width=8) (actual time=0.010..0.010 rows=1 loops=1)

28. 0.003 0.003 ↑ 1.5 2 1

Seq Scan on externo ext (cost=0.00..1.03 rows=3 width=36) (actual time=0.003..0.003 rows=2 loops=1)

29. 1.048 1.949 ↑ 1.0 3,416 1

Hash (cost=87.16..87.16 rows=3,416 width=209) (actual time=1.949..1.949 rows=3,416 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 471kB
30. 0.901 0.901 ↑ 1.0 3,416 1

Seq Scan on demanda d (cost=0.00..87.16 rows=3,416 width=209) (actual time=0.004..0.901 rows=3,416 loops=1)

31. 0.003 0.007 ↑ 1.0 7 1

Hash (cost=1.07..1.07 rows=7 width=36) (actual time=0.007..0.007 rows=7 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
32. 0.004 0.004 ↑ 1.0 7 1

Seq Scan on departamento depart (cost=0.00..1.07 rows=7 width=36) (actual time=0.003..0.004 rows=7 loops=1)

33. 0.010 0.020 ↑ 1.0 32 1

Hash (cost=1.32..1.32 rows=32 width=84) (actual time=0.020..0.020 rows=32 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
34. 0.010 0.010 ↑ 1.0 32 1

Seq Scan on lotacao lot (cost=0.00..1.32 rows=32 width=84) (actual time=0.004..0.010 rows=32 loops=1)

35. 0.010 0.019 ↑ 1.0 33 1

Hash (cost=1.33..1.33 rows=33 width=72) (actual time=0.019..0.019 rows=33 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
36. 0.009 0.009 ↑ 1.0 33 1

Seq Scan on tarefa td (cost=0.00..1.33 rows=33 width=72) (actual time=0.004..0.009 rows=33 loops=1)

37. 0.007 0.018 ↑ 1.0 5 1

Hash (cost=1.05..1.05 rows=5 width=36) (actual time=0.018..0.018 rows=5 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
38. 0.011 0.011 ↑ 1.0 5 1

Seq Scan on origem o (cost=0.00..1.05 rows=5 width=36) (actual time=0.010..0.011 rows=5 loops=1)

39. 0.011 0.021 ↑ 1.0 24 1

Hash (cost=1.24..1.24 rows=24 width=80) (actual time=0.021..0.021 rows=24 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 13kB
40. 0.010 0.010 ↑ 1.0 24 1

Seq Scan on projeto ref (cost=0.00..1.24 rows=24 width=80) (actual time=0.005..0.010 rows=24 loops=1)

41. 0.619 1.142 ↑ 1.0 3,379 1

Hash (cost=71.79..71.79 rows=3,379 width=16) (actual time=1.142..1.142 rows=3,379 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 189kB
42. 0.523 0.523 ↑ 1.0 3,379 1

Seq Scan on assessoria ass (cost=0.00..71.79 rows=3,379 width=16) (actual time=0.005..0.523 rows=3,379 loops=1)

43. 0.765 25.225 ↓ 3,390.0 3,390 1

Hash (cost=931.02..931.02 rows=1 width=45) (actual time=25.225..25.225 rows=3,390 loops=1)

  • Buckets: 4096 (originally 1024) Batches: 1 (originally 1) Memory Usage: 205kB
44. 0.453 24.460 ↓ 3,390.0 3,390 1

Subquery Scan on resp (cost=930.97..931.02 rows=1 width=45) (actual time=21.552..24.460 rows=3,390 loops=1)

45. 2.189 24.007 ↓ 3,390.0 3,390 1

GroupAggregate (cost=930.97..931.01 rows=1 width=45) (actual time=21.550..24.007 rows=3,390 loops=1)

  • Group Key: a_2.cd_demanda
46. 1.630 21.818 ↓ 3,427.0 3,427 1

Sort (cost=930.97..930.98 rows=1 width=16) (actual time=21.540..21.818 rows=3,427 loops=1)

  • Sort Key: a_2.cd_demanda
  • Sort Method: quicksort Memory: 364kB
47. 5.150 20.188 ↓ 3,427.0 3,427 1

Nested Loop (cost=502.26..930.96 rows=1 width=16) (actual time=3.791..20.188 rows=3,427 loops=1)

48. 3.423 8.585 ↓ 6,453.0 6,453 1

Hash Join (cost=501.98..930.65 rows=1 width=16) (actual time=3.774..8.585 rows=6,453 loops=1)

  • Hash Cond: ((a_2.cd_demanda = a_3.cd_demanda) AND (a_2.ts_acao = (max(a_3.ts_acao))))
49. 1.418 1.418 ↑ 1.0 10,011 1

Seq Scan on acao a_2 (cost=0.00..376.11 rows=10,011 width=24) (actual time=0.008..1.418 rows=10,011 loops=1)

50. 0.558 3.744 ↓ 1.4 3,390 1

Hash (cost=466.04..466.04 rows=2,396 width=12) (actual time=3.744..3.744 rows=3,390 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 191kB
51. 1.777 3.186 ↓ 1.4 3,390 1

HashAggregate (cost=418.12..442.08 rows=2,396 width=12) (actual time=2.603..3.186 rows=3,390 loops=1)

  • Group Key: a_3.cd_demanda
52. 1.409 1.409 ↑ 1.0 3,396 1

Seq Scan on acao a_3 (cost=0.00..401.14 rows=3,396 width=12) (actual time=0.004..1.409 rows=3,396 loops=1)

  • Filter: (cd_tipoacao = 1)
  • Rows Removed by Filter: 6615
53. 6.453 6.453 ↑ 1.0 1 6,453

Index Only Scan using pk_responsavelacao on responsavelacao ra (cost=0.28..0.31 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=6,453)

  • Index Cond: (cd_acao = a_2.cd_acao)
  • Heap Fetches: 3427
54. 582.899 590.968 ↓ 3,321.0 3,321 3,416

Materialize (cost=514.67..969.62 rows=1 width=500) (actual time=0.001..0.173 rows=3,321 loops=3,416)

55. 2.813 8.069 ↓ 3,321.0 3,321 1

Hash Join (cost=514.67..969.62 rows=1 width=500) (actual time=4.309..8.069 rows=3,321 loops=1)

  • Hash Cond: ((a_1.cd_demanda = foo_1.cd_demanda) AND (a_1.ts_acao = foo_1.ts_acao) AND (a_1.cd_acao = foo_1.cd_acao))
56. 1.010 1.010 ↑ 1.0 10,011 1

Seq Scan on acao a_1 (cost=0.00..376.11 rows=10,011 width=500) (actual time=0.009..1.010 rows=10,011 loops=1)

57. 0.734 4.246 ↓ 1.4 3,321 1

Hash (cost=473.32..473.32 rows=2,363 width=16) (actual time=4.246..4.246 rows=3,321 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 201kB
58. 0.401 3.512 ↓ 1.4 3,321 1

Subquery Scan on foo_1 (cost=426.06..473.32 rows=2,363 width=16) (actual time=2.482..3.512 rows=3,321 loops=1)

59. 1.861 3.111 ↓ 1.4 3,321 1

HashAggregate (cost=426.06..449.69 rows=2,363 width=16) (actual time=2.481..3.111 rows=3,321 loops=1)

  • Group Key: acao.cd_demanda
60. 1.250 1.250 ↑ 1.0 3,323 1

Seq Scan on acao (cost=0.00..401.14 rows=3,323 width=16) (actual time=0.006..1.250 rows=3,323 loops=1)

  • Filter: (cd_tipoacao = 4)
  • Rows Removed by Filter: 6688
61. 570.144 580.720 ↓ 3,398.0 3,398 3,416

Materialize (cost=578.62..1,033.57 rows=1 width=500) (actual time=0.002..0.170 rows=3,398 loops=3,416)

62. 3.093 10.576 ↓ 3,398.0 3,398 1

Hash Join (cost=578.62..1,033.56 rows=1 width=500) (actual time=6.232..10.576 rows=3,398 loops=1)

  • Hash Cond: ((a.cd_demanda = foo.cd_demanda) AND (a.ts_acao = foo.ts_acao) AND (a.cd_acao = foo.cd_acao))
63. 1.282 1.282 ↑ 1.0 10,011 1

Seq Scan on acao a (cost=0.00..376.11 rows=10,011 width=500) (actual time=0.004..1.282 rows=10,011 loops=1)

64. 0.942 6.201 ↑ 1.0 3,398 1

Hash (cost=519.15..519.15 rows=3,398 width=16) (actual time=6.201..6.201 rows=3,398 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 205kB
65. 0.492 5.259 ↑ 1.0 3,398 1

Subquery Scan on foo (cost=451.19..519.15 rows=3,398 width=16) (actual time=3.942..5.259 rows=3,398 loops=1)

66. 3.871 4.767 ↑ 1.0 3,398 1

HashAggregate (cost=451.19..485.17 rows=3,398 width=16) (actual time=3.941..4.767 rows=3,398 loops=1)

  • Group Key: acao_1.cd_demanda
67. 0.896 0.896 ↑ 1.0 10,011 1

Seq Scan on acao acao_1 (cost=0.00..376.11 rows=10,011 width=16) (actual time=0.003..0.896 rows=10,011 loops=1)

68. 0.005 0.014 ↑ 1.0 1 1

Hash (cost=1.20..1.20 rows=1 width=52) (actual time=0.013..0.014 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
69. 0.009 0.009 ↑ 1.0 1 1

Seq Scan on nota (cost=0.00..1.20 rows=1 width=52) (actual time=0.007..0.009 rows=1 loops=1)

  • Filter: (cd_servidor = 142)
  • Rows Removed by Filter: 15
Planning time : 14.373 ms
Execution time : 3,763.428 ms