explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ltTG

Settings
# exclusive inclusive rows x rows loops node
1. 0.052 2,942.228 ↓ 2.4 145 1

Sort (cost=626,870.46..626,870.61 rows=60 width=474) (actual time=2,942.224..2,942.228 rows=145 loops=1)

  • Sort Key: foo.codigo
  • Sort Method: quicksort Memory: 64kB
2. 0.111 2,942.176 ↓ 2.4 145 1

WindowAgg (cost=626,866.58..626,868.68 rows=60 width=474) (actual time=2,942.069..2,942.176 rows=145 loops=1)

3. 0.085 2,942.065 ↓ 2.4 145 1

Sort (cost=626,866.58..626,866.73 rows=60 width=442) (actual time=2,942.060..2,942.065 rows=145 loops=1)

  • Sort Key: foo.entidade_codigo, foo.entidade
  • Sort Method: quicksort Memory: 64kB
4. 46.292 2,941.980 ↓ 2.4 145 1

Subquery Scan on foo (cost=596,113.39..626,864.81 rows=60 width=442) (actual time=2,190.460..2,941.980 rows=145 loops=1)

  • Filter: (foo.clientes_codigo = 5,620)
  • Rows Removed by Filter: 819,893
5. 621.714 2,895.688 ↑ 1.0 820,038 1

WindowAgg (cost=596,113.39..616,614.34 rows=820,038 width=442) (actual time=2,125.146..2,895.688 rows=820,038 loops=1)

6. 594.579 2,273.974 ↑ 1.0 820,038 1

Sort (cost=596,113.39..598,163.48 rows=820,038 width=423) (actual time=2,125.135..2,273.974 rows=820,038 loops=1)

  • Sort Key: pvpg.codprevenda, cr.datavencimento, cr.codigo
  • Sort Method: external merge Disk: 101,856kB
7. 116.430 1,679.395 ↑ 1.0 820,038 1

