explain.depesz.com

PostgreSQL's explain analyze made readable

Result: oRO7K

Settings
# exclusive inclusive rows x rows loops node
1. 0.111 3,267.089 ↑ 28.3 145 1

Sort (cost=659,650.56..659,660.81 rows=4,100 width=474) (actual time=3,267.082..3,267.089 rows=145 loops=1)

  • Sort Key: foo.codigo
  • Sort Method: quicksort Memory: 64kB
2. 0.389 3,266.978 ↑ 28.3 145 1

WindowAgg (cost=628,519.86..659,404.53 rows=4,100 width=474) (actual time=2,428.749..3,266.978 rows=145 loops=1)

3. 48.438 3,266.589 ↑ 28.3 145 1

Subquery Scan on foo (cost=628,519.86..659,271.28 rows=4,100 width=442) (actual time=2,417.289..3,266.589 rows=145 loops=1)

  • Filter: (foo.clientes_codigo = 5620)
  • Rows Removed by Filter: 819893
4. 689.536 3,218.151 ↑ 1.0 820,038 1

WindowAgg (cost=628,519.86..649,020.81 rows=820,038 width=442) (actual time=2,346.091..3,218.151 rows=820,038 loops=1)

5. 706.836 2,528.615 ↑ 1.0 820,038 1

Sort (cost=628,519.86..630,569.95 rows=820,038 width=443) (actual time=2,346.079..2,528.615 rows=820,038 loops=1)

  • Sort Key: (COALESCE(pvpg.codprevenda, snfpg.codsaidasnf, cr.codigo)), (CASE WHEN (pvpg.codprevenda IS NOT NULL) THEN 'Pré-venda'::text WHEN (snfpg.codsaidasnf IS NOT NULL) THEN 'Nota de Saída'::text WHEN (cr.codigo IS NOT NULL) THEN 'Conta Avulsa'::text ELSE NULL::text END), cr.datavencimento, cr.codigo
  • Sort Method: external merge Disk: 105920kB
6. 107.524 1,821.779 ↑ 1.0 820,038 1

Gather (cost=86,900.66..217,227.27 rows=820,038 width=443) (actual time=1,212.239..1,821.779 rows=820,038 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
7. 103.591 1,714.255 ↑ 1.2 273,346 3 / 3

Hash Left Join (cost=85,900.66..134,223.47 rows=341,682 width=443) (actual time=1,203.843..1,714.255 rows=273,346 loops=3)

  • Hash Cond: (cr.tipodocumento_codigo = t.codigo)
8. 73.503 1,610.652 ↑ 1.2 273,346 3 / 3

Hash Left Join (cost=85,899.18..133,144.06 rows=341,682 width=329) (actual time=1,203.821..1,610.652 rows=273,346 loops=3)

  • Hash Cond: (cr.gruposcontas_codigo = grct.codigo)
9. 89.185 1,537.144 ↑ 1.2 273,346 3 / 3

Hash Left Join (cost=85,879.28..132,227.25 rows=341,682 width=211) (actual time=1,203.808..1,537.144 rows=273,346 loops=3)

  • Hash Cond: (cr_sit.situacoesconta_codigo = sc.codigo)
10. 71.282 1,447.952 ↑ 1.2 273,346 3 / 3

Hash Left Join (cost=85,859.61..131,301.81 rows=341,682 width=89) (actual time=1,203.796..1,447.952 rows=273,346 loops=3)

  • Hash Cond: (cr.codigo = crav.contasareceber_codigo)
11. 258.762 1,376.651 ↑ 1.2 273,346 3 / 3

Parallel Hash Left Join (cost=85,803.71..130,349.00 rows=341,682 width=81) (actual time=1,203.770..1,376.651 rows=273,346 loops=3)

  • Hash Cond: (cr.codigo = cr_sit.contasareceber_codigo)
12. 60.653 1,052.227 ↑ 1.2 273,346 3 / 3

Hash Left Join (cost=73,151.86..106,789.23 rows=341,682 width=77) (actual time=842.088..1,052.227 rows=273,346 loops=3)

  • Hash Cond: (cr.codigo = snfpg_cr.contasareceber_codigo)
13. 221.486 991.365 ↑ 1.2 273,346 3 / 3

Parallel Hash Left Join (cost=61,811.93..94,158.58 rows=341,682 width=69) (actual time=841.864..991.365 rows=273,346 loops=3)

  • Hash Cond: (cr.codigo = cr_fat.contasareceber_codigo)
14. 205.943 693.823 ↑ 1.2 273,346 3 / 3

Parallel Hash Left Join (cost=48,022.40..70,461.13 rows=341,682 width=57) (actual time=553.662..693.823 rows=273,346 loops=3)

  • Hash Cond: (cr.codigo = pvpg_cr.contasareceber_codigo)
15. 62.359 62.359 ↑ 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.023..62.359 rows=273,346 loops=3)

