explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 623o : Teste

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=10,288.66..2,852,924.13 rows=288 width=169) (actual rows= loops=)

  • Hash Cond: (clientes.codigo = clientes_contatos.cod_cliente)
2.          

Initplan (for Hash Left Join)

3. 0.000 0.000 ↓ 0.0

Subquery Scan on rel2 (cost=10,014.72..10,014.74 rows=1 width=18) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Limit (cost=10,014.72..10,014.73 rows=1 width=14) (actual rows= loops=)

5. 0.000 0.000 ↓ 0.0

Sort (cost=10,014.72..10,027.88 rows=5,264 width=14) (actual rows= loops=)

  • Sort Key: public.vendas.data_emissao
6. 0.000 0.000 ↓ 0.0

HashAggregate (cost=9,935.76..9,988.40 rows=5,264 width=14) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Append (cost=1.37..9,909.44 rows=5,264 width=14) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Hash Join (cost=1.37..9,843.48 rows=5,263 width=14) (actual rows= loops=)

  • Hash Cond: (public.vendas.cod_serie = public.serie.codigo)
9. 0.000 0.000 ↓ 0.0

Seq Scan on vendas (cost=0.00..9,315.82 rows=126,309 width=18) (actual rows= loops=)

  • Filter: ((cancelado = 'N'::bpchar) AND (cod_cliente = 1))
10. 0.000 0.000 ↓ 0.0

Hash (cost=1.36..1.36 rows=1 width=7) (actual rows= loops=)

11. 0.000 0.000 ↓ 0.0

Seq Scan on serie (cost=0.00..1.36 rows=1 width=7) (actual rows= loops=)

  • Filter: ((gera_caixa = 'S'::bpchar) AND (gera_duplicata = 'S'::bpchar))
12. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.00..13.32 rows=1 width=26) (actual rows= loops=)

  • Join Filter: (public.vendas_servicos.cod_serie = public.serie.codigo)
13. 0.000 0.000 ↓ 0.0

Seq Scan on vendas_servicos (cost=0.00..11.95 rows=1 width=33) (actual rows= loops=)

  • Filter: ((cancelado = 'N'::bpchar) AND (cod_cliente = 1))
14. 0.000 0.000 ↓ 0.0

Seq Scan on serie (cost=0.00..1.36 rows=1 width=7) (actual rows= loops=)

  • Filter: ((gera_caixa = 'S'::bpchar) AND (gera_duplicata = 'S'::bpchar))
15. 0.000 0.000 ↓ 0.0

Hash Join (cost=272.59..322.09 rows=288 width=169) (actual rows= loops=)

  • Hash Cond: (clientes.cod_convenio = convenio.codigo)
16. 0.000 0.000 ↓ 0.0

Hash Join (cost=271.50..317.04 rows=288 width=140) (actual rows= loops=)

  • Hash Cond: (clientes.cod_regiao = regiao.codigo)
17. 0.000 0.000 ↓ 0.0

Hash Join (cost=270.43..312.02 rows=288 width=107) (actual rows= loops=)

  • Hash Cond: (clientes.cod_cidade = cidades.codigo)
18. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=81.24..117.43 rows=288 width=73) (actual rows= loops=)

  • Hash Cond: (clientes_vendedores.cod_cliente = clientes.codigo)
19. 0.000 0.000 ↓ 0.0

Seq Scan on clientes_vendedores (cost=0.00..27.77 rows=1,477 width=4) (actual rows= loops=)

20. 0.000 0.000 ↓ 0.0

Hash (cost=78.64..78.64 rows=208 width=73) (actual rows= loops=)

21. 0.000 0.000 ↓ 0.0

Seq Scan on clientes (cost=0.00..78.64 rows=208 width=73) (actual rows= loops=)

  • Filter: ((tipo_cadastro <> 'F'::bpchar) AND (ativo = 'S'::bpchar) AND (cod_loja = 1))
22. 0.000 0.000 ↓ 0.0

Hash (cost=119.64..119.64 rows=5,564 width=36) (actual rows= loops=)

23. 0.000 0.000 ↓ 0.0

Seq Scan on cidades (cost=0.00..119.64 rows=5,564 width=36) (actual rows= loops=)

24. 0.000 0.000 ↓ 0.0

Hash (cost=1.03..1.03 rows=3 width=35) (actual rows= loops=)

25. 0.000 0.000 ↓ 0.0

Seq Scan on regiao (cost=0.00..1.03 rows=3 width=35) (actual rows= loops=)

26. 0.000 0.000 ↓ 0.0

Hash (cost=1.04..1.04 rows=4 width=31) (actual rows= loops=)

27. 0.000 0.000 ↓ 0.0

Seq Scan on convenio (cost=0.00..1.04 rows=4 width=31) (actual rows= loops=)

28. 0.000 0.000 ↓ 0.0

Hash (cost=1.15..1.15 rows=15 width=4) (actual rows= loops=)

29. 0.000 0.000 ↓ 0.0

Seq Scan on clientes_contatos (cost=0.00..1.15 rows=15 width=4) (actual rows= loops=)

30.          

SubPlan (for Hash Left Join)

31. 0.000 0.000 ↓ 0.0

Aggregate (cost=9,870.05..9,870.06 rows=1 width=8) (actual rows= loops=)

32. 0.000 0.000 ↓ 0.0

Unique (cost=9,870.01..9,870.02 rows=2 width=8) (actual rows= loops=)

33. 0.000 0.000 ↓ 0.0

Sort (cost=9,870.01..9,870.02 rows=2 width=8) (actual rows= loops=)

  • Sort Key: (max(public.vendas.data_emissao))
34. 0.000 0.000 ↓ 0.0

Append (cost=9,856.64..9,870.00 rows=2 width=8) (actual rows= loops=)

35. 0.000 0.000 ↓ 0.0

Aggregate (cost=9,856.64..9,856.65 rows=1 width=8) (actual rows= loops=)

36. 0.000 0.000 ↓ 0.0

Hash Join (cost=1.37..9,843.48 rows=5,263 width=8) (actual rows= loops=)

  • Hash Cond: (public.vendas.cod_serie = public.serie.codigo)
37. 0.000 0.000 ↓ 0.0

Seq Scan on vendas (cost=0.00..9,315.82 rows=126,309 width=12) (actual rows= loops=)

  • Filter: ((cancelado = 'N'::bpchar) AND (cod_cliente = 1))
38. 0.000 0.000 ↓ 0.0

Hash (cost=1.36..1.36 rows=1 width=7) (actual rows= loops=)

39. 0.000 0.000 ↓ 0.0

Seq Scan on serie (cost=0.00..1.36 rows=1 width=7) (actual rows= loops=)

  • Filter: ((gera_caixa = 'S'::bpchar) AND (gera_duplicata = 'S'::bpchar))
40. 0.000 0.000 ↓ 0.0

Aggregate (cost=13.32..13.33 rows=1 width=8) (actual rows= loops=)

41. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.00..13.32 rows=1 width=8) (actual rows= loops=)

  • Join Filter: (public.vendas_servicos.cod_serie = public.serie.codigo)
42. 0.000 0.000 ↓ 0.0

Seq Scan on vendas_servicos (cost=0.00..11.95 rows=1 width=15) (actual rows= loops=)

  • Filter: ((cancelado = 'N'::bpchar) AND (cod_cliente = clientes.codigo))
43. 0.000 0.000 ↓ 0.0

Seq Scan on serie (cost=0.00..1.36 rows=1 width=7) (actual rows= loops=)

  • Filter: ((gera_caixa = 'S'::bpchar) AND (gera_duplicata = 'S'::bpchar))