explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 2NhL

Settings
# exclusive inclusive rows x rows loops node
1. 45.054 3,344.188 ↑ 1.0 1 1

Subquery Scan on foo (cost=628,519.86..659,271.28 rows=1 width=442) (actual time=2,516.590..3,344.188 rows=1 loops=1)

  • Filter: (foo.codigo = 64467)
  • Rows Removed by Filter: 820037
2. 672.372 3,299.134 ↑ 1.0 820,038 1

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

3. 667.344 2,626.762 ↑ 1.0 820,038 1

Sort (cost=628,519.86..630,569.95 rows=820,038 width=443) (actual time=2,448.331..2,626.762 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: 105912kB
4. 130.825 1,959.418 ↑ 1.0 820,038 1

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

  • Workers Planned: 2
  • Workers Launched: 2
5. 109.550 1,828.593 ↑ 1.2 273,346 3 / 3

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

  • Hash Cond: (cr.tipodocumento_codigo = t.codigo)
6. 75.487 1,719.031 ↑ 1.2 273,346 3 / 3

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

  • Hash Cond: (cr.gruposcontas_codigo = grct.codigo)
7. 94.181 1,643.540 ↑ 1.2 273,346 3 / 3

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

  • Hash Cond: (cr_sit.situacoesconta_codigo = sc.codigo)
8. 75.107 1,549.347 ↑ 1.2 273,346 3 / 3

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

  • Hash Cond: (cr.codigo = crav.contasareceber_codigo)
9. 262.715 1,474.220 ↑ 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,301.080..1,474.220 rows=273,346 loops=3)

  • Hash Cond: (cr.codigo = cr_sit.contasareceber_codigo)
10. 62.507 1,131.304 ↑ 1.2 273,346 3 / 3

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

  • Hash Cond: (cr.codigo = snfpg_cr.contasareceber_codigo)
11. 227.866 1,068.606 ↑ 1.2 273,346 3 / 3

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

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

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

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

14. 49.975 458.106 ↑ 1.2 273,332 3 / 3

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

  • Buckets: 131072 Batches: 16 Memory Usage: 3456kB
15. 136.555 408.131 ↑ 1.2 273,332 3 / 3

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

  • Hash Cond: (pvpg.codprevenda = pv.codigo)
16. 130.893 217.251 ↑ 1.2 273,332 3 / 3

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

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

18. 37.595 58.936 ↑ 1.3 169,151 3 / 3

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

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

20. 25.139 54.325 ↑ 1.2 161,024 3 / 3

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

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

22. 47.946 84.929 ↑ 1.3 273,334 3 / 3

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

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

24. 0.007 0.191 ↑ 64.6 35 3 / 3

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

  • Buckets: 4096 Batches: 1 Memory Usage: 34kB
25. 0.007 0.184 ↑ 64.6 35 3 / 3

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

26. 0.009 0.107 ↑ 64.6 35 3 / 3

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

27. 0.028 0.028 ↑ 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.020..0.028 rows=35 loops=3)

28. 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)
29. 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)
30. 54.265 80.201 ↑ 1.2 273,346 3 / 3

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

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

32. 0.003 0.020 ↑ 340.0 6 3 / 3

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

  • Buckets: 2048 Batches: 1 Memory Usage: 17kB
33. 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.015..0.017 rows=6 loops=3)

34. 0.003 0.012 ↑ 71.7 6 3 / 3

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

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

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

36. 0.001 0.004 ↓ 0.0 0 3 / 3

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

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

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

38. 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
39. 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.358 ms
Execution time : 3,425.869 ms