explain.depesz.com

PostgreSQL's explain analyze made readable

Result: r6o4

Settings
# exclusive inclusive rows x rows loops node
1. 9.538 3,051.487 ↓ 100,000.0 100,000 1

Limit (cost=7.04..593.51 rows=1 width=680) (actual time=20.186..3,051.487 rows=100,000 loops=1)

2. 112.878 3,041.949 ↓ 100,000.0 100,000 1

Nested Loop (cost=7.04..593.51 rows=1 width=680) (actual time=20.184..3,041.949 rows=100,000 loops=1)

3. 15.623 2,529.071 ↓ 100,000.0 100,000 1

Nested Loop (cost=6.76..589.67 rows=1 width=507) (actual time=20.138..2,529.071 rows=100,000 loops=1)

4. 110.626 1,813.448 ↓ 100,000.0 100,000 1

Nested Loop (cost=6.33..581.22 rows=1 width=538) (actual time=20.097..1,813.448 rows=100,000 loops=1)

  • Join Filter: (((b.codigoempresa)::text = (c.codigoempresa)::text) AND (b.tipoestoque = c.tipoestoque) AND ((b.codigo)::text = (c.codigoproduto)::text))
5. 27.866 537.779 ↓ 105,913.0 105,913 1

Nested Loop (cost=5.77..575.64 rows=1 width=551) (actual time=0.299..537.779 rows=105,913 loops=1)

6. 10.785 106.809 ↓ 456.0 31,008 1

Nested Loop (cost=5.34..289.27 rows=68 width=353) (actual time=0.243..106.809 rows=31,008 loops=1)

  • Join Filter: ((d.codempresa)::text = (b.codigoempresa)::text)
7. 0.034 0.120 ↓ 36.0 36 1

Nested Loop (cost=0.00..19.24 rows=1 width=82) (actual time=0.078..0.120 rows=36 loops=1)

  • Join Filter: ((d.codempresa)::text = (i.codigoempresa)::text)
8. 0.057 0.057 ↑ 1.0 1 1

Seq Scan on filial d (cost=0.00..13.53 rows=1 width=59) (actual time=0.057..0.057 rows=1 loops=1)

  • Filter: ((codfilial)::text = '61'::text)
  • Rows Removed by Filter: 6
9. 0.029 0.029 ↑ 4.6 36 1

Seq Scan on unidademedida i (cost=0.00..3.65 rows=165 width=23) (actual time=0.014..0.029 rows=36 loops=1)

10. 49.824 95.904 ↓ 7.6 861 36

Bitmap Heap Scan on produto b (cost=5.34..268.62 rows=113 width=271) (actual time=1.370..2.664 rows=861 loops=36)

  • Recheck Cond: (((codigoempresa)::text = (i.codigoempresa)::text) AND ((unidademedida)::text = (i.sigla)::text))
  • Filter: ((idunidademedida IS NOT NULL) AND (idfamiliaproduto IS NOT NULL) AND (idclassificacaofiscal IS NOT NULL) AND ((nomeecf)::text <> ''::text))
  • Rows Removed by Filter: 3
  • Heap Blocks: exact=5,829
11. 46.080 46.080 ↓ 104.9 11,856 36

Bitmap Index Scan on ix_produto_codigoempresa_unidademedida (cost=0.00..5.31 rows=113 width=0) (actual time=1.280..1.280 rows=11,856 loops=36)

  • Index Cond: (((codigoempresa)::text = (i.codigoempresa)::text) AND ((unidademedida)::text = (i.sigla)::text))
12. 403.104 403.104 ↓ 3.0 3 31,008

Index Scan using ix_produtovariacao_codigoempresa_tipoestoque_codigoproduto on produtovariacao a (cost=0.43..4.20 rows=1 width=198) (actual time=0.011..0.013 rows=3 loops=31,008)

  • Index Cond: (((codigoempresa)::text = (b.codigoempresa)::text) AND (tipoestoque = b.tipoestoque) AND ((codigoproduto)::text = (b.codigo)::text))
13. 1,165.043 1,165.043 ↑ 1.0 1 105,913

Index Scan using ix_preco_codigoempresa_tipoestoque_codigoproduto_codigofilial on preco c (cost=0.56..5.56 rows=1 width=104) (actual time=0.011..0.011 rows=1 loops=105,913)

  • Index Cond: (((codigoempresa)::text = (a.codigoempresa)::text) AND (tipoestoque = a.tipoestoque) AND ((codigoproduto)::text = (a.codigoproduto)::text) AND ((codigofilial)::text = '61'::text))
14. 700.000 700.000 ↑ 1.0 1 100,000

Index Only Scan using ix_cep_cep_codigocidade on cep e (cost=0.43..8.45 rows=1 width=15) (actual time=0.006..0.007 rows=1 loops=100,000)

  • Index Cond: (cep = (d.codigocep)::text)
  • Heap Fetches: 100,000
15. 400.000 400.000 ↑ 1.0 1 100,000

Index Scan using ix_cidade_codigo on cidade f (cost=0.28..3.79 rows=1 width=9) (actual time=0.004..0.004 rows=1 loops=100,000)

  • Index Cond: ((codigo)::text = (e.codigocidade)::text)
Planning time : 23.130 ms
Execution time : 3,057.014 ms