explain.depesz.com

PostgreSQL's explain analyze made readable

Result: qLyV

Settings
# exclusive inclusive rows x rows loops node
1. 1,241.717 3,277.295 ↓ 137,511.8 1,512,630 1

Hash Join (cost=943.49..4,540.62 rows=11 width=46) (actual time=231.881..3,277.295 rows=1,512,630 loops=1)

  • Hash Cond: ((t1.u_orgvenda = t2.u_orgvenda) AND (t1.s_codproduto = t4.s_codproduto))
2.          

CTE cte_orgven

3. 0.005 0.005 ↑ 1.0 1 1

Seq Scan on t_orgven (cost=0.00..4.01 rows=1 width=8) (actual time=0.004..0.005 rows=1 loops=1)

4.          

CTE cte_descricao_tabela_preco

5. 0.052 0.052 ↑ 1.0 31 1

Seq Scan on t_descricao_tabela_preco (cost=0.00..4.31 rows=31 width=11) (actual time=0.005..0.052 rows=31 loops=1)

6.          

CTE cte_produto

7. 0.716 0.716 ↑ 1.0 1,717 1

Seq Scan on t_produto (cost=0.00..253.17 rows=1,717 width=13) (actual time=0.004..0.716 rows=1,717 loops=1)

8.          

CTE cte_orgven_cliente_tabela_preco

9. 30.389 227.785 ↓ 1.0 24 1

HashAggregate (cost=639.50..639.73 rows=23 width=8) (actual time=227.777..227.785 rows=24 loops=1)

  • Group Key: z2.u_orgvenda, z2.s_codtabela
10.          

Initplan (forHashAggregate)

11. 0.047 0.047 ↑ 1.0 1 1

Result (cost=0.00..0.26 rows=1 width=0) (actual time=0.047..0.047 rows=1 loops=1)

12. 39.595 197.349 ↓ 58.1 63,565 1

Nested Loop (cost=0.71..633.77 rows=1,094 width=8) (actual time=0.123..197.349 rows=63,565 loops=1)

13. 11.195 11.195 ↓ 58.5 20,937 1

Index Scan using t_orgven_vendedor_cliente_s_codvendedor on t_orgven_vendedor_cliente z1 (cost=0.29..217.71 rows=358 width=9) (actual time=0.079..11.195 rows=20,937 loops=1)

  • Index Cond: (s_codvendedor = $3)
14. 146.559 146.559 ↑ 1.0 3 20,937

Index Only Scan using t_orgven_cliente_tabela_preco_pkey on t_orgven_cliente_tabela_preco z2 (cost=0.41..1.13 rows=3 width=13) (actual time=0.006..0.007 rows=3 loops=20,937)

  • Index Cond: ((u_orgvenda = z1.u_orgvenda) AND (s_codcliente = z1.s_codcliente))
  • Heap Fetches: 0
15. 998.286 2,031.661 ↓ 663.2 1,605,018 1

Nested Loop (cost=1.23..3,580.09 rows=2,420 width=55) (actual time=227.927..2,031.661 rows=1,605,018 loops=1)

16. 0.102 228.153 ↓ 22.0 22 1

Hash Join (cost=0.80..1.67 rows=1 width=76) (actual time=227.870..228.153 rows=22 loops=1)

  • Hash Cond: ((t3.u_orgvenda = t5.u_orgvenda) AND (t3.s_codtabela = t5.s_codtabela))
17. 0.210 0.210 ↑ 1.0 31 1

CTE Scan on cte_descricao_tabela_preco t3 (cost=0.00..0.62 rows=31 width=40) (actual time=0.008..0.210 rows=31 loops=1)

18. 0.037 227.841 ↓ 1.0 24 1

Hash (cost=0.46..0.46 rows=23 width=36) (actual time=227.841..227.841 rows=24 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
19. 227.804 227.804 ↓ 1.0 24 1

CTE Scan on cte_orgven_cliente_tabela_preco t5 (cost=0.00..0.46 rows=23 width=36) (actual time=227.781..227.804 rows=24 loops=1)

20. 805.222 805.222 ↑ 1.0 72,955 22

Index Scan using t_tabela_preco_idx01 on t_tabela_preco t1 (cost=0.43..2,828.22 rows=75,021 width=45) (actual time=0.040..36.601 rows=72,955 loops=22)

  • Index Cond: ((u_orgvenda = t3.u_orgvenda) AND (s_codtabela = t3.s_codtabela))
21. 0.783 3.917 ↓ 190.8 1,717 1

Hash (cost=40.90..40.90 rows=9 width=48) (actual time=3.917..3.917 rows=1,717 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 94kB
22. 1.188 3.134 ↓ 190.8 1,717 1

Hash Join (cost=0.03..40.90 rows=9 width=48) (actual time=0.035..3.134 rows=1,717 loops=1)

  • Hash Cond: (t4.u_orgvenda = t2.u_orgvenda)
23. 1.938 1.938 ↑ 1.0 1,717 1

CTE Scan on cte_produto t4 (cost=0.00..34.34 rows=1,717 width=40) (actual time=0.007..1.938 rows=1,717 loops=1)

24. 0.002 0.008 ↑ 1.0 1 1

Hash (cost=0.02..0.02 rows=1 width=8) (actual time=0.008..0.008 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
25. 0.006 0.006 ↑ 1.0 1 1

CTE Scan on cte_orgven t2 (cost=0.00..0.02 rows=1 width=8) (actual time=0.005..0.006 rows=1 loops=1)