explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 4tRy

Settings
# exclusive inclusive rows x rows loops node
1. 0.938 171,428.707 ↑ 1.3 57 1

Unique (cost=1.00..202,936.10 rows=73 width=4) (actual time=6,705.202..171,428.707 rows=57 loops=1)

  • Buffers: shared hit=528091 read=158885
2. 9.163 171,427.769 ↓ 18.0 1,314 1

Nested Loop (cost=1.00..202,935.92 rows=73 width=4) (actual time=6,705.200..171,427.769 rows=1,314 loops=1)

  • Join Filter: (fi.cod_filial = iv.cod_filial)
  • Rows Removed by Join Filter: 19710
  • Buffers: shared hit=528091 read=158885
3. 305.989 171,394.954 ↓ 18.0 1,314 1

Nested Loop (cost=1.00..202,915.95 rows=73 width=16) (actual time=6,685.240..171,394.954 rows=1,314 loops=1)

  • Buffers: shared hit=528091 read=158883
4. 165.419 153,061.821 ↓ 12.6 166,918 1

Nested Loop (cost=0.58..195,902.05 rows=13,268 width=16) (actual time=25.840..153,061.821 rows=166,918 loops=1)

  • Buffers: shared hit=20024 read=149041
5. 1.639 1.639 ↑ 1.0 113 1

Index Scan using cadprodu_tmp_1106_idx on cadprodu pr (cost=0.14..468.79 rows=116 width=8) (actual time=0.038..1.639 rows=113 loops=1)

  • Index Cond: (cod_laborat = 1349)
  • Filter: (cod_rede = 1)
  • Buffers: shared read=110
6. 152,894.763 152,894.763 ↓ 1.4 1,477 113

Index Scan using fki_cadivend_cod_reduzido_fkey on cadivend iv (cost=0.43..1,674.52 rows=1,025 width=16) (actual time=15.971..1,353.051 rows=1,477 loops=113)

  • Index Cond: ((cod_rede = 1) AND (cod_reduzido = pr.cod_reduzido))
  • Filter: ((flg_excluido <> 'S'::bpchar) OR (flg_excluido IS NULL))
  • Rows Removed by Filter: 85
  • Buffers: shared hit=20024 read=148931
7. 18,027.144 18,027.144 ↓ 0.0 0 166,918

Index Scan using cadcvend_tmp_1106_idx on cadcvend cv (cost=0.42..0.52 rows=1 width=12) (actual time=0.106..0.108 rows=0 loops=166,918)

  • Index Cond: ((num_nota = iv.num_nota) AND (dat_emissao >= '2018-09-18'::date) AND (dat_emissao <= '2018-12-18'::date))
  • Filter: (((flg_excluido <> 'S'::bpchar) OR (flg_excluido IS NULL)) AND (cod_rede = 1) AND (flg_sitcaixa = '2'::bpchar) AND (iv.cod_filial = cod_filial) AND (cod_filial = ANY ('{1,5,8,10}'::integer[])) AND ((tip_venda = 'V'::bpchar) OR (tip_venda = 'D'::bpchar)))
  • Rows Removed by Filter: 0
  • Buffers: shared hit=508067 read=9842
8. 3.697 23.652 ↑ 1.0 16 1,314

Materialize (cost=0.00..2.49 rows=16 width=8) (actual time=0.016..0.018 rows=16 loops=1,314)

  • Buffers: shared read=2
9. 0.168 19.955 ↑ 1.0 16 1

Nested Loop (cost=0.00..2.41 rows=16 width=8) (actual time=19.929..19.955 rows=16 loops=1)

  • Join Filter: (fi.cod_grfilial = grf.cod_grfilial)
  • Buffers: shared read=2
10. 11.888 11.888 ↑ 1.0 1 1

Seq Scan on cadgrfil grf (cost=0.00..1.01 rows=1 width=8) (actual time=11.887..11.888 rows=1 loops=1)

  • Filter: (cod_rede = 1)
  • Buffers: shared read=1
11. 7.899 7.899 ↑ 1.0 16 1

Seq Scan on cadfilia fi (cost=0.00..1.20 rows=16 width=12) (actual time=7.893..7.899 rows=16 loops=1)

  • Filter: (cod_rede = 1)
  • Buffers: shared read=1