explain.depesz.com

PostgreSQL's explain analyze made readable

Result: niYw

Settings
# exclusive inclusive rows x rows loops node
1. 110.509 161,043.576 ↓ 14,102.0 28,204 1

Nested Loop Left Join (cost=41,647.50..42,416.24 rows=2 width=208) (actual time=5,720.719..161,043.576 rows=28,204 loops=1)

2.          

CTE produtos_e_kits_filho

3. 160.076 3,025.939 ↓ 32.4 28,917 1

HashAggregate (cost=32,121.57..32,130.49 rows=892 width=100) (actual time=2,959.397..3,025.939 rows=28,917 loops=1)

  • Group Key: (1), i_1.idpedidovenda, i_1.idfilial, i_1.idfilialdestinotransferencia, i_1.iditembase, i_1.iditembasereferentekit, (COALESCE(i_1.iditembasereferentekit, i_1.iditembase)), i_1.idsituacaopedidovenda, i_1.idmapacarga, i_1.quantidade, ((i_1.quantidade * (proi.pesobruto)::numeric)), (NULL::integer), (NULL::integer), (NULL::integer), (CASE WHEN ((upper(COALESCE(fp.valor, 'false'::text)) = 'TRUE'::text) AND ((i_1.idfilialdestinotransferencia IS NULL) OR (i_1.idfilialdestinotransferencia = (ff.idfilial)::integer)) AND ((ib_1.entregar)::smallint = 1) AND (ib_1.origemproduto = 2) AND ((ib_1.idsituacaopedidovenda)::smallint = 3)) THEN 1 ELSE 0 END)
4. 44.875 2,865.863 ↓ 32.4 28,940 1

Append (cost=15.01..32,088.12 rows=892 width=100) (actual time=0.408..2,865.863 rows=28,940 loops=1)

5. 137.154 2,779.493 ↓ 493.1 28,105 1

Nested Loop Left Join (cost=15.01..18,672.62 rows=57 width=87) (actual time=0.406..2,779.493 rows=28,105 loops=1)

6. 86.904 1,827.294 ↓ 493.1 28,105 1

Nested Loop Left Join (cost=1.95..17,925.35 rows=57 width=65) (actual time=0.283..1,827.294 rows=28,105 loops=1)

7. 107.912 1,627.970 ↓ 493.1 28,105 1

Nested Loop Left Join (cost=1.53..17,651.01 rows=57 width=39) (actual time=0.265..1,627.970 rows=28,105 loops=1)

8. 109.005 1,407.638 ↓ 493.1 28,105 1

Nested Loop Left Join (cost=1.26..17,628.08 rows=57 width=43) (actual time=0.242..1,407.638 rows=28,105 loops=1)

9. 61.697 1,130.003 ↓ 493.1 28,105 1

Nested Loop (cost=0.84..17,328.00 rows=57 width=43) (actual time=0.197..1,130.003 rows=28,105 loops=1)

10. 0.181 0.181 ↑ 1.1 25 1

Index Scan using pk_gzgrupofilial on gzgrupofilial (cost=0.27..27.44 rows=27 width=4) (actual time=0.059..0.181 rows=25 loops=1)

  • Index Cond: ((idgztipofilial)::smallint = 5)
  • Filter: (datafechamento IS NULL)
  • Rows Removed by Filter: 4
11. 1,068.125 1,068.125 ↓ 562.0 1,124 25

Index Scan using idx_itembase_situacao_filialfaturar on itembase i_1 (cost=0.57..640.74 rows=2 width=47) (actual time=0.848..42.725 rows=1,124 loops=25)

  • Index Cond: (((idsituacaopedidovenda)::smallint = 3) AND ((idfilialafaturar)::integer = (gzgrupofilial.idfilial)::integer))
  • Filter: ((idmapacarga IS NOT NULL) AND ((idlocalsaldo)::smallint = 1) AND ((datamovimento)::date >= (('now'::cstring)::date - 365)))
  • Rows Removed by Filter: 6225
12. 168.630 168.630 ↑ 1.0 1 28,105

Index Scan using pk_produto on produto proi (cost=0.42..5.26 rows=1 width=8) (actual time=0.006..0.006 rows=1 loops=28,105)

  • Index Cond: ((idproduto)::integer = (i_1.idproduto)::integer)
13. 112.420 112.420 ↑ 1.0 1 28,105

