explain.depesz.com

PostgreSQL's explain analyze made readable

Result: uK13

Settings
# exclusive inclusive rows x rows loops node
1. 0.007 542.702 ↓ 0.0 0 1

Hash Anti Join (cost=10,782.73..26,195.79 rows=12,291 width=96) (actual time=542.700..542.702 rows=0 loops=1)

  • Hash Cond: (((a.cod_mod)::text = (b.mod)::text) AND ((a.emit_cpf_cnpj)::text = (b.cpf_cnpj)::text) AND (a.n_nf = b.n_nf) AND ((a.serie)::text = (b.ser)::text))
2. 57.890 542.695 ↓ 0.0 0 1

Hash Anti Join (cost=5,540.15..20,326.99 rows=12,353 width=78) (actual time=542.693..542.695 rows=0 loops=1)

  • Hash Cond: (((a.cod_mod)::text = (b_1.mod)::text) AND ((a.cnpj_chave)::text = (b_1.cnpj_chave)::text) AND (a.n_nf = b_1.n_nf) AND ((a.serie)::text = (b_1.ser)::text))
3. 155.889 157.527 ↑ 1.2 10,340 1

Bitmap Heap Scan on consulta_nfe_sefaz a (cost=297.57..14,450.80 rows=12,415 width=93) (actual time=1.790..157.527 rows=10,340 loops=1)

  • Recheck Cond: (id_empresa = 12)
  • Filter: ((d_emi >= '2020-01-01'::date) AND (d_emi <= '2020-09-30'::date) AND ((emit_cpf_cnpj)::text <> '04084183000121'::text) AND ((cod_mod)::text = '55'::text) AND (pesquisa_fts @@ to_tsquery('autorizada'::text)))
  • Rows Removed by Filter: 1,797
  • Heap Blocks: exact=490
4. 1.638 1.638 ↑ 1.1 12,137 1

Bitmap Index Scan on idx_id_empresa_on_consulta_nfe_sefaz (cost=0.00..294.47 rows=13,073 width=0) (actual time=1.636..1.638 rows=12,137 loops=1)

  • Index Cond: (id_empresa = 12)
5. 111.425 327.278 ↓ 20.5 25,052 1

Hash (cost=5,218.08..5,218.08 rows=1,225 width=24) (actual time=327.276..327.278 rows=25,052 loops=1)

  • Buckets: 32,768 (originally 2048) Batches: 1 (originally 1) Memory Usage: 1,653kB
6. 215.853 215.853 ↓ 20.5 25,052 1

Index Scan using raiz_nfe_dest_cpf_cnpj_cpf_cnpj_n_nf_serie_mod_idx on raiz_nfe b_1 (cost=0.56..5,218.08 rows=1,225 width=24) (actual time=0.061..215.853 rows=25,052 loops=1)

  • Index Cond: (((dest_cpf_cnpj)::text = '04084183000121'::text) AND ((mod)::text = '55'::text))
  • Filter: ((dest_cpf_cnpj)::text <> (cpf_cnpj)::text)
  • Rows Removed by Filter: 2,916
7. 0.000 0.000 ↓ 0.0 0

Hash (cost=5,218.08..5,218.08 rows=1,225 width=23) (never executed)

8. 0.000 0.000 ↓ 0.0 0

Index Scan using raiz_nfe_dest_cpf_cnpj_cpf_cnpj_n_nf_serie_mod_idx on raiz_nfe b (cost=0.56..5,218.08 rows=1,225 width=23) (never executed)

  • Index Cond: (((dest_cpf_cnpj)::text = '04084183000121'::text) AND ((mod)::text = '55'::text))
  • Filter: ((dest_cpf_cnpj)::text <> (cpf_cnpj)::text)
Planning time : 6.096 ms
Execution time : 542.930 ms