explain.depesz.com

PostgreSQL's explain analyze made readable

Result: C7Ti

Settings
# exclusive inclusive rows x rows loops node
1. 0.092 13,423.394 ↓ 50.0 100 1

Unique (cost=18,428.17..18,428.25 rows=2 width=974) (actual time=13,423.277..13,423.394 rows=100 loops=1)

2. 0.401 13,423.302 ↓ 50.0 100 1

Sort (cost=18,428.17..18,428.17 rows=2 width=974) (actual time=13,423.275..13,423.302 rows=100 loops=1)

  • Sort Key: pesdes.id_tipo_pessoa, estdoc.cd_filial_operacao, estdoc.cd_pessoa_destinatario, pesdes.no_pessoa, pesdes.nr_identificacao, segdes.no_segmento, pesvenpes.no_pessoa, ((((locdes.no_localidade)::text || '/'::text) || (locdes.sigla_uf)::text) (...)
  • Sort Method: quicksort Memory: 52kB
3. 0.045 13,422.901 ↓ 50.0 100 1

Append (cost=5.90..18,428.16 rows=2 width=974) (actual time=3,762.701..13,422.901 rows=100 loops=1)

4. 1.175 13,391.573 ↓ 100.0 100 1

Nested Loop Anti Join (cost=5.90..6,523.71 rows=1 width=269) (actual time=3,762.700..13,391.573 rows=100 loops=1)

5. 3.796 13,389.698 ↓ 100.0 100 1

Nested Loop Left Join (cost=5.48..6,513.04 rows=1 width=258) (actual time=3,762.633..13,389.698 rows=100 loops=1)

  • Join Filter: (((segdes.id_atividade)::text = (pesclides.id_atividade)::text) AND (segdes.cd_segmento = pesclides.cd_segmento))
  • Rows Removed by Join Filter: 12,100
6. 0.132 13,380.902 ↓ 100.0 100 1

Nested Loop Left Join (cost=5.48..6,507.55 rows=1 width=259) (actual time=3,762.559..13,380.902 rows=100 loops=1)

7. 12.191 13,379.870 ↓ 100.0 100 1

Nested Loop (cost=5.06..6,506.97 rows=1 width=252) (actual time=3,762.543..13,379.870 rows=100 loops=1)

  • Join Filter: ((pro.cd_produto_grupo)::text = (progru.cd_produto_grupo)::text)
  • Rows Removed by Join Filter: 59,100
8. 0.567 13,357.979 ↓ 100.0 100 1

Nested Loop (cost=5.06..6,481.67 rows=1 width=232) (actual time=3,762.338..13,357.979 rows=100 loops=1)

9. 0.518 13,350.815 ↓ 733.0 733 1

Nested Loop (cost=4.77..6,481.35 rows=1 width=198) (actual time=3,761.821..13,350.815 rows=733 loops=1)

10. 1.202 13,347.365 ↓ 733.0 733 1

Nested Loop (cost=4.49..6,481.04 rows=1 width=185) (actual time=3,761.811..13,347.365 rows=733 loops=1)

  • Join Filter: (pesendtipdes.seq_endereco = pesenddes.seq_endereco)
  • Rows Removed by Join Filter: 1
11. 1.073 13,342.498 ↓ 733.0 733 1

Nested Loop (cost=4.07..6,480.51 rows=1 width=193) (actual time=3,761.791..13,342.498 rows=733 loops=1)

  • Join Filter: (estdoc.cd_pessoa_destinatario = pesdes.cd_pessoa)
12. 0.792 13,337.760 ↓ 733.0 733 1

Nested Loop (cost=3.65..6,479.97 rows=1 width=146) (actual time=3,761.780..13,337.760 rows=733 loops=1)

13. 1.163 13,333.303 ↓ 733.0 733 1

Nested Loop (cost=3.23..6,474.97 rows=1 width=130) (actual time=3,761.760..13,333.303 rows=733 loops=1)

  • Join Filter: (pesven.cd_pessoa = pesvenpes.cd_pessoa)
14. 1.307 13,329.208 ↓ 733.0 733 1

Nested Loop (cost=2.81..6,474.35 rows=1 width=130) (actual time=3,761.742..13,329.208 rows=733 loops=1)

  • Join Filter: (pesven.cd_pessoa = ped.cd_pessoa_interna)
  • Rows Removed by Join Filter: 1
15. 0.900 13,323.497 ↓ 734.0 734 1

Nested Loop (cost=2.38..6,473.57 rows=1 width=146) (actual time=3,761.723..13,323.497 rows=734 loops=1)

16. 0.914 13,317.459 ↓ 734.0 734 1

Nested Loop (cost=1.96..6,472.94 rows=1 width=178) (actual time=3,761.705..13,317.459 rows=734 loops=1)

  • Join Filter: ((estdoc.cd_base = estdocite.cd_base) AND (estdoc.seq_processo = estdocite.seq_processo))
17. 1,100.854 13,309.205 ↓ 734.0 734 1

Nested Loop (cost=1.40..6,471.16 rows=1 width=98) (actual time=3,761.669..13,309.205 rows=734 loops=1)

  • -> Index Only Scan using est_doc_item_comis_pk on est_doc_item_comis estdocitecom (cost=0.56..5.66 rows=1 width=40) (actual time=0.006..0.006 rows=0 loops=1 (...)
18. 1,640.219 12,208.351 ↓ 27,756.3 166,538 1

Nested Loop (cost=0.85..6,437.13 rows=6 width=74) (actual time=0.479..12,208.351 rows=166,538 loops=1)

  • Join Filter: (estdoc.cd_operacao_princ = opeest.cd_operacao)
  • Rows Removed by Join Filter: 8,827,926
  • Index Cond: ((cd_empresa = 30) AND (cd_base = estdoc.cd_base) AND (seq_processo = estdoc.seq_processo) AND (cd_vendedor = pesven.cd_vendedor))
  • Heap Fetches: 570
19. 9,397.153 9,407.556 ↓ 6,908.2 290,144 1

Nested Loop (cost=0.85..6,409.92 rows=42 width=82) (actual time=0.304..9,407.556 rows=290,144 loops=1)

  • -> Index Scan using est_documento_idx3 on est_documento estdoc (cost=0.43..791.00 rows=8 width=62) (actual time=0.179..13.137 rows=410 loops=708 (...)
20. 9.816 10.403 ↓ 354.0 708 1

Nested Loop (cost=0.42..4,827.76 rows=2 width=32) (actual time=0.051..10.403 rows=708 loops=1)

  • -> Index Scan using pessoa_atividade_pk on pessoa_atividade pesati (cost=0.42..6.81 rows=1 width=16) (actual time=0.011..0.012 rows=1 loop (...)
  • Index Cond: ((pesati.dt_ativacao <= dt_fiscal) AND (dt_fiscal >= '2018-01-01'::date) AND (dt_fiscal <= '2018-01-31'::date))
  • Filter: ((id_situacao_eletronica = ANY ('{0,9}'::bpchar[])) AND (cd_empresa = 30) AND (cd_filial_operacao = 36) AND ((pesati.dt_desativacao (...)
  • Rows Removed by Filter: 11,780
21. 0.587 0.587 ↓ 1.0 712 1

Seq Scan on pessoa_vendedor pesven (cost=0.00..14.06 rows=706 width=16) (actual time=0.024..0.587 rows=712 loops=1)

  • Index Cond: ((cd_pessoa = pesven.cd_pessoa) AND ((id_atividade)::text = 'VENDED'::text))
22. 1,160.466 1,160.576 ↑ 1.0 31 290,144

Materialize (cost=0.00..7.75 rows=31 width=8) (actual time=0.000..0.004 rows=31 loops=290,144)

23. 0.110 0.110 ↑ 1.0 31 1

Seq Scan on operacao_estoque opeest (cost=0.00..7.60 rows=31 width=8) (actual time=0.012..0.110 rows=31 loops=1)

  • Filter: ((id_tipo_transacao)::text = 'VD'::text)
  • Rows Removed by Filter: 182
24. 7.340 7.340 ↑ 1.0 1 734

Index Scan using est_doc_item_idx1 on est_doc_item estdocite (cost=0.56..1.77 rows=1 width=88) (actual time=0.009..0.010 rows=1 loops=734)

  • Index Cond: ((cd_empresa = 30) AND (cd_base = estdocitecom.cd_base) AND (seq_processo = estdocitecom.seq_processo))
  • Filter: (estdocitecom.seq_item = seq_item)
  • Rows Removed by Filter: 2
25. 5.138 5.138 ↑ 1.0 1 734

Index Scan using pedido_item_fat_idx1 on pedido_item_fat peditefat (cost=0.42..0.62 rows=1 width=48) (actual time=0.006..0.007 rows=1 loops=734)

  • Index Cond: ((cd_empresa = 30) AND (cd_base_doc = estdocite.cd_base) AND (seq_processo_doc = estdocite.seq_processo) AND (seq_item_doc = estdocite.seq_item))
26. 4.404 4.404 ↑ 3.0 1 734

Index Scan using pedido_pk on pedido ped (cost=0.42..0.75 rows=3 width=32) (actual time=0.006..0.006 rows=1 loops=734)

  • Index Cond: ((cd_empresa = 30) AND (cd_base = peditefat.cd_base) AND (seq_pedido = peditefat.seq_pedido))
27. 2.932 2.932 ↑ 1.0 1 733

Index Scan using pessoa_pk on pessoa pesvenpes (cost=0.42..0.61 rows=1 width=32) (actual time=0.004..0.004 rows=1 loops=733)

  • Index Cond: (cd_pessoa = ped.cd_pessoa_interna)
28. 3.665 3.665 ↑ 1.0 1 733

Index Only Scan using pessoa_endereco_tipo_pk on pessoa_endereco_tipo pesendtipdes (cost=0.42..4.99 rows=1 width=16) (actual time=0.005..0.005 rows=1 loops=733)

  • Index Cond: ((cd_pessoa = estdoc.cd_pessoa_destinatario) AND (id_tipo_endereco = 'PRI'::text))
  • Heap Fetches: 124
29. 3.665 3.665 ↑ 1.0 1 733

Index Scan using pessoa_pk on pessoa pesdes (cost=0.42..0.52 rows=1 width=47) (actual time=0.005..0.005 rows=1 loops=733)

  • Index Cond: (cd_pessoa = pesendtipdes.cd_pessoa)
30. 3.665 3.665 ↑ 1.0 1 733

Index Scan using pessoa_endereco_pk on pessoa_endereco pesenddes (cost=0.42..0.52 rows=1 width=24) (actual time=0.005..0.005 rows=1 loops=733)

  • Index Cond: (cd_pessoa = pesdes.cd_pessoa)
31. 2.932 2.932 ↑ 1.0 1 733

Index Scan using localidade_pk on localidade locdes (cost=0.29..0.30 rows=1 width=29) (actual time=0.003..0.004 rows=1 loops=733)

  • Index Cond: (cd_localidade = pesenddes.cd_localidade)
32. 6.597 6.597 ↓ 0.0 0 733

Index Scan using produto_pk on produto pro (cost=0.29..0.31 rows=1 width=40) (actual time=0.009..0.009 rows=0 loops=733)

  • Index Cond: ((cd_produto)::text = (estdocite.cd_produto)::text)
  • Filter: ((cd_produto_grupo)::text ~~ '0172'::text)
  • Rows Removed by Filter: 1
33. 9.700 9.700 ↓ 1.0 592 100

Seq Scan on produto_grupo progru (cost=0.00..17.91 rows=591 width=27) (actual time=0.002..0.097 rows=592 loops=100)

34. 0.900 0.900 ↑ 1.0 1 100

Index Scan using pessoa_cliente_pk on pessoa_cliente pesclides (cost=0.42..0.57 rows=1 width=23) (actual time=0.008..0.009 rows=1 loops=100)

  • Index Cond: ((cd_pessoa = pesdes.cd_pessoa) AND ((id_atividade)::text = 'CLIENT'::text))
35. 5.000 5.000 ↓ 1.1 122 100

Seq Scan on segmento segdes (cost=0.00..3.83 rows=111 width=29) (actual time=0.003..0.050 rows=122 loops=100)

  • Filter: ((id_atividade)::text = 'CLIENT'::text)
  • Rows Removed by Filter: 32
36. 0.700 0.700 ↓ 0.0 0 100

Index Only Scan using processo_canc_pk on processo_canc procan (cost=0.41..5.51 rows=1 width=24) (actual time=0.007..0.007 rows=0 loops=100)

  • Index Cond: ((cd_empresa = estdoc.cd_empresa) AND (cd_empresa = 30) AND (cd_base = estdoc.cd_base) AND (seq_processo = estdoc.seq_processo))
  • Heap Fetches: 0
37. 0.002 31.283 ↓ 0.0 0 1

Nested Loop Anti Join (cost=6.88..11,904.43 rows=1 width=296) (actual time=31.283..31.283 rows=0 loops=1)

38. 0.000 31.281 ↓ 0.0 0 1

Nested Loop Left Join (cost=6.47..11,893.74 rows=1 width=258) (actual time=31.281..31.281 rows=0 loops=1)

  • Join Filter: (((segrem.id_atividade)::text = (pesclirem.id_atividade)::text) AND (segrem.cd_segmento = pesclirem.cd_segmento))
39. 0.002 31.281 ↓ 0.0 0 1

Nested Loop Left Join (cost=6.47..11,888.25 rows=1 width=259) (actual time=31.281..31.281 rows=0 loops=1)

40. 0.000 31.279 ↓ 0.0 0 1

Nested Loop (cost=6.05..11,887.67 rows=1 width=252) (actual time=31.279..31.279 rows=0 loops=1)

  • Join Filter: ((pro_1.cd_produto_grupo)::text = (progru_1.cd_produto_grupo)::text)
41. 0.006 31.279 ↓ 0.0 0 1

Nested Loop (cost=6.05..11,862.38 rows=1 width=232) (actual time=31.279..31.279 rows=0 loops=1)

42. 0.013 31.213 ↓ 4.0 4 1

Nested Loop (cost=5.76..11,862.06 rows=1 width=198) (actual time=2.800..31.213 rows=4 loops=1)

43. 0.011 31.176 ↓ 4.0 4 1

Nested Loop (cost=5.48..11,861.74 rows=1 width=185) (actual time=2.789..31.176 rows=4 loops=1)

  • Join Filter: (pesendtiprem.seq_endereco = pesendrem.seq_endereco)
44. 0.015 31.121 ↓ 4.0 4 1

Nested Loop (cost=5.06..11,861.21 rows=1 width=193) (actual time=2.772..31.121 rows=4 loops=1)

  • Join Filter: (estdoc_1.cd_pessoa_remetente = pesrem.cd_pessoa)
45. 0.010 31.074 ↓ 4.0 4 1

Nested Loop (cost=4.64..11,860.68 rows=1 width=146) (actual time=2.758..31.074 rows=4 loops=1)

46. 0.017 31.016 ↓ 4.0 4 1

Nested Loop (cost=4.21..11,855.68 rows=1 width=130) (actual time=2.741..31.016 rows=4 loops=1)

  • Join Filter: ((pesati_1.dt_ativacao <= estdoc_1.dt_fiscal) AND ((pesati_1.dt_desativacao IS NULL) OR (pesati_1.dt_desativacao > estdoc_1.dt_fiscal)) AND (pesven_1.cd_pessoa = pesati_ (...)
47. 0.528 30.955 ↓ 4.0 4 1

Nested Loop (cost=3.79..11,855.18 rows=1 width=158) (actual time=2.722..30.955 rows=4 loops=1)

  • Join Filter: ((estdocitecom_1.cd_vendedor = pesven_1.cd_vendedor) AND (ped_1.cd_pessoa_interna = pesven_1.cd_pessoa))
  • Rows Removed by Join Filter: 2,844
48. 0.009 29.867 ↓ 4.0 4 1

Nested Loop (cost=3.79..11,830.53 rows=1 width=158) (actual time=2.643..29.867 rows=4 loops=1)

49. 0.017 29.822 ↓ 4.0 4 1

Nested Loop (cost=3.37..11,829.91 rows=1 width=126) (actual time=2.629..29.822 rows=4 loops=1)

50. 0.078 29.761 ↓ 4.0 4 1

Nested Loop (cost=2.95..11,829.13 rows=1 width=142) (actual time=2.610..29.761 rows=4 loops=1)

  • -> Index Only Scan using est_doc_item_comis_pk on est_doc_item_comis estdocitecom_1 (cost=0.56..0.79 rows=1 width=40) (actual time=0.013..0.013 rows=1 loops (...)
51. 0.013 29.683 ↓ 4.0 4 1

Nested Loop (cost=2.40..11,828.33 rows=1 width=214) (actual time=2.581..29.683 rows=4 loops=1)

  • Index Cond: ((cd_empresa = 30) AND (cd_base = estdociteori.cd_base) AND (seq_processo = estdociteori.seq_processo) AND (seq_item = estdociteori.seq_item (...)
  • Heap Fetches: 4
52. 0.050 29.626 ↓ 4.0 4 1

Nested Loop (cost=1.97..11,827.71 rows=1 width=166) (actual time=2.562..29.626 rows=4 loops=1)

  • -> Index Only Scan using est_doc_item_pk on est_doc_item estdociteori (cost=0.56..3.68 rows=1 width=32) (actual time=0.009..0.010 rows=1 loops=4 (...)
53. 0.075 29.576 ↓ 4.0 4 1

Nested Loop (cost=1.41..11,824.02 rows=1 width=142) (actual time=2.546..29.576 rows=4 loops=1)

  • Join Filter: ((estdoc_1.cd_base = estdocite_1.cd_base) AND (estdoc_1.seq_processo = estdocite_1.seq_processo))
  • -> Index Scan using est_doc_item_pk on est_doc_item estdocite_1 (cost=0.56..7.33 rows=1 width=88) (actual time=0.014..0.014 rows=1 loops=4 (...)
  • Index Cond: ((cd_empresa = 30) AND (cd_base = estdocoriite.cd_base_or) AND (seq_processo = estdocoriite.seq_processo_or) AND (seq_item = est (...)
  • Heap Fetches: 0
54. 0.064 29.501 ↓ 4.0 4 1

Nested Loop (cost=0.85..11,816.68 rows=1 width=110) (actual time=2.519..29.501 rows=4 loops=1)

  • -> Index Scan using est_doc_origem_item_idx2 on est_doc_origem_item estdocoriite (cost=0.43..8.45 rows=1 width=56) (actual time=0.01 (...)
  • Index Cond: ((cd_empresa = 30) AND (cd_base = estdocoriite.cd_base) AND (seq_processo = estdocoriite.seq_processo) AND (seq_item = est (...)
55. 27.963 29.437 ↑ 1.0 4 1

Nested Loop (cost=0.43..11,782.84 rows=4 width=54) (actual time=2.500..29.437 rows=4 loops=1)

  • Join Filter: (estdoc_1.cd_operacao_princ = opeest_1.cd_operacao)
  • Rows Removed by Join Filter: 8,840
  • -> Index Scan using est_documento_idx3 on est_documento estdoc_1 (cost=0.43..11761.19 rows=75 width=62) (actual time=0.179..25 (...)
  • Index Cond: ((dt_fiscal >= '2018-01-01'::date) AND (dt_fiscal <= '2018-01-31'::date))
  • Filter: ((id_situacao_eletronica = ANY ('{0,9}'::bpchar[])) AND (cd_empresa = 30) AND (cd_filial_operacao = 36) AND ((id_s (...)
  • Rows Removed by Filter: 21,023
  • Index Cond: ((cd_empresa = 30) AND (cd_base = estdoc_1.cd_base) AND (seq_processo = estdoc_1.seq_processo))
56. 1.386 1.474 ↑ 1.0 12 737

Materialize (cost=0.00..8.18 rows=12 width=8) (actual time=0.000..0.002 rows=12 loops=737)

57. 0.088 0.088 ↑ 1.0 12 1

Seq Scan on operacao_estoque opeest_1 (cost=0.00..8.12 rows=12 width=8) (actual time=0.027..0.088 rows=12 loops=1)

  • Filter: (((id_tipo_transacao)::text = 'DV'::text) AND (id_entrada_saida = 'E'::bpchar))
  • Rows Removed by Filter: 201
58. 0.044 0.044 ↑ 1.0 1 4

Index Scan using pedido_item_fat_idx1 on pedido_item_fat peditefat_1 (cost=0.42..0.62 rows=1 width=48) (actual time=0.010..0.011 rows=1 loops=4)

  • Index Cond: ((cd_empresa = 30) AND (cd_base_doc = estdociteori.cd_base) AND (seq_processo_doc = estdociteori.seq_processo) AND (seq_item_doc = est (...)
59. 0.044 0.044 ↑ 3.0 1 4

Index Scan using pedido_pk on pedido ped_1 (cost=0.42..0.75 rows=3 width=32) (actual time=0.011..0.011 rows=1 loops=4)

  • Index Cond: ((cd_empresa = 30) AND (cd_base = peditefat_1.cd_base) AND (seq_pedido = peditefat_1.seq_pedido))
60. 0.036 0.036 ↑ 1.0 1 4

Index Scan using pessoa_pk on pessoa pesvenpes_1 (cost=0.42..0.61 rows=1 width=32) (actual time=0.009..0.009 rows=1 loops=4)

  • Index Cond: (cd_pessoa = ped_1.cd_pessoa_interna)
61. 0.560 0.560 ↓ 1.0 712 4

Seq Scan on pessoa_vendedor pesven_1 (cost=0.00..14.06 rows=706 width=16) (actual time=0.007..0.140 rows=712 loops=4)

62. 0.044 0.044 ↑ 1.0 1 4

Index Scan using pessoa_atividade_pk on pessoa_atividade pesati_1 (cost=0.42..0.49 rows=1 width=16) (actual time=0.010..0.011 rows=1 loops=4)

  • Index Cond: ((cd_pessoa = pesvenpes_1.cd_pessoa) AND ((id_atividade)::text = 'VENDED'::text))
63. 0.048 0.048 ↑ 1.0 1 4

Index Only Scan using pessoa_endereco_tipo_pk on pessoa_endereco_tipo pesendtiprem (cost=0.42..4.99 rows=1 width=16) (actual time=0.011..0.012 rows=1 loops=4)

  • Index Cond: ((cd_pessoa = estdoc_1.cd_pessoa_remetente) AND (id_tipo_endereco = 'PRI'::text))
  • Heap Fetches: 1
64. 0.032 0.032 ↑ 1.0 1 4

Index Scan using pessoa_pk on pessoa pesrem (cost=0.42..0.52 rows=1 width=47) (actual time=0.008..0.008 rows=1 loops=4)

  • Index Cond: (cd_pessoa = pesendtiprem.cd_pessoa)
65. 0.044 0.044 ↑ 1.0 1 4

Index Scan using pessoa_endereco_pk on pessoa_endereco pesendrem (cost=0.42..0.52 rows=1 width=24) (actual time=0.010..0.011 rows=1 loops=4)

  • Index Cond: (cd_pessoa = pesrem.cd_pessoa)
66. 0.024 0.024 ↑ 1.0 1 4

Index Scan using localidade_pk on localidade locrem (cost=0.29..0.30 rows=1 width=29) (actual time=0.006..0.006 rows=1 loops=4)

  • Index Cond: (cd_localidade = pesendrem.cd_localidade)
67. 0.060 0.060 ↓ 0.0 0 4

Index Scan using produto_pk on produto pro_1 (cost=0.29..0.31 rows=1 width=40) (actual time=0.015..0.015 rows=0 loops=4)

  • Index Cond: ((cd_produto)::text = (estdocite_1.cd_produto)::text)
  • Filter: ((cd_produto_grupo)::text ~~ '0172'::text)
  • Rows Removed by Filter: 1
68. 0.000 0.000 ↓ 0.0 0

Seq Scan on produto_grupo progru_1 (cost=0.00..17.91 rows=591 width=27) (never executed)

69. 0.000 0.000 ↓ 0.0 0

Index Scan using pessoa_cliente_pk on pessoa_cliente pesclirem (cost=0.42..0.57 rows=1 width=23) (never executed)

  • Index Cond: ((cd_pessoa = pesrem.cd_pessoa) AND ((id_atividade)::text = 'CLIENT'::text))
70. 0.000 0.000 ↓ 0.0 0

Seq Scan on segmento segrem (cost=0.00..3.83 rows=111 width=29) (never executed)

  • Filter: ((id_atividade)::text = 'CLIENT'::text)
71. 0.000 0.000 ↓ 0.0 0

Index Only Scan using processo_canc_pk on processo_canc procan_1 (cost=0.41..5.51 rows=1 width=24) (never executed)

  • Index Cond: ((cd_empresa = estdoc_1.cd_empresa) AND (cd_empresa = 30) AND (cd_base = estdoc_1.cd_base) AND (seq_processo = estdoc_1.seq_processo))
  • Heap Fetches: 0
Planning time : 316.015 ms
Execution time : 13,424.668 ms