Gather (cost=75,504.83..201,641.80 rows=820,038 width=423) (actual time=1,160.406..1,679.395 rows=820,038 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
8. 91.640 1,562.965 ↑ 1.2 273,346 3 / 3

Hash Left Join (cost=74,504.83..118,638.00 rows=341,682 width=423) (actual time=1,148.043..1,562.965 rows=273,346 loops=3)

  • Hash Cond: (cr.tipodocumento_codigo = t.codigo)
9. 68.295 1,471.315 ↑ 1.2 273,346 3 / 3

Hash Left Join (cost=74,503.36..117,558.59 rows=341,682 width=313) (actual time=1,148.025..1,471.315 rows=273,346 loops=3)

  • Hash Cond: (cr.gruposcontas_codigo = grct.codigo)
10. 85.903 1,403.011 ↑ 1.2 273,346 3 / 3

Hash Left Join (cost=74,483.46..116,641.78 rows=341,682 width=195) (actual time=1,148.013..1,403.011 rows=273,346 loops=3)

  • Hash Cond: (cr_sit.situacoesconta_codigo = sc.codigo)
11. 241.998 1,317.088 ↑ 1.2 273,346 3 / 3

Parallel Hash Left Join (cost=74,463.78..115,716.34 rows=341,682 width=73) (actual time=1,147.979..1,317.088 rows=273,346 loops=3)

  • Hash Cond: (cr.codigo = cr_fat.contasareceber_codigo)
12. 210.857 951.113 ↑ 1.2 273,346 3 / 3

Parallel Hash Left Join (cost=60,674.25..92,018.90 rows=341,682 width=61) (actual time=803.080..951.113 rows=273,346 loops=3)

  • Hash Cond: (cr.codigo = pvpg_cr.contasareceber_codigo)
13. 187.574 307.187 ↑ 1.2 273,346 3 / 3

Parallel Hash Left Join (cost=12,651.85..32,948.59 rows=341,682 width=49) (actual time=184.835..307.187 rows=273,346 loops=3)

  • Hash Cond: (cr.codigo = cr_sit.contasareceber_codigo)
14. 60.088 60.088 ↑ 1.2 273,346 3 / 3

Parallel Seq Scan on contasareceber cr (cost=0.00..12,056.83 rows=341,682 width=45) (actual time=0.034..60.088 rows=273,346 loops=3)

15. 38.361 59.525 ↑ 1.2 273,346 3 / 3

Parallel Hash (cost=7,045.83..7,045.83 rows=341,682 width=8) (actual time=59.525..59.525 rows=273,346 loops=3)

  • Buckets: 131,072 Batches: 16 Memory Usage: 3,072kB
16. 21.164 21.164 ↑ 1.2 273,346 3 / 3

Parallel Seq Scan on contasareceber_situacao cr_sit (cost=0.00..7,045.83 rows=341,682 width=8) (actual time=0.009..21.164 rows=273,346 loops=3)

17. 47.104 433.069 ↑ 1.2 273,332 3 / 3

Parallel Hash (cost=42,082.59..42,082.59 rows=341,665 width=16) (actual time=433.069..433.069 rows=273,332 loops=3)

  • Buckets: 131,072 Batches: 16 Memory Usage: 3,488kB
18. 137.605 385.965 ↑ 1.2 273,332 3 / 3

Parallel Hash Left Join (cost=25,622.17..42,082.59 rows=341,665 width=16) (actual time=298.720..385.965 rows=273,332 loops=3)

  • Hash Cond: (pvpg.codprevenda = pv.codigo)
19. 129.886 195.931 ↑ 1.2 273,332 3 / 3

Parallel Hash Left Join (cost=8,822.38..20,260.91 rows=341,665 width=12) (actual time=105.661..195.931 rows=273,332 loops=3)

  • Hash Cond: (pvpg_cr.prevendas_pagtos_codigo = pvpg.codigo)
20. 20.067 20.067 ↑ 1.2 273,332 3 / 3

Parallel Seq Scan on prevendas_pagtos_contasareceber pvpg_cr (cost=0.00..7,045.65 rows=341,665 width=8) (actual time=0.008..20.067 rows=273,332 loops=3)

21. 26.908 45.978 ↑ 1.3 169,151 3 / 3

Parallel Hash (cost=5,353.39..5,353.39 rows=211,439 width=8) (actual time=45.978..45.978 rows=169,151 loops=3)

  • Buckets: 131,072 Batches: 8 Memory Usage: 3,584kB
22. 19.070 19.070 ↑ 1.3 169,151 3 / 3

Parallel Seq Scan on prevenda_pagto pvpg (cost=0.00..5,353.39 rows=211,439 width=8) (actual time=0.010..19.070 rows=169,151 loops=3)

23. 24.932 52.429 ↑ 1.2 161,024 3 / 3

Parallel Hash (cost=13,496.80..13,496.80 rows=201,280 width=8) (actual time=52.429..52.429 rows=161,024 loops=3)

  • Buckets: 131,072 Batches: 8 Memory Usage: 3,424kB
24. 27.497 27.497 ↑ 1.2 161,024 3 / 3

Parallel Seq Scan on prevendas pv (cost=0.00..13,496.80 rows=201,280 width=8) (actual time=0.035..27.497 rows=161,024 loops=3)

25. 81.488 123.977 ↑ 1.3 273,334 3 / 3

Parallel Hash (cost=7,849.68..7,849.68 rows=341,668 width=12) (actual time=123.977..123.977 rows=273,334 loops=3)

  • Buckets: 131,072 Batches: 16 Memory Usage: 3,488kB
26. 42.489 42.489 ↑ 1.3 273,334 3 / 3

Parallel Seq Scan on contasareceber_faturamentos cr_fat (cost=0.00..7,849.68 rows=341,668 width=12) (actual time=0.056..42.489 rows=273,334 loops=3)

27. 0.009 0.020 ↑ 71.7 6 3 / 3

Hash (cost=14.30..14.30 rows=430 width=126) (actual time=0.020..0.020 rows=6 loops=3)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
28. 0.011 0.011 ↑ 71.7 6 3 / 3

Seq Scan on situacoescontas sc (cost=0.00..14.30 rows=430 width=126) (actual time=0.010..0.011 rows=6 loops=3)

29. 0.000 0.009 ↓ 0.0 0 3 / 3

Hash (cost=14.40..14.40 rows=440 width=122) (actual time=0.009..0.009 rows=0 loops=3)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
30. 0.009 0.009 ↓ 0.0 0 3 / 3

Seq Scan on gruposcontas grct (cost=0.00..14.40 rows=440 width=122) (actual time=0.009..0.009 rows=0 loops=3)

31. 0.004 0.010 ↓ 1.0 22 3 / 3

Hash (cost=1.21..1.21 rows=21 width=82) (actual time=0.010..0.010 rows=22 loops=3)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
32. 0.006 0.006 ↓ 1.0 22 3 / 3

Seq Scan on tipodocumento t (cost=0.00..1.21 rows=21 width=82) (actual time=0.004..0.006 rows=22 loops=3)

Planning time : 1.609 ms
Execution time : 3,020.127 ms