explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.038 27,999.266 ↓ 0.0 0 1

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

2. 0.014 27,998.941 ↑ 7.1 7 1

Limit (cost=18,721.64..57,373.51 rows=50 width=60) (actual time=12,757.247..27,998.941 rows=7 loops=1)

3. 0.042 27,998.927 ↑ 33.0 7 1

Nested Loop (cost=18,721.64..197,293.31 rows=231 width=60) (actual time=12,757.244..27,998.927 rows=7 loops=1)

  • Join Filter: (ne.emp_codigo = a.emp_codigo)
4. 0.041 27,998.822 ↑ 26.3 7 1

Nested Loop (cost=18,721.49..196,838.54 rows=184 width=68) (actual time=12,757.231..27,998.822 rows=7 loops=1)

5. 0.101 27,998.389 ↑ 39.1 7 1

Nested Loop (cost=18,720.93..195,547.78 rows=274 width=118) (actual time=12,757.175..27,998.389 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. 1,146.582 27,997.896 ↑ 102.1 7 1

Nested Loop (cost=18,720.36..192,106.26 rows=715 width=81) (actual time=12,757.087..27,997.896 rows=7 loops=1)

7. 543.955 1,622.162 ↓ 43.1 788,411 1

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

  • Hash Cond: (ne.emp_codigo = b.emp_codigo)
8. 861.662 1,077.945 ↑ 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=268.358..1,077.945 rows=988,343 loops=1)

  • Recheck Cond: (export_impnfe = 1)
  • Heap Blocks: exact=118,751
9. 216.283 216.283 ↑ 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=216.283..216.283 rows=988,343 loops=1)

  • Index Cond: (export_impnfe = 1)
10. 0.035 0.262 ↓ 1.2 57 1

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

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

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

  • Filter: (((exp_tipo)::text = 'IMPNFE_GERAL_ANTIGO'::text) AND ((exp_modo)::text = 'DATA'::text))
  • Rows Removed by Filter: 171
12. 25,229.152 25,229.152 ↓ 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.032..0.032 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.392 0.392 ↑ 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.056..0.056 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.392 0.392 ↑ 1.0 1 7

Index Scan using pk_nfe on nfe n (cost=0.56..4.66 rows=1 width=37) (actual time=0.056..0.056 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.287 0.287 ↓ 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.041..0.041 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))