explain.depesz.com

PostgreSQL's explain analyze made readable

Result: dFou

Settings
# exclusive inclusive rows x rows loops node
1. 0.005 530.397 ↓ 0.0 0 1

Hash Anti Join (cost=10,784.87..26,283.45 rows=12,553 width=96) (actual time=530.396..530.397 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.380 530.392 ↓ 0.0 0 1

Hash Anti Join (cost=5,542.29..20,409.27 rows=12,615 width=78) (actual time=530.391..530.392 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. 150.191 151.881 ↑ 1.2 10,340 1

Bitmap Heap Scan on consulta_nfe_sefaz a (cost=299.71..14,527.72 rows=12,677 width=93) (actual time=1.841..151.881 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.690 1.690 ↑ 1.1 12,137 1

Bitmap Index Scan on idx_id_empresa_on_consulta_nfe_sefaz (cost=0.00..296.54 rows=13,349 width=0) (actual time=1.689..1.690 rows=12,137 loops=1)

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

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

  • Buckets: 32,768 (originally 2048) Batches: 1 (originally 1) Memory Usage: 1,653kB
6. 206.938 206.938 ↓ 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.063..206.938 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.037 ms
Execution time : 530.558 ms