explain.depesz.com

PostgreSQL's explain analyze made readable

Result: s4CS : Optimization for: Optimization for: plan #aFiR; plan #eUD4

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.036 28,359.949 ↓ 0.0 0 1

Nested Loop (cost=18,722.19..57,810.76 rows=1 width=67) (actual time=28,359.949..28,359.949 rows=0 loops=1)

2. 0.014 28,359.654 ↑ 7.1 7 1

Limit (cost=18,721.64..57,373.51 rows=50 width=60) (actual time=13,314.840..28,359.654 rows=7 loops=1)

3. 0.040 28,359.640 ↑ 33.0 7 1

Nested Loop (cost=18,721.64..197,293.31 rows=231 width=60) (actual time=13,314.837..28,359.640 rows=7 loops=1)

  • Join Filter: (ne.emp_codigo = a.emp_codigo)
4. 0.039 28,359.537 ↑ 26.3 7 1

Nested Loop (cost=18,721.49..196,838.54 rows=184 width=68) (actual time=13,314.823..28,359.537 rows=7 loops=1)

5. 0.088 28,359.120 ↑ 39.1 7 1

Nested Loop (cost=18,720.93..195,547.78 rows=274 width=118) (actual time=13,314.765..28,359.120 rows=7 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))
6. 660.934 28,358.647 ↑ 102.1 7 1

Nested Loop (cost=18,720.36..192,106.26 rows=715 width=81) (actual time=13,314.672..28,358.647 rows=7 loops=1)

7. 567.098 1,680.150 ↓ 43.1 788,411 1

Hash Join (cost=18,719.81..109,482.66 rows=18,298 width=41) (actual time=281.364..1,680.150 rows=788,411 loops=1)

  • Hash Cond: (ne.emp_codigo = b.emp_codigo)
8. 886.981 1,112.889 ↑ 1.0 988,343 1

Bitmap Heap Scan on nfe_empresa ne (cost=18,703.80..102,307.10 rows=999,143 width=33) (actual time=281.172..1,112.889 rows=988,343 loops=1)

  • Recheck Cond: (export_impnfe = 1)
  • Heap Blocks: exact=118,751
9. 225.908 225.908 ↑ 1.0 988,343 1

Bitmap Index Scan on idx_nfe_empresa_export_impnfe (cost=0.00..18,454.01 rows=999,143 width=0) (actual time=225.908..225.908 rows=988,343 loops=1)

  • Index Cond: (export_impnfe = 1)
10. 0.022 0.163 ↓ 1.2 57 1

Hash (cost=13.44..13.44 rows=49 width=8) (actual time=0.163..0.163 rows=57 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 3kB
11. 0.141 0.141 ↓ 1.2 57 1

Seq Scan on app_exportacao_aut b (cost=0.00..13.44 rows=49 width=8) (actual time=0.022..0.141 rows=57 loops=1)

  • Filter: (((exp_tipo)::text = 'IMPNFE_GERAL_ANTIGO'::text) AND ((exp_modo)::text = 'DATA'::text))
  • Rows Removed by Filter: 171
12. 26,017.563 26,017.563 ↓ 0.0 0 788,411

Index Scan using pk_nfe_evento on nfe_evento nv (cost=0.56..4.47 rows=1 width=40) (actual time=0.033..0.033 rows=0 loops=788,411)

  • 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
13. 0.385 0.385 ↑ 1.0 1 7

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

  • 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))
14. 0.378 0.378 ↑ 1.0 1 7

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

  • 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[]))
15. 0.063 0.063 ↑ 1.0 1 7

Index Scan using pk_conexao on app_acesso_externo a (cost=0.15..2.42 rows=1 width=8) (actual time=0.009..0.009 rows=1 loops=7)

  • Index Cond: ((emp_codigo = b.emp_codigo) AND (access_id = b.access_id))
  • Filter: ((access_tipo)::text = 'DATABASE'::text)
16. 0.259 0.259 ↓ 0.0 0 7

Index Scan using pk_nfe_evento_xml on nfe_evento_xml nx (cost=0.56..8.65 rows=1 width=58) (actual time=0.037..0.037 rows=0 loops=7)

  • Index Cond: (((cnpj_emitente)::text = (n.cnpj_emitente)::text) AND (numero = n.numero) AND (serie = n.serie) AND (tpamb = n.tpamb) AND ((mod)::text = (n.mod)::text) AND ((eve_tipo_evento)::text = (nv.eve_tipo_evento)::text) AND (eve_nseq_evento = nv.eve_nseq_evento))