explain.depesz.com

PostgreSQL's explain analyze made readable

Result: B8mv

Settings
# exclusive inclusive rows x rows loops node
1. 1.992 492.203 ↓ 2.1 602 1

GroupAggregate (cost=54,500.2..54,510.17 rows=285 width=241) (actual time=489.89..492.203 rows=602 loops=1)

  • Group Key: (to_char(inad.data_pedido, 'YYYYMM'::text)), inst.codigo, cur.nome, cur.duracao_meses_titulo
  • Buffers: shared hit=6972, temp read=435 written=434
2.          

CTE inadimplente

3. 19.406 380.825 ↑ 7.4 7,317 1

GroupAggregate (cost=45,294.05..48,614.54 rows=54,049 width=56) (actual time=353.045..380.825 rows=7,317 loops=1)

  • Group Key: p.instituicao, p.codigo
  • Filter: (count(p.codigo) > 1)
  • Buffers: shared hit=6509, temp read=263 written=264
4. 74.075 361.419 ↑ 2.7 65,944 1

Sort (cost=45,294.05..45,734.86 rows=176,325 width=22) (actual time=353.025..361.419 rows=65,944 loops=1)

  • Sort Key: p.instituicao, p.codigo
  • Sort Method: external merge Disk: 2104kB
  • Buffers: shared hit=6509, temp read=263 written=264
5. 31.833 287.344 ↑ 2.7 65,944 1

Hash Join (cost=7,005.29..26,310.2 rows=176,325 width=22) (actual time=114.421..287.344 rows=65,944 loops=1)

  • Buffers: shared hit=6509
6. 141.294 141.294 ↑ 1.2 201,037 1

Seq Scan on parcela par (cost=0..16,671.12 rows=232,143 width=10) (actual time=0.007..141.294 rows=201,037 loops=1)

  • Filter: ((par.data_pagamento IS NULL) AND (par.data_vencimento < now()) AND ((par.status)::text = ANY ('{pago,atrasado,"não concluído",cancelado,"não confirmado",estornado,registrado,"não registrado"}'::text[])))
  • Buffers: shared hit=4525
7. 6.359 114.217 ↑ 1.4 22,257 1

Hash (cost=6,624.4..6,624.4 rows=30,471 width=20) (actual time=114.217..114.217 rows=22,257 loops=1)

  • Buffers: shared hit=1984
8. 15.019 107.858 ↑ 1.4 22,257 1

Hash Join (cost=3,897.19..6,624.4 rows=30,471 width=20) (actual time=52.322..107.858 rows=22,257 loops=1)

  • Buffers: shared hit=1984
9. 24.089 80.649 ↑ 1.0 55,372 1

Hash Join (cost=2,632.56..4,698.46 rows=57,055 width=20) (actual time=39.874..80.649 rows=55,372 loops=1)

  • Buffers: shared hit=1622
10. 17.012 17.012 ↑ 1.0 72,777 1

Seq Scan on pagamento pag (cost=0..1,672.95 rows=74,846 width=12) (actual time=0.008..17.012 rows=72,777 loops=1)

  • Filter: (pag.tipo_pagamento = 1)
  • Buffers: shared hit=734
11. 20.210 39.548 ↑ 1.0 55,372 1

Hash (cost=1,799.11..1,799.11 rows=55,563 width=16) (actual time=39.547..39.548 rows=55,372 loops=1)

  • Buffers: shared hit=888
12. 19.338 19.338 ↑ 1.0 55,372 1

Seq Scan on pedido p (cost=0..1,799.11 rows=55,563 width=16) (actual time=0.008..19.338 rows=55,372 loops=1)

  • Filter: ((p.status)::text = 'wc-completed'::text)
  • Buffers: shared hit=888
13. 6.753 12.190 ↑ 1.0 40,114 1

Hash (cost=763.17..763.17 rows=40,117 width=8) (actual time=12.19..12.19 rows=40,114 loops=1)

  • Buffers: shared hit=362
14. 5.437 5.437 ↑ 1.0 40,114 1

