explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 96Dq

Settings
# exclusive inclusive rows x rows loops node
1. 0.031 392.950 ↓ 11.0 22 1

Sort (cost=6,123.43..6,123.43 rows=2 width=564) (actual time=392.949..392.950 rows=22 loops=1)

  • Sort Key: "*SELECT* 1".ped_nidpedido
  • Sort Method: quicksort Memory: 30kB
2. 0.007 392.919 ↓ 11.0 22 1

Append (cost=4,119.10..6,123.42 rows=2 width=564) (actual time=388.157..392.919 rows=22 loops=1)

3. 0.012 392.431 ↓ 22.0 22 1

Subquery Scan on *SELECT* 1 (cost=4,119.10..4,119.77 rows=1 width=324) (actual time=388.156..392.431 rows=22 loops=1)

4. 5.629 392.419 ↓ 22.0 22 1

GroupAggregate (cost=4,119.10..4,119.76 rows=1 width=334) (actual time=388.155..392.419 rows=22 loops=1)

  • Group Key: ped.ped_nidpedido, ((((cliente.cli_nrutcliente)::text || '-'::text) || (cliente.cli_sdigverificador)::text)), ped.ped_nrutoperador, territorio.ter_scodterritorio, zona.zon_sdeszona, cliente.cli_stipocluster, jerarquia_categor (...)
5. 0.144 386.790 ↓ 28.0 28 1

Sort (cost=4,119.10..4,119.11 rows=1 width=129) (actual time=386.786..386.790 rows=28 loops=1)

  • Sort Key: ped.ped_nidpedido, ((((cliente.cli_nrutcliente)::text || '-'::text) || (cliente.cli_sdigverificador)::text)), territorio.ter_scodterritorio, zona.zon_sdeszona, cliente.cli_stipocluster, jerarquia_categoria.jca_scodcatego (...)
  • Sort Method: quicksort Memory: 32kB
6. 0.170 386.646 ↓ 28.0 28 1

Nested Loop Anti Join (cost=58.75..4,119.09 rows=1 width=129) (actual time=19.892..386.646 rows=28 loops=1)

  • Join Filter: ((inversion_ctacorriente_mov.cmv_scodcategoria)::text = (jerarquia_categoria.jca_scodcategoria)::text)
7. 0.057 9.456 ↓ 28.0 28 1

Nested Loop (cost=58.33..2,625.12 rows=1 width=105) (actual time=5.579..9.456 rows=28 loops=1)

8. 0.077 9.175 ↓ 28.0 28 1

Nested Loop (cost=58.19..2,624.41 rows=1 width=89) (actual time=5.555..9.175 rows=28 loops=1)

9. 0.146 8.790 ↓ 28.0 28 1

