explain.depesz.com

PostgreSQL's explain analyze made readable

Result: dwN6

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 6.586 ↓ 0.0 0 1

HashAggregate (cost=94.73..94.75 rows=1 width=204) (actual time=6.586..6.586 rows=0 loops=1)

  • Group Key: recmerc.recm_transacao, recmerc.recm_codentidade, movfiscal.mfis_catentidade, CASE recmerc.recm_catentidade WHEN 'F'::text THEN fornecedores.forn_razaosocial ELSE unidades.unid_nome END, CASE recmerc.recm_catentidade WHEN 'F'::text THEN fornecedores.forn_cnpjcpf ELSE unidades.unid_cnpj END, recmerc.recm_data, recmerc.recm_unid_codigo, recmerc.recm_usua_codigo, usuarios.usua_nome, recmerc.recm_horaini, recmerc.recm_dcto, (CASE movprodc.mprc_nfprodutor WHEN '0'::text THEN movdctos.mdoc_numerodcto ELSE movprodc.mprc_nfprodutor END), movdctos.mdoc_valor, movdctos.mdoc_transacao
2. 0.002 6.584 ↓ 0.0 0 1

Nested Loop Left Join (cost=71.20..94.69 rows=1 width=204) (actual time=6.584..6.584 rows=0 loops=1)

3. 0.000 6.582 ↓ 0.0 0 1

Nested Loop Left Join (cost=70.93..90.39 rows=1 width=183) (actual time=6.582..6.582 rows=0 loops=1)

  • Join Filter: ((unidades.unid_codigo)::numeric = recmerc.recm_codentidade)
4. 0.002 6.582 ↓ 0.0 0 1

Nested Loop Left Join (cost=70.93..89.14 rows=1 width=134) (actual time=6.582..6.582 rows=0 loops=1)

  • Join Filter: (((recmerc.recm_dcto)::text ~~ concat('%', CASE movprodc.mprc_nfprodutor WHEN '0'::text THEN movdctos.mdoc_numerodcto ELSE movprodc.mprc_nfprodutor END, '%')) AND (CASE recmerc.recm_catentidade WHEN 'U'::text THEN recmerc.recm_codentidade ELSE CASE fornecedores.forn_codvinc WHEN 0::numeric THEN fornecedores.forn_codigo ELSE fornecedores.forn_codvinc END END = CASE movfiscal.mfis_catentidade WHEN 'U'::text THEN movfiscal.mfis_codentidade ELSE CASE fornecedores_1.forn_codvinc WHEN 0::numeric THEN fornecedores_1.forn_codigo ELSE fornecedores_1.forn_codvinc END END))
5. 0.001 6.580 ↓ 0.0 0 1

Nested Loop Left Join (cost=0.71..8.78 rows=1 width=100) (actual time=6.580..6.580 rows=0 loops=1)

6. 6.579 6.579 ↓ 0.0 0 1

Index Scan using recm_data_idx on recmerc (cost=0.43..4.47 rows=1 width=49) (actual time=6.579..6.579 rows=0 loops=1)

  • Index Cond: ((recm_data >= '2019-03-06'::date) AND (recm_data <= '2019-03-06'::date))
  • Filter: (((recm_dcto)::text = '2512'::text) AND ((recm_status)::text = 'N'::text) AND ((recm_unid_codigo)::text = ANY ('{001,002,003,004,005,006,007,008,009}'::text[])))
  • Rows Removed by Filter: 5011
7. 0.000 0.000 ↓ 0.0 0

Index Scan using forn_codigo_idx on fornecedores (cost=0.28..4.30 rows=1 width=51) (never executed)

  • Index Cond: (forn_codigo = recmerc.recm_codentidade)
8. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=70.22..80.33 rows=1 width=67) (never executed)

9. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=69.79..75.87 rows=1 width=41) (never executed)

10. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=69.51..75.56 rows=1 width=31) (never executed)

11. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on movdctos (cost=69.08..71.11 rows=1 width=23) (never executed)

  • Recheck Cond: (((mdoc_numerodcto)::text = '2512'::text) AND (mdoc_datamvto >= '2019-03-03'::date) AND (mdoc_datamvto <= '2019-03-06'::date))
  • Filter: (((mdoc_status)::text = 'N'::text) AND ((mdoc_dcto_tipo)::text = ANY ('{EET,EAQ,EEC,EBR,EOE}'::text[])))
12. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=69.08..69.08 rows=1 width=0) (never executed)

13. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on mdoc_numerodcto_idx (cost=0.00..2.72 rows=39 width=0) (never executed)

  • Index Cond: ((mdoc_numerodcto)::text = '2512'::text)
14. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on mdoc_datamvto_idx (cost=0.00..66.11 rows=3,968 width=0) (never executed)

  • Index Cond: ((mdoc_datamvto >= '2019-03-03'::date) AND (mdoc_datamvto <= '2019-03-06'::date))
15. 0.000 0.000 ↓ 0.0 0

Index Scan using mfis_transacao_idx on movfiscal (cost=0.43..4.45 rows=1 width=20) (never executed)

  • Index Cond: ((mfis_transacao)::text = (movdctos.mdoc_transacao)::text)
16. 0.000 0.000 ↓ 0.0 0

Index Scan using forn_codigo_idx on fornecedores fornecedores_1 (cost=0.28..0.30 rows=1 width=10) (never executed)

  • Index Cond: (movfiscal.mfis_codentidade = forn_codigo)
17. 0.000 0.000 ↓ 0.0 0

Index Scan using mprc_transacao_idx on movprodc (cost=0.43..4.45 rows=1 width=14) (never executed)

  • Index Cond: ((mprc_transacao)::text = (movdctos.mdoc_transacao)::text)
  • Filter: (((mprc_dcto_codigo)::text <> '7128'::text) AND ((mprc_status)::text = 'N'::text))
18. 0.000 0.000 ↓ 0.0 0

Seq Scan on unidades (cost=0.00..1.09 rows=9 width=53) (never executed)

19. 0.000 0.000 ↓ 0.0 0

Index Scan using usua_codigo_idx on usuarios (cost=0.27..4.29 rows=1 width=26) (never executed)

  • Index Cond: (recmerc.recm_usua_codigo = usua_codigo)