explain.depesz.com

PostgreSQL's explain analyze made readable

Result: w9wY

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=158,521.11..161,039.44 rows=7,247 width=993) (actual rows= loops=)

  • Group Key: (CASE WHEN (COALESCE(pr.flg_cdbarnfe, 'N'::bpchar) <> 'S'::bpchar) THEN cod_barra(pr.*) ELSE NULL::numeric END), pr.cod_reduzido, pr.nom_produto, pr.cod_clafiscal, pr.cod_cest, (COALESCE(pr.cod_unidade, 'UN'::character varying)), (CASE WHEN (( (...)
2. 0.000 0.000 ↓ 0.0

Sort (cost=158,521.11..158,539.23 rows=7,247 width=993) (actual rows= loops=)

  • Sort Key: (CASE WHEN (COALESCE(pr.flg_cdbarnfe, 'N'::bpchar) <> 'S'::bpchar) THEN cod_barra(pr.*) ELSE NULL::numeric END), pr.cod_reduzido, pr.nom_produto, pr.cod_clafiscal, pr.cod_cest, (COALESCE(pr.cod_unidade, 'UN'::character varying)), (CASE WH (...)
3. 0.000 0.000 ↓ 0.0

Nested Loop (cost=10,188.93..154,885.46 rows=7,247 width=993) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Hash Join (cost=10,188.65..150,697.88 rows=7,247 width=45) (actual rows= loops=)

  • Hash Cond: (iv.prc_icms = ie.cod_sittrib)
5. 0.000 0.000 ↓ 0.0

Nested Loop (cost=10,179.98..150,316.77 rows=47,995 width=68) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Nested Loop (cost=10,179.55..69,541.85 rows=17,185 width=32) (actual rows= loops=)

  • Join Filter: ((cv.num_cupom >= ce.num_cooinic) AND (cv.num_cupom <= ce.num_coofim))
7. 0.000 0.000 ↓ 0.0

Index Scan using cadcecfi_pkey on cadcecfi ce (cost=0.28..8.31 rows=1 width=24) (actual rows= loops=)

  • Index Cond: ((cod_rede = 1) AND (cod_filial = 1) AND (num_ecf = 3) AND (dat_emissao = '2019-10-08'::date))
  • Filter: ((num_serie)::text = 'BE091410100011233061'::text)
8. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on cadcvend cv (cost=10,179.26..67,213.58 rows=154,664 width=20) (actual rows= loops=)

  • Recheck Cond: ((cod_rede = 1) AND (cod_filial = 1) AND (num_ecf = 3) AND (tip_venda = 'V'::bpchar))
  • Filter: (num_cupom IS NOT NULL)
9. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx_cadcvend_reducao_z (cost=0.00..10,140.60 rows=174,466 width=0) (actual rows= loops=)

  • Index Cond: ((cod_rede = 1) AND (cod_filial = 1) AND (num_ecf = 3) AND (tip_venda = 'V'::bpchar))
10. 0.000 0.000 ↓ 0.0

Index Scan using fki_cadivend_num_nota_fkey on cadivend iv (cost=0.43..4.59 rows=11 width=52) (actual rows= loops=)

  • Index Cond: ((cod_rede = 1) AND (cod_filial = 1) AND (num_nota = cv.num_nota))
11. 0.000 0.000 ↓ 0.0

Hash (cost=8.63..8.63 rows=3 width=21) (actual rows= loops=)

12. 0.000 0.000 ↓ 0.0

Index Scan using idx_cadiecfi_dat_emissao on cadiecfi ie (cost=0.29..8.63 rows=3 width=21) (actual rows= loops=)

  • Index Cond: (dat_emissao = '2019-10-08'::date)
  • Filter: ((cod_filial = 1) AND (cod_rede = 1) AND (num_ecf = 3))
13. 0.000 0.000 ↓ 0.0

Index Scan using cadprodu_pkey on cadprodu pr (cost=0.29..0.31 rows=1 width=960) (actual rows= loops=)

  • Index Cond: ((cod_rede = 1) AND (cod_reduzido = iv.cod_reduzido))