Index Scan using ix_fk_filial_pessoa on filial ff (cost=0.27..0.39 rows=1 width=12) (actual time=0.003..0.004 rows=1 loops=28,105)

  • Index Cond: ((i_1.idcnpj_cpf)::bigint = (idcnpj_cpf)::bigint)
14. 112.420 112.420 ↓ 0.0 0 28,105

Index Scan using pk_filialparametro on filialparametro fp (cost=0.42..4.81 rows=1 width=30) (actual time=0.004..0.004 rows=0 loops=28,105)

  • Index Cond: (((idfilial)::integer = (ff.idfilial)::integer) AND ((idparametro)::integer = 5053))
15. 84.315 815.045 ↓ 0.0 0 28,105

Group (cost=13.06..13.07 rows=1 width=8) (actual time=0.028..0.029 rows=0 loops=28,105)

  • Group Key: ib_1.entregar, ib_1.origemproduto, ib_1.idsituacaopedidovenda
16. 140.525 730.730 ↓ 0.0 0 28,105

Sort (cost=13.06..13.07 rows=1 width=8) (actual time=0.026..0.026 rows=0 loops=28,105)

  • Sort Key: ib_1.entregar, ib_1.origemproduto, ib_1.idsituacaopedidovenda
  • Sort Method: quicksort Memory: 25kB
17. 120.850 590.205 ↓ 0.0 0 28,105

Nested Loop Left Join (cost=1.00..13.05 rows=1 width=8) (actual time=0.020..0.021 rows=0 loops=28,105)

18. 252.945 252.945 ↓ 0.0 0 28,105

Index Scan using rastreio_venda_cd_idx1 on rastreio_venda_cd rvc (cost=0.42..6.45 rows=1 width=12) (actual time=0.008..0.009 rows=0 loops=28,105)

  • Index Cond: ((idfilialdeposito = (i_1.idfilial)::integer) AND (iditembasedeposito = (i_1.iditembase)::integer))
  • Filter: (idpedidovendadeposito = (i_1.idpedidovenda)::integer)
19. 216.410 216.410 ↑ 1.0 1 12,730

Index Scan using ix_itembase_iditempedidovenda on itembase ib_1 (cost=0.57..6.59 rows=1 width=20) (actual time=0.017..0.017 rows=1 loops=12,730)

  • Index Cond: (((idfilial)::integer = rvc.idfilial) AND ((idpedidovenda)::integer = rvc.idpedidovenda))
  • Filter: ((iditembase)::integer = rvc.iditembase)
  • Rows Removed by Filter: 0
20. 3.377 41.495 ↑ 1.0 835 1

Nested Loop Left Join (cost=439.51..13,402.13 rows=835 width=87) (actual time=2.068..41.495 rows=835 loops=1)

21. 2.898 33.108 ↑ 1.0 835 1

Nested Loop Left Join (cost=439.09..7,980.89 rows=835 width=83) (actual time=2.028..33.108 rows=835 loops=1)

22. 1.573 26.035 ↑ 1.0 835 1

Hash Left Join (cost=438.67..7,614.68 rows=835 width=83) (actual time=2.000..26.035 rows=835 loops=1)

  • Hash Cond: ((ff_1.idfilial)::integer = (fp_1.idfilial)::integer)
23. 1.773 23.702 ↑ 1.0 835 1

Hash Left Join (cost=49.65..7,223.44 rows=835 width=57) (actual time=1.221..23.702 rows=835 loops=1)

  • Hash Cond: (i_2.idcnpj_cpf = (ff_1.idcnpj_cpf)::bigint)
24. 4.406 20.981 ↑ 1.0 835 1

Nested Loop Left Join (cost=16.76..7,185.20 rows=835 width=61) (actual time=0.241..20.981 rows=835 loops=1)

25. 2.974 9.060 ↑ 1.0 835 1

Nested Loop Left Join (cost=16.19..5,418.11 rows=835 width=32) (actual time=0.185..9.060 rows=835 loops=1)

26. 0.972 1.076 ↑ 1.0 835 1

Bitmap Heap Scan on frete_mapa_carga_roteirizador_item_redespacho r_1 (cost=15.75..46.19 rows=835 width=16) (actual time=0.129..1.076 rows=835 loops=1)

  • Recheck Cond: (idsituacao = 4)
  • Heap Blocks: exact=16
27. 0.104 0.104 ↑ 1.0 835 1