16. 46.902 425.521 ↑ 1.2 273,332 3 / 3

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

  • Buckets: 131072 Batches: 16 Memory Usage: 3488kB
17. 127.403 378.619 ↑ 1.2 273,332 3 / 3

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

  • Hash Cond: (pvpg.codprevenda = pv.codigo)
18. 127.710 197.696 ↑ 1.2 273,332 3 / 3

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

  • Hash Cond: (pvpg_cr.prevendas_pagtos_codigo = pvpg.codigo)
19. 24.144 24.144 ↑ 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.100..24.144 rows=273,332 loops=3)

20. 26.494 45.842 ↑ 1.3 169,151 3 / 3

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

  • Buckets: 131072 Batches: 8 Memory Usage: 3552kB
21. 19.348 19.348 ↑ 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.048..19.348 rows=169,151 loops=3)

22. 24.995 53.520 ↑ 1.2 161,024 3 / 3

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

  • Buckets: 131072 Batches: 8 Memory Usage: 3456kB
23. 28.525 28.525 ↑ 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.032..28.525 rows=161,024 loops=3)

24. 43.423 76.056 ↑ 1.3 273,334 3 / 3

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

  • Buckets: 131072 Batches: 16 Memory Usage: 3488kB
25. 32.633 32.633 ↑ 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.105..32.633 rows=273,334 loops=3)

26. 0.012 0.209 ↑ 64.6 35 3 / 3

Hash (cost=11,311.68..11,311.68 rows=2,260 width=12) (actual time=0.209..0.209 rows=35 loops=3)

  • Buckets: 4096 Batches: 1 Memory Usage: 34kB
27. 0.018 0.197 ↑ 64.6 35 3 / 3

Nested Loop Left Join (cost=0.84..11,311.68 rows=2,260 width=12) (actual time=0.042..0.197 rows=35 loops=3)

28. 0.019 0.109 ↑ 64.6 35 3 / 3

Nested Loop Left Join (cost=0.42..9,943.00 rows=2,260 width=8) (actual time=0.035..0.109 rows=35 loops=3)

29. 0.020 0.020 ↑ 64.6 35 3 / 3

Seq Scan on saidasnf_pagtos_contasareceber snfpg_cr (cost=0.00..32.60 rows=2,260 width=8) (actual time=0.018..0.020 rows=35 loops=3)

30. 0.070 0.070 ↑ 1.0 1 105 / 3

Index Scan using saidasnf_pagto_pkey on saidasnf_pagto snfpg (cost=0.42..4.39 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=105)

  • Index Cond: (snfpg_cr.saidasnf_pagtos_codigo = codigo)
31. 0.070 0.070 ↑ 1.0 1 105 / 3

Index Scan using saidasnf_codigo_index on saidasnf snf (cost=0.42..0.61 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=105)

  • Index Cond: (snfpg.codsaidasnf = codigo)
32. 44.173 65.662 ↑ 1.2 273,346 3 / 3

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

  • Buckets: 131072 Batches: 16 Memory Usage: 3072kB
33. 21.489 21.489 ↑ 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.007..21.489 rows=273,346 loops=3)

34. 0.002 0.019 ↑ 340.0 6 3 / 3

Hash (cost=30.40..30.40 rows=2,040 width=12) (actual time=0.019..0.019 rows=6 loops=3)

  • Buckets: 2048 Batches: 1 Memory Usage: 17kB
35. 0.017 0.017 ↑ 340.0 6 3 / 3

Seq Scan on contasareceber_avulsas crav (cost=0.00..30.40 rows=2,040 width=12) (actual time=0.016..0.017 rows=6 loops=3)

36. 0.002 0.007 ↑ 71.7 6 3 / 3

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
37. 0.005 0.005 ↑ 71.7 6 3 / 3

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

38. 0.000 0.005 ↓ 0.0 0 3 / 3

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
39. 0.005 0.005 ↓ 0.0 0 3 / 3

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

40. 0.005 0.012 ↓ 1.0 22 3 / 3

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

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
41. 0.007 0.007 ↓ 1.0 22 3 / 3

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

Planning time : 2.719 ms
Execution time : 3,346.859 ms