Nested Loop (cost=57.91..2,624.09 rows=1 width=94) (actual time=5.536..8.790 rows=28 loops=1)

  • Join Filter: ((ped.ped_nrutcliente = relacion_comer_localcliente.rco_nrutcliente) AND (ped.ped_nnumlocal = relacion_comer_localcliente.rco_nnumlocal) AND ((ped.ped_scodrelacioncomer)::text = (relacion_comer (...)
  • Rows Removed by Join Filter: 51
10. 0.110 7.860 ↓ 28.0 28 1

Nested Loop (cost=57.48..2,619.33 rows=1 width=93) (actual time=5.499..7.860 rows=28 loops=1)

  • Join Filter: (((detalle_pedido.dpe_scodformato)::text = (precio_articulo.pra_scodformato)::text) AND ((detalle_pedido.dpe_scodvariedad)::text = (precio_articulo.pra_scodvariedad)::text))
11. 0.101 6.602 ↓ 28.0 28 1

Nested Loop (cost=57.20..2,618.78 rows=1 width=99) (actual time=5.442..6.602 rows=28 loops=1)

12. 1.124 6.277 ↓ 28.0 28 1

Nested Loop (cost=57.06..2,618.55 rows=1 width=85) (actual time=5.433..6.277 rows=28 loops=1)

  • Join Filter: ((jerarquia_productobase.jpb_scodagrupacion)::text = (jerarquia_agrupacion.jag_scodagrupacion)::text)
  • Rows Removed by Join Filter: 5012
13. 0.113 0.113 ↑ 1.0 180 1

Index Scan using idx_jerarquia_agrupacion on jerarquia_agrupacion (cost=0.14..22.84 rows=180 width=10) (actual time=0.035..0.113 rows=180 loops=1)

14. 0.226 5.040 ↓ 28.0 28 180

Materialize (cost=56.91..2,593.01 rows=1 width=85) (actual time=0.013..0.028 rows=28 loops=180)

15. 0.009 4.814 ↓ 28.0 28 1

Nested Loop (cost=56.91..2,593.00 rows=1 width=85) (actual time=2.333..4.814 rows=28 loops=1)

16. 0.018 4.693 ↓ 28.0 28 1

Nested Loop (cost=56.64..2,592.70 rows=1 width=85) (actual time=2.325..4.693 rows=28 loops=1)

17. 0.023 4.507 ↓ 28.0 28 1

Nested Loop (cost=56.35..2,591.86 rows=1 width=69) (actual time=2.311..4.507 rows=28 loops=1)

18. 0.028 4.176 ↓ 28.0 28 1

Nested Loop (cost=55.93..2,583.42 rows=1 width=59) (actual time=2.274..4.176 rows=28 loops=1)

19. 1.729 3.698 ↑ 1.6 45 1

Bitmap Heap Scan on pedido ped (cost=55.38..1,973.88 rows=71 width=45) (actual time=2.254..3.698 rows=45 loops=1)

  • Recheck Cond: ((ped_nrutoperador = '76265773'::numeric) AND (ped_dfhocreacion >= '2020-03-16 00:00:00'::timestamp without time zone) AND (ped_dfhocreaci (...)
  • Filter: ((ped_scodestado)::text = 'CREAD'::text)
  • Rows Removed by Filter: 1392
  • Heap Blocks: exact=663
20. 1.969 1.969 ↓ 2.7 1,484 1

Bitmap Index Scan on pedido_fecha (cost=0.00..55.36 rows=555 width=0) (actual time=1.969..1.969 rows=1,484 loops=1)

  • Index Cond: ((ped_nrutoperador = '76265773'::numeric) AND (ped_dfhocreacion >= '2020-03-16 00:00:00'::timestamp without time zone) AND (ped_dfhocr (...)
21. 0.450 0.450 ↑ 1.0 1 45

Index Scan using pk_detalle_pedido on detalle_pedido (cost=0.55..8.57 rows=1 width=28) (actual time=0.009..0.010 rows=1 loops=45)

  • Index Cond: ((dpe_nidpedido = ped.ped_nidpedido) AND (dpe_nrutoperador = '76265773'::numeric))
  • Filter: (dpe_nporcdescuento > '0'::numeric)
  • Rows Removed by Filter: 10
22. 0.308 0.308 ↑ 1.0 1 28

Index Scan using "idx$$_1c630002" on cliente (cost=0.42..8.44 rows=1 width=17) (actual time=0.011..0.011 rows=1 loops=28)

  • Index Cond: ((cli_nrutoperador = '76265773'::numeric) AND (cli_nrutcliente = ped.ped_nrutcliente))
23. 0.168 0.168 ↑ 1.0 1 28

Index Scan using pk_articulo on articulo (cost=0.28..0.84 rows=1 width=16) (actual time=0.006..0.006 rows=1 loops=28)

  • Index Cond: (((art_scodformato)::text = (detalle_pedido.dpe_scodformato)::text) AND ((art_scodvariedad)::text = (detalle_pedido.dpe_scodvariedad)::text))
24. 0.112 0.112 ↑ 1.0 1 28

Index Scan using pk_jerarquia_productobase on jerarquia_productobase (cost=0.28..0.30 rows=1 width=10) (actual time=0.004..0.004 rows=1 loops=28)

  • Index Cond: ((jpb_scodproductobase)::text = (articulo.art_scodjerproducbase)::text)
25. 0.224 0.224 ↑ 1.0 1 28

Index Scan using pk_jerarquia_categoria on jerarquia_categoria (cost=0.14..0.23 rows=1 width=19) (actual time=0.008..0.008 rows=1 loops=28)

  • Index Cond: (((jca_scodcategoria)::text = (jerarquia_agrupacion.jag_scodcategoria)::text) AND ((jca_scodcategoria)::text >= ''::text) AND ((jca_scodcategoria)::text <= 'zzzzz'::text))
26. 1.148 1.148 ↑ 1.0 1 28

Index Scan using precio_articulo_extra1 on precio_articulo (cost=0.29..0.54 rows=1 width=12) (actual time=0.034..0.041 rows=1 loops=28)

  • Index Cond: (((pra_scodformato)::text = (articulo.art_scodformato)::text) AND ((pra_scodvariedad)::text = (articulo.art_scodvariedad)::text))
  • Filter: ((pra_dfhoiniciovigencia <= sysdate) AND (pra_dfhofinvigencia > sysdate))
  • Rows Removed by Filter: 14
27. 0.784 0.784 ↓ 3.0 3 28

Index Scan using pk_relacion_comer_localcliente on relacion_comer_localcliente (cost=0.42..4.74 rows=1 width=29) (actual time=0.023..0.028 rows=3 loops=28)

  • Index Cond: ((rco_nrutcliente = cliente.cli_nrutcliente) AND (rco_nrutoperador = '76265773'::numeric))
28. 0.308 0.308 ↑ 1.0 1 28

Index Scan using idx_id_territorio on territorio (cost=0.28..0.32 rows=1 width=25) (actual time=0.011..0.011 rows=1 loops=28)

  • Index Cond: ((ter_nrutoperador = '76265773'::numeric) AND (ter_nidterritorio = relacion_comer_localcliente.rco_nidterritorio))
  • Filter: (((ter_scodzona)::text >= ''::text) AND ((ter_scodzona)::text <= 'zzzzz'::text) AND ((ter_scodterritorio)::text >= ''::text) AND ((ter_scodterritorio)::text <= 'zzzzz'::text) AND ((ter_scodestado):: (...)
29. 0.224 0.224 ↑ 1.0 1 28

Index Scan using pk_zona on zona (cost=0.14..0.70 rows=1 width=33) (actual time=0.007..0.008 rows=1 loops=28)

  • Index Cond: ((zon_nrutoperador = '76265773'::numeric) AND ((zon_scodzona)::text = (territorio.ter_scodzona)::text))
30. 377.020 377.020 ↓ 0.0 0 28

Index Scan using pk_inversion_mov on inversion_ctacorriente_mov (cost=0.42..1,493.95 rows=1 width=14) (actual time=13.465..13.465 rows=0 loops=28)

  • Index Cond: ((ped.ped_nidpedido = cmv_nidpedido) AND (cmv_nrutoperador = '76265773'::numeric))
31. 0.000 0.481 ↓ 0.0 0 1

Subquery Scan on *SELECT* 2 (cost=27.90..2,003.65 rows=1 width=267) (actual time=0.481..0.481 rows=0 loops=1)

32. 0.001 0.481 ↓ 0.0 0 1

Nested Loop (cost=27.90..2,003.64 rows=1 width=267) (actual time=0.481..0.481 rows=0 loops=1)

33. 0.000 0.480 ↓ 0.0 0 1

Nested Loop Left Join (cost=27.48..1,998.33 rows=1 width=124) (actual time=0.480..0.480 rows=0 loops=1)

34. 0.001 0.480 ↓ 0.0 0 1

Nested Loop Left Join (cost=26.92..1,989.75 rows=1 width=103) (actual time=0.480..0.480 rows=0 loops=1)

35. 0.000 0.479 ↓ 0.0 0 1

Nested Loop (cost=26.49..1,981.30 rows=1 width=81) (actual time=0.479..0.479 rows=0 loops=1)

  • Join Filter: ((inversion_ctacorriente_mov_1.cmv_scodcategoria)::text = (jerarquia_categoria_1.jca_scodcategoria)::text)
36. 0.001 0.479 ↓ 0.0 0 1

Nested Loop (cost=26.49..1,979.02 rows=1 width=67) (actual time=0.479..0.479 rows=0 loops=1)

37. 0.001 0.478 ↓ 0.0 0 1

Nested Loop (cost=26.35..1,978.49 rows=1 width=51) (actual time=0.478..0.478 rows=0 loops=1)

38. 0.398 0.477 ↓ 0.0 0 1

Bitmap Heap Scan on inversion_ctacorriente_mov inversion_ctacorriente_mov_1 (cost=26.07..1,973.13 rows=1 width=46) (actual time=0.477..0.477 rows=0 loops=1)

  • Recheck Cond: (cmv_nrutoperador = '76265773'::numeric)
  • Filter: (((cmv_scodestado)::text >= 'PENDIENTE'::text) AND ((cmv_scodestado)::text <= 'PENDIENTE'::text) AND ((cmv_scodestado)::text <> ALL ('{FACTU,NOCRE}'::text[])) AND (cmv_dfhomovimiento >= '2020- (...)
  • Rows Removed by Filter: 697
  • Heap Blocks: exact=99
39. 0.079 0.079 ↑ 1.1 697 1

Bitmap Index Scan on inversion_ctacorriente_mov_cmv_nrutoperador_idx (cost=0.00..26.07 rows=753 width=0) (actual time=0.079..0.079 rows=697 loops=1)

  • Index Cond: (cmv_nrutoperador = '76265773'::numeric)
40. 0.000 0.000 ↓ 0.0 0

Index Only Scan using pk_territorio on territorio territorio_1 (cost=0.28..5.35 rows=1 width=17) (never executed)

  • Index Cond: ((ter_nrutoperador = '76265773'::numeric) AND (ter_scodzona >= ''::text) AND (ter_scodzona <= 'zzzzz'::text) AND (ter_scodterritorio = (inversion_ctacorriente_mov_1.cmv_scodterritorio)::te (...)
  • Heap Fetches: 0
41. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_zona on zona zona_1 (cost=0.14..0.52 rows=1 width=33) (never executed)

  • Index Cond: ((zon_nrutoperador = '76265773'::numeric) AND ((zon_scodzona)::text = (territorio_1.ter_scodzona)::text))
42. 0.000 0.000 ↓ 0.0 0

Seq Scan on jerarquia_categoria jerarquia_categoria_1 (cost=0.00..1.57 rows=57 width=19) (never executed)

43. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pedido on pedido (cost=0.42..8.44 rows=1 width=37) (never executed)

  • Index Cond: ((inversion_ctacorriente_mov_1.cmv_nidpedido = ped_nidpedido) AND (inversion_ctacorriente_mov_1.cmv_nrutoperador = ped_nrutoperador) AND (ped_nrutoperador = '76265773'::numeric))
44. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pedido_procesado on pedido_procesado (cost=0.56..8.58 rows=1 width=36) (never executed)

  • Index Cond: ((inversion_ctacorriente_mov_1.cmv_nidpedido = pep_nidpedido) AND (inversion_ctacorriente_mov_1.cmv_nrutoperador = pep_nrutoperador) AND (pep_nrutoperador = '76265773'::numeric))
45. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_cliente on cliente cliente_1 (cost=0.42..5.27 rows=1 width=17) (never executed)

  • Index Cond: ((cli_nrutcliente = nvl(pedido.ped_nrutcliente, pedido_procesado.pep_nrutcliente)) AND (cli_nrutoperador = '76265773'::numeric))
Planning time : 18.180 ms
Execution time : 393.391 ms