Bitmap Index Scan on id_frete_mapa_carga_roteirizador_item_redespacho_situacao (cost=0.00..15.54 rows=835 width=0) (actual time=0.104..0.104 rows=835 loops=1)

  • Index Cond: (idsituacao = 4)
28. 5.010 5.010 ↑ 1.0 1 835

Index Scan using frete_mapa_carga_roteirizador_item_pkey on frete_mapa_carga_roteirizador_item i_2 (cost=0.44..6.43 rows=1 width=24) (actual time=0.006..0.006 rows=1 loops=835)

  • Index Cond: (iditem = r_1.idroteirizadoritem)
29. 7.515 7.515 ↑ 1.0 1 835

Index Scan using pk_itembase on itembase ib_2 (cost=0.57..2.12 rows=1 width=37) (actual time=0.009..0.009 rows=1 loops=835)

  • Index Cond: (((idfilial)::integer = i_2.idfilial) AND ((iditembase)::integer = i_2.iditembase))
30. 0.411 0.948 ↑ 1.0 386 1

Hash (cost=27.95..27.95 rows=395 width=12) (actual time=0.947..0.948 rows=386 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 27kB
31. 0.537 0.537 ↑ 1.0 395 1

Seq Scan on filial ff_1 (cost=0.00..27.95 rows=395 width=12) (actual time=0.021..0.537 rows=395 loops=1)

32. 0.217 0.760 ↓ 1.0 201 1

Hash (cost=386.61..386.61 rows=193 width=30) (actual time=0.760..0.760 rows=201 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 16kB
33. 0.478 0.543 ↓ 1.0 201 1

Bitmap Heap Scan on filialparametro fp_1 (cost=4.91..386.61 rows=193 width=30) (actual time=0.086..0.543 rows=201 loops=1)

  • Recheck Cond: ((idparametro)::integer = 5053)
  • Heap Blocks: exact=61
34. 0.065 0.065 ↓ 1.1 203 1

Bitmap Index Scan on ix_fk_filialparametro_parametro (cost=0.00..4.87 rows=193 width=0) (actual time=0.064..0.065 rows=203 loops=1)

  • Index Cond: ((idparametro)::integer = 5053)
35. 4.175 4.175 ↑ 1.0 1 835

Index Scan using pk_produto on produto proi_1 (cost=0.42..0.44 rows=1 width=8) (actual time=0.005..0.005 rows=1 loops=835)

  • Index Cond: ((idproduto)::integer = i_2.idproduto)
36. 1.670 5.010 ↓ 0.0 0 835

Group (cost=0.42..6.46 rows=1 width=8) (actual time=0.006..0.006 rows=0 loops=835)

  • Group Key: ib_2.entregar, ib_2.origemproduto, ib_2.idsituacaopedidovenda
37. 3.340 3.340 ↓ 0.0 0 835

Index Scan using rastreio_venda_cd_idx1 on rastreio_venda_cd rvc_1 (cost=0.42..6.45 rows=1 width=8) (actual time=0.004..0.004 rows=0 loops=835)

  • Index Cond: ((idfilialdeposito = (ib_2.idfilial)::integer) AND (iditembasedeposito = (ib_2.iditembase)::integer))
  • Filter: (idpedidovendadeposito = (ib_2.idpedidovenda)::integer)
38.          

CTE produtos_e_kits_pai

39. 255.165 6,007.775 ↓ 134.3 28,204 1

GroupAggregate (cost=9,431.65..9,444.78 rows=210 width=158) (actual time=5,720.105..6,007.775 rows=28,204 loops=1)

  • Group Key: ibf.tipoembarque, ibp.idfilial, ibp.iditembase, ibf.idpedidovenda, ibf.idmapacarga, op.descricao, ibf.idfilialredespacho, ibf.idmapacargaredespacho, ibf.idroteirizadorredespacho, ibf.clientefinal
40. 141.900 5,752.610 ↓ 135.2 28,382 1

Sort (cost=9,431.65..9,432.18 rows=210 width=134) (actual time=5,720.059..5,752.610 rows=28,382 loops=1)

  • Sort Key: ibf.tipoembarque, ibp.idfilial, ibp.iditembase, ibf.idpedidovenda, ibf.idmapacarga, op.descricao, ibf.idfilialredespacho, ibf.idmapacargaredespacho, ibf.idroteirizadorredespacho, ibf.clientefinal
  • Sort Method: quicksort Memory: 5554kB
41. 119.216 5,610.710 ↓ 135.2 28,382 1

Nested Loop Semi Join (cost=9.20..9,423.55 rows=210 width=134) (actual time=2,960.194..5,610.710 rows=28,382 loops=1)

42. 94.158 4,826.403 ↓ 137.7 28,917 1

Nested Loop Left Join (cost=8.33..9,415.29 rows=210 width=134) (actual time=2,960.064..4,826.403 rows=28,917 loops=1)

43. 74.239 4,558.743 ↓ 137.7 28,917 1

Hash Left Join (cost=7.91..9,323.40 rows=210 width=130) (actual time=2,960.032..4,558.743 rows=28,917 loops=1)

  • Hash Cond: ((COALESCE(ibp.idoperacaoproduto, proc.idoperacao))::integer = (op.idoperacao)::integer)
44. 108.283 4,484.095 ↓ 137.7 28,917 1

Nested Loop Left Join (cost=1.13..9,316.05 rows=210 width=117) (actual time=2,959.579..4,484.095 rows=28,917 loops=1)

45. 168.428 3,652.887 ↓ 137.7 28,917 1

Nested Loop (cost=0.57..5,896.12 rows=210 width=115) (actual time=2,959.460..3,652.887 rows=28,917 loops=1)

46. 3,108.538 3,108.538 ↓ 32.4 28,917 1

CTE Scan on produtos_e_kits_filho ibf (cost=0.00..17.84 rows=892 width=72) (actual time=2,959.402..3,108.538 rows=28,917 loops=1)

47. 375.921 375.921 ↑ 1.0 1 28,917

Index Scan using pk_itembase on itembase ibp (cost=0.57..6.59 rows=1 width=51) (actual time=0.013..0.013 rows=1 loops=28,917)

  • Index Cond: (((idfilial)::integer = (ibf.idfilial)::integer) AND ((iditembase)::integer = (ibf.itembase_enviar)::integer))
48. 202.419 722.925 ↑ 1.0 1 28,917

Limit (cost=0.56..16.27 rows=1 width=4) (actual time=0.019..0.025 rows=1 loops=28,917)

49. 106.768 520.506 ↑ 1.0 1 28,917

Nested Loop (cost=0.56..16.27 rows=1 width=4) (actual time=0.017..0.018 rows=1 loops=28,917)

50. 173.502 173.502 ↑ 1.5 2 28,917

Index Only Scan using pk_processocomposto on processocomposto pc (cost=0.28..6.33 rows=3 width=2) (actual time=0.003..0.006 rows=2 loops=28,917)

  • Index Cond: (idprocesso = (ibp.idprocessomestre)::smallint)
  • Heap Fetches: 3769
51. 240.236 240.236 ↓ 0.0 0 60,059

Index Only Scan using aux_processo_processooperacao on processo proc (cost=0.28..3.30 rows=1 width=6) (actual time=0.003..0.004 rows=0 loops=60,059)

  • Index Cond: ((idprocesso = (pc.idprocessocomposto)::smallint) AND (idoperacao >= 100000) AND (idoperacao <= 109999))
  • Heap Fetches: 0
52. 0.194 0.409 ↑ 1.0 168 1

Hash (cost=4.68..4.68 rows=168 width=25) (actual time=0.409..0.409 rows=168 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 18kB
53. 0.215 0.215 ↑ 1.0 168 1

Seq Scan on operacao op (cost=0.00..4.68 rows=168 width=25) (actual time=0.020..0.215 rows=168 loops=1)

54. 173.502 173.502 ↑ 1.0 1 28,917

Index Scan using pk_produto on produto pro (cost=0.42..0.44 rows=1 width=8) (actual time=0.006..0.006 rows=1 loops=28,917)

  • Index Cond: ((idproduto)::integer = (ibp.idproduto)::integer)
55. 173.502 665.091 ↑ 1.0 1 28,917

Hash Join (cost=0.87..0.90 rows=1 width=12) (actual time=0.023..0.023 rows=1 loops=28,917)

  • Hash Cond: ((pg.idproduto)::integer = (p.idproduto)::integer)
  • Join Filter: CASE WHEN (((p.iddepartamento)::integer >= 1100000000) AND ((p.iddepartamento)::integer <= 1199999999)) THEN true WHEN (((pg.idtipoproduto)::smallint = ANY ('{5,2}'::integer[])) AND ((p.iddepartamento)::integer >= 1210190000) AND ((p.iddepartamento)::integer <= 1210199999)) THEN true WHEN (((pg.idtipoproduto)::smallint = ANY ('{5,2}'::integer[])) AND ((p.iddepartamento)::integer >= 1201000000) AND ((p.iddepartamento)::integer <= 1220001300) AND (now() >= '2019-05-28 02:00:00-03'::timestamp with time zone) AND ((pg.idsituacaoproduto)::smallint = ANY ('{1,3}'::integer[]))) THEN true WHEN (((pg.idtipoproduto)::smallint = ANY ('{7,15}'::integer[])) AND ((p.iddepartamento)::integer >= 1900000000) AND ((p.iddepartamento)::integer <= 1999999999) AND (now() >= '2019-05-28 02:00:00-03'::timestamp with time zone) AND ((pg.idsituacaoproduto)::smallint = ANY ('{1,3}'::integer[]))) THEN true ELSE false END
  • Rows Removed by Join Filter: 0
56. 202.419 202.419 ↑ 1.0 1 28,917

Index Scan using pk_produtograde on produtograde pg (cost=0.42..0.44 rows=1 width=12) (actual time=0.007..0.007 rows=1 loops=28,917)

  • Index Cond: (((idproduto)::integer = (ibp.idproduto)::integer) AND ((idgradex)::smallint = (ibp.idgradex)::smallint) AND ((idgradey)::smallint = (ibp.idgradey)::smallint))
57. 115.668 289.170 ↑ 1.0 1 28,917

Hash (cost=0.44..0.44 rows=1 width=10) (actual time=0.010..0.010 rows=1 loops=28,917)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
58. 173.502 173.502 ↑ 1.0 1 28,917

Index Scan using pk_produto on produto p (cost=0.42..0.44 rows=1 width=10) (actual time=0.005..0.006 rows=1 loops=28,917)

  • Index Cond: ((idproduto)::integer = (ibp.idproduto)::integer)
59. 110.547 9,110.935 ↓ 28,204.0 28,204 1

Nested Loop Left Join (cost=27.24..795.92 rows=1 width=208) (actual time=5,720.474..9,110.935 rows=28,204 loops=1)

60. 113.666 8,238.880 ↓ 28,204.0 28,204 1

Nested Loop Left Join (cost=20.64..789.30 rows=1 width=208) (actual time=5,720.398..8,238.880 rows=28,204 loops=1)

61. 100.102 6,968.850 ↓ 28,204.0 28,204 1

Nested Loop (cost=0.99..769.63 rows=1 width=208) (actual time=5,720.339..6,968.850 rows=28,204 loops=1)

62. 126.576 6,502.096 ↓ 7,051.0 28,204 1

Nested Loop (cost=0.43..755.18 rows=4 width=208) (actual time=5,720.254..6,502.096 rows=28,204 loops=1)

63. 6,121.684 6,121.684 ↓ 134.3 28,204 1

CTE Scan on produtos_e_kits_pai ib (cost=0.00..4.20 rows=210 width=208) (actual time=5,720.114..6,121.684 rows=28,204 loops=1)

64. 253.836 253.836 ↑ 1.0 1 28,204

Index Only Scan using pk_mapacarga on mapacarga mc (cost=0.43..3.58 rows=1 width=8) (actual time=0.009..0.009 rows=1 loops=28,204)

  • Index Cond: ((idfilial = (ib.idfilialafaturar)::integer) AND (idmapacarga = ib.idmapacarga))
  • Heap Fetches: 27097
65. 366.652 366.652 ↑ 1.0 1 28,204

Index Only Scan using pk_pedidovenda on pedidovenda pv (cost=0.56..3.61 rows=1 width=8) (actual time=0.013..0.013 rows=1 loops=28,204)

  • Index Cond: ((idfilial = (ib.idfilial)::integer) AND (idpedidovenda = (ib.idpedidovenda)::integer))
  • Heap Fetches: 26078
66. 169.224 1,156.364 ↓ 0.0 0 28,204

Limit (cost=19.65..19.65 rows=1 width=472) (actual time=0.037..0.041 rows=0 loops=28,204)

67. 169.224 987.140 ↓ 0.0 0 28,204

Sort (cost=19.65..19.65 rows=1 width=472) (actual time=0.034..0.035 rows=0 loops=28,204)

  • Sort Key: eb.idenderecobase DESC
  • Sort Method: quicksort Memory: 25kB
68. 104.357 817.916 ↑ 1.0 1 28,204

Nested Loop Left Join (cost=1.55..19.64 rows=1 width=472) (actual time=0.025..0.029 rows=1 loops=28,204)

  • Join Filter: ((frp.idfilial = vcd.idfilialdeposito) AND (frp.idpedidovenda = vcd.idpedidovendadeposito))
69. 97.924 564.080 ↓ 0.0 0 28,204

Nested Loop Left Join (cost=0.99..13.04 rows=1 width=12) (actual time=0.018..0.020 rows=0 loops=28,204)

70. 253.836 253.836 ↓ 0.0 0 28,204

Index Scan using idx_rastreio_venda_cd_filialdeposito_pedidovendadeposito on rastreio_venda_cd vcd (cost=0.42..6.44 rows=1 width=16) (actual time=0.008..0.009 rows=0 loops=28,204)

  • Index Cond: ((idfilialdeposito = (ib.idfilial)::integer) AND (idpedidovendadeposito = (ib.idpedidovenda)::integer))
71. 212.320 212.320 ↑ 1.0 1 13,270

Index Scan using ix_fk_enderecobase_pedidovenda on enderecobase eb (cost=0.57..6.59 rows=1 width=16) (actual time=0.014..0.016 rows=1 loops=13,270)

  • Index Cond: (((idfilial)::integer = vcd.idfilial) AND ((idpedidovenda)::integer = vcd.idpedidovenda))
72. 149.479 149.479 ↑ 1.0 1 13,589

Index Scan using idx_frete_mapa_carga_roteirizador_pedido_idmaparoteirizador on frete_mapa_carga_roteirizador_pedido frp (cost=0.56..6.58 rows=1 width=12) (actual time=0.009..0.011 rows=1 loops=13,589)

  • Index Cond: ((idfilial = (ib.idfilial)::integer) AND (idpedidovenda = (ib.idpedidovenda)::integer))
73. 141.020 761.508 ↑ 1.0 1 28,204

Limit (cost=6.60..6.60 rows=1 width=315) (actual time=0.023..0.027 rows=1 loops=28,204)

74. 141.020 620.488 ↑ 1.0 1 28,204

Sort (cost=6.60..6.60 rows=1 width=315) (actual time=0.021..0.022 rows=1 loops=28,204)

  • Sort Key: eb_1.idenderecobase DESC
  • Sort Method: quicksort Memory: 25kB
75. 479.468 479.468 ↑ 1.0 1 28,204

Index Scan using ix_fk_enderecobase_pedidovenda on enderecobase eb_1 (cost=0.57..6.59 rows=1 width=315) (actual time=0.015..0.017 rows=1 loops=28,204)

  • Index Cond: (((idfilial)::integer = (ib.idfilial)::integer) AND ((idpedidovenda)::integer = (ib.idpedidovenda)::integer))
76. 112.816 151,822.132 ↑ 2.0 1 28,204

Unique (cost=44.99..45.00 rows=2 width=6) (actual time=5.381..5.383 rows=1 loops=28,204)

77. 169.224 151,709.316 ↑ 2.0 1 28,204

Sort (cost=44.99..44.99 rows=2 width=6) (actual time=5.379..5.379 rows=1 loops=28,204)

  • Sort Key: ""*SELECT* 1"".ordem, ((""*SELECT* 1"".identidadetransportadora)::smallint)
  • Sort Method: quicksort Memory: 25kB
78. 112.816 151,540.092 ↑ 2.0 1 28,204

Append (cost=1.70..44.98 rows=2 width=6) (actual time=2.710..5.373 rows=1 loops=28,204)

79. 84.612 151,370.868 ↑ 1.0 1 28,204

Subquery Scan on "*SELECT* 1" (cost=1.70..25.59 rows=1 width=6) (actual time=2.707..5.367 rows=1 loops=28,204)

80. 109.808 151,286.256 ↑ 1.0 1 28,204

Result (cost=1.70..25.58 rows=1 width=6) (actual time=2.705..5.364 rows=1 loops=28,204)

  • One-Time Filter: (ib.tipoembarque = 1)
81. 136.567 151,176.448 ↑ 1.0 1 27,392

Nested Loop Left Join (cost=1.70..25.58 rows=1 width=6) (actual time=2.784..5.519 rows=1 loops=27,392)

  • Filter: (rd.iditem IS NULL)
82. 17,719.912 150,957.312 ↑ 1.0 1 27,392

Nested Loop (cost=1.42..19.27 rows=1 width=10) (actual time=2.777..5.511 rows=1 loops=27,392)

83. 21,948.256 34,623.488 ↓ 450.0 450 27,392

Nested Loop (cost=0.86..15.90 rows=1 width=12) (actual time=0.024..1.264 rows=450 loops=27,392)

84. 219.136 219.136 ↑ 1.0 1 27,392

Index Scan using frete_mapa_carga_roteirizador_mapacarga_idx1 on frete_mapa_carga_roteirizador_mapacarga mcr (cost=0.42..6.44 rows=1 width=8) (actual time=0.007..0.008 rows=1 loops=27,392)

  • Index Cond: ((idfilial = (ib.idfilial)::integer) AND (idmapacarga = ib.idmapacarga))
85. 12,456.096 12,456.096 ↓ 225.5 451 27,316

Index Scan using frete_mapa_carga_roteirizador_pedido_idx on frete_mapa_carga_roteirizador_pedido mcp (cost=0.43..9.44 rows=2 width=16) (actual time=0.013..0.456 rows=451 loops=27,316)

  • Index Cond: ((idfilial = (ib.idfilial)::integer) AND (idmaparoteirizador = mcr.idmaparoteirizador))
86. 98,613.912 98,613.912 ↓ 0.0 0 12,326,739

Index Scan using frete_mapa_carga_roteirizador_item_idx on frete_mapa_carga_roteirizador_item i (cost=0.56..3.36 rows=1 width=14) (actual time=0.008..0.008 rows=0 loops=12,326,739)

  • Index Cond: ((idfilialafaturar = (ib.idfilial)::integer) AND (idmapapedido = mcp.id))
  • Filter: (iditembase = ANY (ib.arr_itembasefilhos))
  • Rows Removed by Filter: 1
87. 82.569 82.569 ↓ 0.0 0 27,523

Index Scan using idx_frete_mapa_carga_roteirizador_item_redespacho_roteirizador on frete_mapa_carga_roteirizador_item_redespacho rd (cost=0.28..6.30 rows=1 width=8) (actual time=0.003..0.003 rows=0 loops=27,523)

  • Index Cond: (i.iditem = idroteirizadoritem)
88. 33.672 56.408 ↓ 0.0 0 28,204

Result (cost=1.29..19.37 rows=1 width=6) (actual time=0.001..0.002 rows=0 loops=28,204)

  • One-Time Filter: (ib.tipoembarque = 2)
89. 3.928 22.736 ↑ 1.0 1 812

Nested Loop Left Join (cost=1.29..19.37 rows=1 width=4) (actual time=0.021..0.028 rows=1 loops=812)

  • Join Filter: (r.id = p_1.idmaparoteirizador)
90. 4.060 12.992 ↑ 1.0 1 812

Nested Loop (cost=0.85..12.89 rows=1 width=4) (actual time=0.013..0.016 rows=1 loops=812)

91. 4.872 4.872 ↑ 1.0 1 812

Index Only Scan using frete_mapa_carga_roteirizador_pkey1 on frete_mapa_carga_roteirizador r (cost=0.42..6.44 rows=1 width=4) (actual time=0.006..0.006 rows=1 loops=812)

  • Index Cond: (id = ib.idroteirizadorredespacho)
  • Heap Fetches: 0
92. 4.060 4.060 ↑ 1.0 1 812

Index Only Scan using idx_frete_mapa_carga_roteirizador_mapacarga_maparoteirizador on frete_mapa_carga_roteirizador_mapacarga mc_1 (cost=0.42..6.44 rows=1 width=4) (actual time=0.004..0.005 rows=1 loops=812)

  • Index Cond: (idmaparoteirizador = ib.idroteirizadorredespacho)
  • Heap Fetches: 0
93. 5.816 5.816 ↑ 1.0 1 727

Index Scan using idx_frete_mapa_carga_roteirizador_pedido_roterizadorpedidovenda on frete_mapa_carga_roteirizador_pedido p_1 (cost=0.43..6.46 rows=1 width=8) (actual time=0.007..0.008 rows=1 loops=727)

  • Index Cond: ((idmaparoteirizador = ib.idroteirizadorredespacho) AND ((ib.idpedidovenda)::integer = idpedidovenda))
  • Filter: (idfilial = (ib.idfilial)::integer)
Planning time : 81.391 ms