explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Radx

Settings
# exclusive inclusive rows x rows loops node
1. 726.438 374,627.361 ↓ 2.0 258,100 1

Sort (cost=9,038,357.66..9,038,687.28 rows=131,848 width=592) (actual time=374,609.704..374,627.361 rows=258,100 loops=1)

  • Sort Key: ven.ven_dt_fiscal, ven.ven_tm_venda
  • Sort Method: quicksort Memory: 90,974kB
2. 2,503.571 373,900.923 ↓ 2.0 258,100 1

Group (cost=5,524,034.90..9,027,144.96 rows=131,848 width=592) (actual time=307,850.582..373,900.923 rows=258,100 loops=1)

  • Group Key: ven.ven_cd_venda, cli.cli_ds_fantasia, cai.cai_dt_movimento, tur.tur_ds_turno, fun.fun_ds_funcionario, ecf.ecf_ds_ordem, ecf.ecf_ds_serie, pdv.pdv_ds_referencia, (array_to_string(array_agg(pra.pra_ds_prazo), ';'::text)), nts.nts_ds_numero_nota, nts.nts_ds_serie, nfc.nfc_cd_serie
3. 542.932 307,904.752 ↓ 2.0 258,100 1

Sort (cost=5,524,034.90..5,524,364.52 rows=131,848 width=221) (actual time=307,848.903..307,904.752 rows=258,100 loops=1)

  • Sort Key: ven.ven_cd_venda, cli.cli_ds_fantasia, cai.cai_dt_movimento, tur.tur_ds_turno, fun.fun_ds_funcionario, ecf.ecf_ds_ordem, ecf.ecf_ds_serie, pdv.pdv_ds_referencia, (array_to_string(array_agg(pra.pra_ds_prazo), ';'::text)), nts.nts_ds_numero_nota, nts.nts_ds_serie, nfc.nfc_cd_serie
  • Sort Method: quicksort Memory: 74,880kB
4. 351.613 307,361.820 ↓ 2.0 258,100 1

Nested Loop (cost=73,845.33..5,512,822.20 rows=131,848 width=221) (actual time=1,639.286..307,361.820 rows=258,100 loops=1)

5. 0.000 1,936.007 ↓ 2.0 258,100 1

