explain.depesz.com

PostgreSQL's explain analyze made readable

Result: qtAl : Inadimplência - Parcelas Pagos x Parcelas Não Pagos - Detalhamento

Settings
# exclusive inclusive rows x rows loops node
1. 71.420 16,403.178 ↑ 15.0 20,426 1

Sort (cost=274,493.76..275,260.4 rows=306,658 width=290) (actual time=16,396.503..16,403.178 rows=20,426 loops=1)

  • Sort Key: (count(parc.codigo)) DESC
  • Sort Method: external merge Disk: 3136kB
  • Buffers: shared hit=1353071, temp read=12331 written=12335
2. 528.939 16,331.758 ↑ 15.0 20,426 1

GroupAggregate (cost=148,128.34..162,694.6 rows=306,658 width=290) (actual time=15,153.705..16,331.758 rows=20,426 loops=1)

  • Group Key: inst.nome, (to_char(ped.data_pedido, 'YYYY-MM'::text)), ped.codigo, usu.nome, usu.telefone, usu.numero_cpf, curs.nome, curs.duracao_meses_titulo
  • Buffers: shared hit=1353068, temp read=11939 written=11943
3. 3,505.554 15,802.819 ↑ 1.2 251,050 1

Sort (cost=148,128.34..148,894.99 rows=306,658 width=276) (actual time=15,153.677..15,802.819 rows=251,050 loops=1)

  • Sort Key: inst.nome, (to_char(ped.data_pedido, 'YYYY-MM'::text)), ped.codigo, usu.nome, usu.telefone, usu.numero_cpf, curs.nome, curs.duracao_meses_titulo
  • Sort Method: external merge Disk: 42736kB
  • Buffers: shared hit=1353068, temp read=11939 written=11943
4. 2,496.862 12,297.265 ↑ 1.2 251,050 1

Hash Join (cost=9,571.47..40,522.19 rows=306,658 width=276) (actual time=1,617.454..12,297.265 rows=251,050 loops=1)

  • Buffers: shared hit=1353068, temp read=5047 written=5033
5. 1,600.551 9,699.791 ↑ 1.2 251,050 1

Nested Loop (cost=7,055.77..15,406.89 rows=306,658 width=235) (actual time=1,516.345..9,699.791 rows=251,050 loops=1)

  • Buffers: shared hit=1352178, temp read=2232 written=2220
6. 1,231.211 4,975.378 ↓ 572.1 446,266 1

Hash Join (cost=7,055.48..15,090.29 rows=780 width=223) (actual time=1,516.273..4,975.378 rows=446,266 loops=1)

  • Buffers: shared hit=9407, temp read=2232 written=2220
7. 1,146.939 3,743.655 ↓ 572.1 446,266 1

Hash Join (cost=7,018.53..15,049.25 rows=780 width=172) (actual time=1,515.738..3,743.655 rows=446,266 loops=1)

  • Buffers: shared hit=9384, temp read=2232 written=2220
8. 0.000 2,596.352 ↓ 572.1 446,266 1

