explain.depesz.com

PostgreSQL's explain analyze made readable

Result: eUD4 : Optimization for: plan #aFiR

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.020 3,826.023 ↑ 1.0 50 1

Limit (cost=2.12..24,972.06 rows=50 width=49) (actual time=3,819.659..3,826.023 rows=50 loops=1)

2. 0.073 3,826.003 ↑ 200.6 50 1

Nested Loop (cost=2.12..5,009,971.42 rows=10,032 width=49) (actual time=3,819.656..3,826.003 rows=50 loops=1)

3. 0.162 3,823.930 ↑ 299.3 50 1

Nested Loop (cost=1.56..4,939,470.67 rows=14,966 width=99) (actual time=3,819.605..3,823.930 rows=50 loops=1)

  • Join Filter: (((ne.cnpj_emitente)::text = (ni.cnpj_emitente)::text) AND ((ne.mod)::text = (ni.mod)::text) AND (ne.numero = ni.numero) AND (ne.serie = ni.serie) AND (ne.tpamb = ni.tpamb))
4. 136.048 3,821.768 ↑ 780.9 50 1

Nested Loop (cost=0.99..4,751,527.53 rows=39,047 width=62) (actual time=3,819.541..3,821.768 rows=50 loops=1)

5. 103.972 103.972 ↑ 10.0 99,493 1

Index Scan using idx_nfe_empresa_export_impnfe on nfe_empresa ne (cost=0.44..240,004.72 rows=999,143 width=33) (actual time=0.033..103.972 rows=99,493 loops=1)

  • Index Cond: (export_impnfe = 1)
6. 3,581.748 3,581.748 ↓ 0.0 0 99,493

Index Scan using pk_nfe_evento on nfe_evento nv (cost=0.56..4.47 rows=1 width=29) (actual time=0.036..0.036 rows=0 loops=99,493)

  • Index Cond: (((cnpj_emitente)::text = (ne.cnpj_emitente)::text) AND (numero = ne.numero) AND (serie = ne.serie) AND (tpamb = ne.tpamb) AND ((mod)::text = (ne.mod)::text))
  • Filter: (export_impnfe = 0)
  • Rows Removed by Filter: 0
7. 2.000 2.000 ↑ 1.0 1 50

Index Scan using pk_nfe_ident on nfe_ident ni (cost=0.56..4.75 rows=1 width=37) (actual time=0.040..0.040 rows=1 loops=50)

  • Index Cond: (((cnpj_emitente)::text = (nv.cnpj_emitente)::text) AND (numero = nv.numero) AND (serie = nv.serie) AND (tpamb = nv.tpamb) AND ((mod)::text = (nv.mod)::text))
8. 2.000 2.000 ↑ 1.0 1 50

Index Scan using pk_nfe on nfe n (cost=0.56..4.66 rows=1 width=37) (actual time=0.039..0.040 rows=1 loops=50)

  • Index Cond: (((cnpj_emitente)::text = (ni.cnpj_emitente)::text) AND (numero = ni.numero) AND (serie = ni.serie) AND (tpamb = ni.tpamb) AND ((mod)::text = (ni.mod)::text))
  • Filter: ((versao)::text = ANY ('{3.10,4.00}'::text[]))