explain.depesz.com

PostgreSQL's explain analyze made readable

Result: FAd

Settings
# exclusive inclusive rows x rows loops node
1. 0.007 155.573 ↓ 10.0 10 1

Limit (cost=238.56..238.57 rows=1 width=81) (actual time=155.566..155.573 rows=10 loops=1)

2. 0.600 155.566 ↓ 18.0 18 1

Sort (cost=238.56..238.56 rows=1 width=81) (actual time=155.565..155.566 rows=18 loops=1)

  • Sort Key: idp.descricaoresumida
  • Sort Method: top-N heapsort Memory: 29kB
3. 0.394 154.966 ↓ 797.0 797 1

WindowAgg (cost=238.49..238.55 rows=1 width=81) (actual time=154.733..154.966 rows=797 loops=1)

4. 0.411 154.572 ↓ 797.0 797 1

Unique (cost=238.49..238.53 rows=1 width=73) (actual time=154.098..154.572 rows=797 loops=1)

5. 4.161 154.161 ↓ 1,309.0 1,309 1

Sort (cost=238.49..238.50 rows=1 width=73) (actual time=154.097..154.161 rows=1,309 loops=1)

  • Sort Key: p.cod_objeto, idp.codigo, idp.descricaoresumida, c.descricao, idp.unidadevenda, idp.tipo, p.tipo, pe.sexo, pe.tiporeproducao, pe.quantidadedisponivel, pe.estoqueminimo
  • Sort Method: quicksort Memory: 233kB
6. 0.527 150.000 ↓ 1,309.0 1,309 1

Nested Loop Left Join (cost=168.00..238.48 rows=1 width=73) (actual time=2.161..150.000 rows=1,309 loops=1)

7. 0.902 146.855 ↓ 1,309.0 1,309 1

Nested Loop (cost=167.72..238.13 rows=1 width=73) (actual time=2.129..146.855 rows=1,309 loops=1)

8. 0.640 140.717 ↓ 1,309.0 1,309 1

Nested Loop (cost=167.45..237.77 rows=1 width=64) (actual time=2.110..140.717 rows=1,309 loops=1)

  • Join Filter: ((p.cod_objeto)::text = (pp.produto)::text)
9. 1.485 19.925 ↓ 1,306.0 1,306 1

Nested Loop (cost=167.17..219.18 rows=1 width=80) (actual time=2.020..19.925 rows=1,306 loops=1)

10. 4.541 8.716 ↓ 2,431.0 2,431 1

Hash Left Join (cost=166.89..218.75 rows=1 width=48) (actual time=1.995..8.716 rows=2,431 loops=1)

  • Hash Cond: ((p.classificacaoprimaria)::text = (c.cod_objeto)::text)
  • Filter: ((c.nome IS NULL) OR (unaccent((c.nome)::text) ~~* unaccent(concat('%', 'Alimen', '%'))) OR (((cla.nome IS NULL) OR (unaccent((cla.nome)::text) ~~* unaccent(concat('%', 'Alimen', '%')))) AND (cp.situacao = 1)))
  • Rows Removed by Filter: 657
11. 1.165 3.820 ↓ 1.4 3,088 1

Hash Right Join (cost=151.90..197.96 rows=2,194 width=52) (actual time=1.578..3.820 rows=3,088 loops=1)

  • Hash Cond: ((cp.produto)::text = (p.cod_objeto)::text)
12. 0.888 1.468 ↑ 1.0 1,837 1

Hash Left Join (cost=14.99..56.23 rows=1,837 width=30) (actual time=0.352..1.468 rows=1,837 loops=1)

  • Hash Cond: ((cp.classificacao)::text = (cla.cod_objeto)::text)
13. 0.280 0.280 ↑ 1.0 1,837 1

Seq Scan on classificacaoproduto cp (cost=0.00..36.37 rows=1,837 width=28) (actual time=0.029..0.280 rows=1,837 loops=1)

14. 0.169 0.300 ↑ 1.0 444 1

Hash (cost=9.44..9.44 rows=444 width=20) (actual time=0.300..0.300 rows=444 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 31kB
15. 0.131 0.131 ↑ 1.0 444 1

Seq Scan on classificacao cla (cost=0.00..9.44 rows=444 width=20) (actual time=0.012..0.131 rows=444 loops=1)

16. 0.455 1.187 ↓ 1.0 2,195 1

Hash (cost=109.48..109.48 rows=2,194 width=38) (actual time=1.187..1.187 rows=2,195 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 167kB
17. 0.732 0.732 ↓ 1.0 2,195 1

Seq Scan on produto p (cost=0.00..109.48 rows=2,194 width=38) (actual time=0.035..0.732 rows=2,195 loops=1)

  • Filter: ((situacao = 1) AND ((tipo = ANY ('{1,2,9,10}'::integer[])) OR (0 = tipo)))
  • Rows Removed by Filter: 529
18. 0.174 0.355 ↑ 1.0 444 1

Hash (cost=9.44..9.44 rows=444 width=32) (actual time=0.355..0.355 rows=444 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 37kB
19. 0.181 0.181 ↑ 1.0 444 1

Seq Scan on classificacao c (cost=0.00..9.44 rows=444 width=32) (actual time=0.015..0.181 rows=444 loops=1)

20. 9.724 9.724 ↑ 1.0 1 2,431

Index Scan using idx_fk_produto1 on produto pe (cost=0.28..0.42 rows=1 width=32) (actual time=0.004..0.004 rows=1 loops=2,431)

  • Index Cond: ((produto)::text = (p.cod_objeto)::text)
21. 120.152 120.152 ↑ 2.0 1 1,306

Index Only Scan using idx_pessoa_produto on pessoaproduto pp (cost=0.28..18.57 rows=2 width=16) (actual time=0.039..0.092 rows=1 loops=1,306)

  • Index Cond: (produto = (pe.produto)::text)
  • Heap Fetches: 1309
22. 5.236 5.236 ↑ 1.0 1 1,309

Index Scan using pk_identificacaoproduto on identificacaoproduto idp (cost=0.28..0.35 rows=1 width=41) (actual time=0.004..0.004 rows=1 loops=1,309)

  • Index Cond: ((cod_objeto)::text = (p.codigoprincipal)::text)
23. 2.618 2.618 ↓ 0.0 0 1,309

Index Only Scan using idx_fk_produto on identificacaoproduto alt (cost=0.28..0.35 rows=1 width=19) (actual time=0.002..0.002 rows=0 loops=1,309)

  • Index Cond: (produto = (p.cod_objeto)::text)
  • Heap Fetches: 34