Gather (cost=6,997.49..15,022.06 rows=780 width=172) (actual time=1,515.357..2,596.352 rows=446,266 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
  • Buffers: shared hit=9378, temp read=2232 written=2220
9. 474.912 2,945.352 ↓ 457.7 148,755 3 / 3

Hash Join (cost=5,997.49..13,944.06 rows=325 width=172) (actual time=2,022.116..2,945.352 rows=148,755 loops=3)

  • Buffers: shared hit=9378, temp read=2232 written=2220
10. 448.401 448.401 ↑ 1.2 151,148 3 / 3

Seq Scan on parcela parc (cost=0..7,240.18 rows=187,506 width=30) (actual time=0.005..448.401 rows=151,148 loops=3)

  • Filter: ((parc.status)::text <> 'renegociado'::text)
  • Buffers: shared hit=4731
11. 118.945 2,022.039 ↓ 499.2 34,941 3 / 3

Hash (cost=5,996.61..5,996.61 rows=70 width=150) (actual time=2,022.039..2,022.039 rows=34,941 loops=3)

  • Buffers: shared hit=4551, temp read=2232 written=2220
12. 276.096 1,903.094 ↓ 499.2 34,941 3 / 3

Hash Join (cost=5,077.33..5,996.61 rows=70 width=150) (actual time=1,483.927..1,903.094 rows=34,941 loops=3)

  • Buffers: shared hit=4551, temp read=2232 written=2220
13. 143.326 143.326 ↑ 1.0 40,169 3 / 3

Seq Scan on forma_pagamento forpag (cost=0..767.06 rows=40,406 width=8) (actual time=0.01..143.326 rows=40,169 loops=3)

  • Buffers: shared hit=1089
14. 238.489 1,483.672 ↓ 504.2 65,542 3 / 3

Hash (cost=5,075.71..5,075.71 rows=130 width=150) (actual time=1,483.671..1,483.672 rows=65,542 loops=3)

  • Buffers: shared hit=3462, temp read=1026 written=1740
15. 499.238 1,245.183 ↓ 504.2 65,542 3 / 3

Hash Join (cost=2,076.5..5,075.71 rows=130 width=150) (actual time=339.585..1,245.183 rows=65,542 loops=3)

  • Buffers: shared hit=3462, temp read=1026 written=1020
16. 286.739 406.587 ↑ 1.0 72,836 3 / 3

Hash Join (cost=21.93..1,895.42 rows=74,961 width=134) (actual time=0.029..406.587 rows=72,836 loops=3)

  • Buffers: shared hit=2208
17. 119.835 119.835 ↑ 1.0 72,836 3 / 3

Seq Scan on pagamento pag (cost=0..1,675.15 rows=74,961 width=12) (actual time=0.007..119.835 rows=72,836 loops=3)

  • Filter: (pag.tipo_pagamento = 1)
  • Buffers: shared hit=2205
18. 0.005 0.013 ↑ 265.0 2 3 / 3

Hash (cost=15.3..15.3 rows=530 width=122) (actual time=0.012..0.013 rows=2 loops=3)

  • Buffers: shared hit=3
19. 0.008 0.008 ↑ 265.0 2 3 / 3

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

  • Buffers: shared hit=3
20. 159.618 339.358 ↓ 1.0 65,542 3 / 3

Hash (cost=1,072.63..1,072.63 rows=65,463 width=16) (actual time=339.358..339.358 rows=65,542 loops=3)

  • Buffers: shared hit=1254, temp written=429
21. 179.740 179.740 ↓ 1.0 65,542 3 / 3

Seq Scan on pedido_oferta pof (cost=0..1,072.63 rows=65,463 width=16) (actual time=0.011..179.74 rows=65,542 loops=3)

  • Buffers: shared hit=1254
22. 0.194 0.364 ↑ 1.1 507 1

Hash (cost=11.47..11.47 rows=547 width=16) (actual time=0.364..0.364 rows=507 loops=1)

  • Buffers: shared hit=6
23. 0.170 0.170 ↑ 1.1 507 1

Seq Scan on oferta ofe (cost=0..11.47 rows=547 width=16) (actual time=0.006..0.17 rows=507 loops=1)

  • Buffers: shared hit=6
24. 0.256 0.512 ↑ 1.0 558 1

Hash (cost=28.58..28.58 rows=558 width=59) (actual time=0.512..0.512 rows=558 loops=1)

  • Buffers: shared hit=23
25. 0.256 0.256 ↑ 1.0 558 1

Seq Scan on curso curs (cost=0..28.58 rows=558 width=59) (actual time=0.019..0.256 rows=558 loops=1)

  • Buffers: shared hit=23
26. 3,123.862 3,123.862 ↑ 1.0 1 446,266

Index Scan using pk_pedido on pedido ped (cost=0.29..0.39 rows=1 width=20) (actual time=0.007..0.007 rows=1 loops=446,266)

  • Index Cond: ((ped.codigo = pag.codigo_pedido) AND (ped.instituicao = pag.instituicao))
  • Filter: ((ped.status)::text = 'wc-completed'::text)
  • Buffers: shared hit=1342771
27. 63.052 100.612 ↑ 1.0 45,886 1

Hash (cost=1,357.48..1,357.48 rows=46,748 width=53) (actual time=100.612..100.612 rows=45,886 loops=1)

  • Buffers: shared hit=890, temp written=213
28. 37.560 37.560 ↑ 1.0 45,886 1

Seq Scan on usuario usu (cost=0..1,357.48 rows=46,748 width=53) (actual time=0.009..37.56 rows=45,886 loops=1)

  • Buffers: shared hit=890
Planning time : 24.028 ms
Execution time : 16,423.283 ms