Gather (cost=73,811.25..1,015,164.77 rows=131,848 width=189) (actual time=1,635.315..1,936.007 rows=258,100 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
6. 228.236 123,559.707 ↓ 1.6 86,033 3 / 3

Nested Loop Left Join (cost=72,811.25..1,000,979.97 rows=54,937 width=189) (actual time=1,615.093..123,559.707 rows=86,033 loops=3)

7. 84.833 6,068.038 ↓ 1.6 86,033 3 / 3

Parallel Hash Left Join (cost=72,810.68..562,655.03 rows=54,937 width=185) (actual time=1,611.700..6,068.038 rows=86,033 loops=3)

  • Hash Cond: (ven.ven_cd_nota_saida = nts.nts_cd_nota_saida)
8. 57.552 5,327.344 ↓ 1.6 86,033 3 / 3

Hash Join (cost=44,529.04..534,229.18 rows=54,937 width=171) (actual time=949.924..5,327.344 rows=86,033 loops=3)

  • Hash Cond: (cai.cai_cd_pdv = pdv.pdv_cd_pdv)
9. 56.688 5,268.844 ↓ 1.6 86,033 3 / 3

Hash Join (cost=44,262.08..533,817.50 rows=54,937 width=172) (actual time=948.942..5,268.844 rows=86,033 loops=3)

  • Hash Cond: (ven.ven_cd_funcionario = fun.fun_cd_funcionario)
10. 57.170 5,194.581 ↓ 1.6 86,033 3 / 3

Hash Join (cost=43,515.14..532,926.29 rows=54,937 width=154) (actual time=931.283..5,194.581 rows=86,033 loops=3)

  • Hash Cond: (ven.ven_cd_ecf = ecf.ecf_cd_ecf)
11. 57.251 5,132.722 ↓ 1.6 86,033 3 / 3

Hash Join (cost=43,473.70..532,740.08 rows=54,937 width=139) (actual time=926.565..5,132.722 rows=86,033 loops=3)

  • Hash Cond: (cai.cai_cd_turno = tur.tur_cd_turno)
12. 81.042 5,075.444 ↓ 1.6 86,033 3 / 3

Parallel Hash Join (cost=43,471.89..532,577.09 rows=54,937 width=133) (actual time=926.511..5,075.444 rows=86,033 loops=3)

  • Hash Cond: (ven.ven_cd_caixa = cai.cai_cd_caixa)
13. 104.132 4,728.561 ↓ 1.6 86,033 3 / 3

Parallel Hash Join (cost=18,470.94..507,431.92 rows=54,937 width=121) (actual time=658.324..4,728.561 rows=86,033 loops=3)

  • Hash Cond: (ven.ven_cd_cliente = cli.cli_cd_cliente)
14. 4,331.203 4,477.552 ↓ 1.6 86,033 3 / 3

Parallel Bitmap Heap Scan on venda ven (cost=5,931.25..494,748.02 rows=54,937 width=96) (actual time=509.485..4,477.552 rows=86,033 loops=3)

  • Recheck Cond: ((ven_cd_unidade_negocio = 814) AND (ven_fl_cancelada = 'N'::bpchar) AND (ven_dt_fiscal >= '2018-01-01'::date) AND (ven_dt_fiscal <= '2020-06-25'::date))
  • Heap Blocks: exact=948
15. 146.349 146.349 ↓ 2.8 367,436 1 / 3

Bitmap Index Scan on venda_ven_cd_unidade_negocio_ven_fl_cancelada_ven_dt_fiscal_ven (cost=0.00..5,898.28 rows=131,848 width=0) (actual time=439.048..439.048 rows=367,436 loops=1)

  • Index Cond: ((ven_cd_unidade_negocio = 814) AND (ven_fl_cancelada = 'N'::bpchar) AND (ven_dt_fiscal >= '2018-01-01'::date) AND (ven_dt_fiscal <= '2020-06-25'::date))
16. 78.234 146.877 ↑ 1.2 62,358 3 / 3

Parallel Hash (cost=11,565.42..11,565.42 rows=77,942 width=29) (actual time=146.877..146.877 rows=62,358 loops=3)

  • Buckets: 262,144 Batches: 1 Memory Usage: 14,016kB
17. 68.643 68.643 ↑ 1.2 62,358 3 / 3

Parallel Seq Scan on cliente cli (cost=0.00..11,565.42 rows=77,942 width=29) (actual time=0.006..68.643 rows=62,358 loops=3)

18. 142.964 265.841 ↑ 1.2 208,017 3 / 3

Parallel Hash (cost=21,755.98..21,755.98 rows=259,598 width=16) (actual time=265.841..265.841 rows=208,017 loops=3)

  • Buckets: 1,048,576 Batches: 1 Memory Usage: 37,536kB
19. 122.877 122.877 ↑ 1.2 208,017 3 / 3

Parallel Seq Scan on caixa cai (cost=0.00..21,755.98 rows=259,598 width=16) (actual time=0.006..122.877 rows=208,017 loops=3)

20. 0.012 0.027 ↑ 1.0 36 3 / 3

Hash (cost=1.36..1.36 rows=36 width=14) (actual time=0.026..0.027 rows=36 loops=3)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
21. 0.015 0.015 ↑ 1.0 36 3 / 3

Seq Scan on turno tur (cost=0.00..1.36 rows=36 width=14) (actual time=0.009..0.015 rows=36 loops=3)

22. 0.846 4.689 ↓ 1.0 1,104 3 / 3

Hash (cost=27.86..27.86 rows=1,086 width=19) (actual time=4.689..4.689 rows=1,104 loops=3)

  • Buckets: 2,048 Batches: 1 Memory Usage: 75kB
23. 3.843 3.843 ↓ 1.0 1,104 3 / 3

Seq Scan on ecf (cost=0.00..27.86 rows=1,086 width=19) (actual time=0.011..3.843 rows=1,104 loops=3)

24. 5.726 17.575 ↓ 1.0 10,754 3 / 3

Hash (cost=612.53..612.53 rows=10,753 width=22) (actual time=17.575..17.575 rows=10,754 loops=3)

  • Buckets: 16,384 Batches: 1 Memory Usage: 721kB
25. 11.849 11.849 ↓ 1.0 10,754 3 / 3

Seq Scan on funcionario fun (cost=0.00..612.53 rows=10,753 width=22) (actual time=0.009..11.849 rows=10,754 loops=3)

26. 0.289 0.948 ↑ 1.0 1,198 3 / 3

Hash (cost=251.98..251.98 rows=1,198 width=7) (actual time=0.948..0.948 rows=1,198 loops=3)

  • Buckets: 2,048 Batches: 1 Memory Usage: 63kB
27. 0.659 0.659 ↑ 1.0 1,198 3 / 3

Seq Scan on pdv (cost=0.00..251.98 rows=1,198 width=7) (actual time=0.016..0.659 rows=1,198 loops=3)

28. 160.449 655.861 ↑ 1.2 157,170 3 / 3

Parallel Hash (cost=25,844.62..25,844.62 rows=194,962 width=18) (actual time=655.861..655.861 rows=157,170 loops=3)

  • Buckets: 524,288 Batches: 1 Memory Usage: 29,984kB
29. 495.412 495.412 ↑ 1.2 157,170 3 / 3

Parallel Seq Scan on nota_saida nts (cost=0.00..25,844.62 rows=194,962 width=18) (actual time=0.522..495.412 rows=157,170 loops=3)

30. 117,263.433 117,263.433 ↑ 1.0 1 258,100 / 3

Index Scan using nfce_nfc_cd_venda_key on nfce nfc (cost=0.56..7.98 rows=1 width=8) (actual time=1.363..1.363 rows=1 loops=258,100)

  • Index Cond: (nfc_cd_venda = ven.ven_cd_venda)
31. 774.300 305,074.200 ↑ 1.0 1 258,100

Aggregate (cost=34.08..34.09 rows=1 width=32) (actual time=1.182..1.182 rows=1 loops=258,100)

32. 583.514 304,299.900 ↑ 3.0 1 258,100

Nested Loop (cost=9.41..34.07 rows=3 width=12) (actual time=1.178..1.179 rows=1 loops=258,100)

33. 774.300 303,009.400 ↑ 3.0 1 258,100

HashAggregate (cost=9.13..9.16 rows=3 width=4) (actual time=1.173..1.174 rows=1 loops=258,100)

  • Group Key: venda_prazo.vep_cd_prazo
34. 302,235.100 302,235.100 ↑ 3.0 1 258,100

Index Scan using venda_prazo_idx_venda on venda_prazo (cost=0.57..9.13 rows=3 width=4) (actual time=1.166..1.171 rows=1 loops=258,100)

  • Index Cond: (ven.ven_cd_venda = vep_cd_venda)
35. 706.986 706.986 ↑ 1.0 1 235,662

Index Scan using prazo_pkey on prazo pra (cost=0.28..8.30 rows=1 width=16) (actual time=0.003..0.003 rows=1 loops=235,662)

  • Index Cond: (pra_cd_prazo = venda_prazo.vep_cd_prazo)
36.          

SubPlan (for Group)

37. 258.100 774.300 ↓ 0.0 0 258,100

Nested Loop (cost=0.57..16.61 rows=1 width=19) (actual time=0.003..0.003 rows=0 loops=258,100)

38. 516.200 516.200 ↓ 0.0 0 258,100

Index Only Scan using venda_motorista_idx on venda_motorista vmo (cost=0.29..8.31 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=258,100)

  • Index Cond: (vmo_cd_venda = ven.ven_cd_venda)
  • Heap Fetches: 0
39. 0.000 0.000 ↓ 0.0 0

Index Scan using cliente_motorista_pkey on cliente_motorista clm (cost=0.28..8.30 rows=1 width=23) (never executed)

  • Index Cond: (clm_cd_cliente_motorista = vmo.vmo_cd_motorista)
40. 774.300 62,718.300 ↑ 1.0 1 258,100

Aggregate (cost=9.14..9.15 rows=1 width=32) (actual time=0.243..0.243 rows=1 loops=258,100)

41. 61,944.000 61,944.000 ↑ 3.0 1 258,100

Index Scan using venda_prazo_idx_venda on venda_prazo vep (cost=0.57..9.13 rows=3 width=5) (actual time=0.239..0.240 rows=1 loops=258,100)

  • Index Cond: (vep_cd_venda = ven.ven_cd_venda)
Planning time : 12.447 ms
Execution time : 374,749.368 ms