Seq Scan on forma_pagamento forpag (cost=0..763.17 rows=40,117 width=8) (actual time=0.004..5.437 rows=40,114 loops=1)

  • Buffers: shared hit=362
15. 19.276 490.211 ↓ 24.9 7,104 1

Sort (cost=5,885.66..5,886.37 rows=285 width=245) (actual time=489.864..490.211 rows=7,104 loops=1)

  • Sort Key: (to_char(inad.data_pedido, 'YYYYMM'::text)), inst.codigo, cur.nome, cur.duracao_meses_titulo
  • Sort Method: quicksort Memory: 1309kB
  • Buffers: shared hit=6972, temp read=435 written=434
16. 4.725 470.935 ↓ 24.9 7,104 1

Hash Join (cost=2,553.14..5,874.04 rows=285 width=245) (actual time=424.497..470.935 rows=7,104 loops=1)

  • Buffers: shared hit=6972, temp read=435 written=434
17. 2.069 465.959 ↓ 24.9 7,104 1

Hash Join (cost=2,519.19..5,837.88 rows=285 width=178) (actual time=424.227..465.959 rows=7,104 loops=1)

  • Buffers: shared hit=6952, temp read=435 written=434
18. 1.631 463.739 ↓ 24.9 7,104 1

Hash Join (cost=2,499.55..5,816 rows=285 width=178) (actual time=424.065..463.739 rows=7,104 loops=1)

  • Buffers: shared hit=6946, temp read=435 written=434
19. 7.809 462.104 ↓ 24.9 7,104 1

Hash Join (cost=2,477.62..5,793.31 rows=285 width=56) (actual time=424.055..462.104 rows=7,104 loops=1)

  • Buffers: shared hit=6945, temp read=435 written=434
20. 383.812 383.812 ↑ 7.4 7,317 1

CTE Scan on inadimplente inad (cost=0..1,080.98 rows=54,049 width=48) (actual time=353.048..383.812 rows=7,317 loops=1)

  • Buffers: shared hit=6509, temp read=263 written=264
21. 54.209 70.483 ↓ 1.0 68,372 1

Hash (cost=1,119.05..1,119.05 rows=68,305 width=16) (actual time=70.483..70.483 rows=68,372 loops=1)

  • Buffers: shared hit=436, temp written=149
22. 16.274 16.274 ↓ 1.0 68,372 1

Seq Scan on pedido_oferta pedofer (cost=0..1,119.05 rows=68,305 width=16) (actual time=0.009..16.274 rows=68,372 loops=1)

  • Buffers: shared hit=436
23. 0.002 0.004 ↑ 265.0 2 1

Hash (cost=15.3..15.3 rows=530 width=122) (actual time=0.004..0.004 rows=2 loops=1)

  • Buffers: shared hit=1
24. 0.002 0.002 ↑ 265.0 2 1

Seq Scan on instituicao inst (cost=0..15.3 rows=530 width=122) (actual time=0.002..0.002 rows=2 loops=1)

  • Buffers: shared hit=1
25. 0.088 0.151 ↓ 1.1 522 1

Hash (cost=10.96..10.96 rows=496 width=16) (actual time=0.151..0.151 rows=522 loops=1)

  • Buffers: shared hit=6
26. 0.063 0.063 ↓ 1.1 522 1

Seq Scan on oferta ofert (cost=0..10.96 rows=496 width=16) (actual time=0.004..0.063 rows=522 loops=1)

  • Buffers: shared hit=6
27. 0.121 0.251 ↑ 1.0 558 1

Hash (cost=25.58..25.58 rows=558 width=59) (actual time=0.251..0.251 rows=558 loops=1)

  • Buffers: shared hit=20
28. 0.130 0.130 ↑ 1.0 558 1

Seq Scan on curso cur (cost=0..25.58 rows=558 width=59) (actual time=0.006..0.13 rows=558 loops=1)

  • Buffers: shared hit=20
Planning time : 2.313 ms
Execution time : 493.765 ms