explain.depesz.com

PostgreSQL's explain analyze made readable

Result: QMoJ

Settings
# exclusive inclusive rows x rows loops node
1. 0.031 1.262 ↓ 5.0 5 1

GroupAggregate (cost=372.12..372.22 rows=1 width=1,682) (actual time=1.244..1.262 rows=5 loops=1)

  • Group Key: v.id, ((COALESCE(COALESCE(fp.nome, COALESCE(fpf.nome, fpv.nome)), fpi.nome))::character varying(255)), (COALESCE(COALESCE(cm.forma_pagamento_id, COALESCE(f.forma_pagamento_id, vfp.forma_pagamento_venda_id)), fip.forma_pagamento_id)), (COALESCE(fip.parcelas, 1)), (COALESCE(f.vencimento, COALESCE(fip.vencimento, COALESCE(fi.vencimento, v.data_venda)))), (COALESCE(cm.cheque_numero, fip.cheque_numero)), p.nome, f.financeiro_id, (COALESCE(COALESCE(cm.autorizacao_cartao, vfp.autorizacao_cartao), fip.autorizacao_cartao)), (COALESCE(COALESCE(cm.cartao_operadora, vfp.cartao_operadora), fip.operadora)), (COALESCE(COALESCE(cm.cartao_ultimos_digitos, vfp.cartao_ultimos_digitos), fip.cartao_ultimos_digitos)), fi.tipo, (COALESCE(cm.documento, fip.documento)), vendedor.nome, intermediario.nome, fip.financeiro_item_pagamento_id, c.descricao, (COALESCE(fip.cliente_fornecedor, fi.cliente_fornecedor)), e.nome, ((CASE (f.liquidacao IS NULL) WHEN CASE_TEST_EXPR THEN COALESCE((f.observacoes)::text, (fip.detalhes)::text) ELSE ''::text END)::character varying(255)), (COALESCE(cm.banco, (fip.banco)::bpchar)), (COALESCE(cm.cpf_cnpj, fip.cpf_cnpj))
2. 0.043 1.231 ↓ 7.0 7 1

Sort (cost=372.12..372.12 rows=1 width=1,671) (actual time=1.228..1.231 rows=7 loops=1)

  • Sort Key: v.id, ((COALESCE(COALESCE(fp.nome, COALESCE(fpf.nome, fpv.nome)), fpi.nome))::character varying(255)), (COALESCE(COALESCE(cm.forma_pagamento_id, COALESCE(f.forma_pagamento_id, vfp.forma_pagamento_venda_id)), fip.forma_pagamento_id)), (COALESCE(fip.parcelas, 1)), (COALESCE(f.vencimento, COALESCE(fip.vencimento, COALESCE(fi.vencimento, v.data_venda)))), (COALESCE(cm.cheque_numero, fip.cheque_numero)), p.nome, f.financeiro_id, (COALESCE(COALESCE(cm.autorizacao_cartao, vfp.autorizacao_cartao), fip.autorizacao_cartao)), (COALESCE(COALESCE(cm.cartao_operadora, vfp.cartao_operadora), fip.operadora)), (COALESCE(COALESCE(cm.cartao_ultimos_digitos, vfp.cartao_ultimos_digitos), fip.cartao_ultimos_digitos)), fi.tipo, (COALESCE(cm.documento, fip.documento)), vendedor.nome, intermediario.nome, fip.financeiro_item_pagamento_id, c.descricao, (COALESCE(fip.cliente_fornecedor, fi.cliente_fornecedor)), e.nome, ((CASE (f.liquidacao IS NULL) WHEN CASE_TEST_EXPR THEN COALESCE((f.observacoes)::text, (fip.detalhes)::text) ELSE ''::text END)::character varying(255)), (COALESCE(cm.banco, (fip.banco)::bpchar)), (COALESCE(cm.cpf_cnpj, fip.cpf_cnpj))
  • Sort Method: quicksort Memory: 26kB
3. 0.034 1.188 ↓ 7.0 7 1

Nested Loop Left Join (cost=8.54..372.11 rows=1 width=1,671) (actual time=0.268..1.188 rows=7 loops=1)

  • Join Filter: (fpv.forma_pagamento_venda_id = vfp.forma_pagamento_venda_id)
  • Rows Removed by Join Filter: 7
4. 0.032 1.133 ↓ 7.0 7 1

Nested Loop Left Join (cost=8.54..370.89 rows=1 width=975) (actual time=0.254..1.133 rows=7 loops=1)

  • Join Filter: (f.liquidacao IS NULL)
5. 0.083 1.080 ↓ 7.0 7 1

Nested Loop Left Join (cost=8.12..370.35 rows=1 width=939) (actual time=0.243..1.080 rows=7 loops=1)

  • Join Filter: (fip.forma_pagamento_id = fpi.forma_pagamento_id)
  • Rows Removed by Join Filter: 112
6. 0.014 0.941 ↓ 7.0 7 1

Nested Loop Left Join (cost=8.12..368.99 rows=1 width=861) (actual time=0.225..0.941 rows=7 loops=1)

7. 0.013 0.920 ↓ 7.0 7 1

Nested Loop Left Join (cost=7.84..368.69 rows=1 width=703) (actual time=0.219..0.920 rows=7 loops=1)

8. 0.018 0.900 ↓ 7.0 7 1

Nested Loop Left Join (cost=7.56..360.39 rows=1 width=698) (actual time=0.214..0.900 rows=7 loops=1)

9. 0.066 0.861 ↓ 7.0 7 1

Nested Loop Left Join (cost=7.27..352.08 rows=1 width=677) (actual time=0.205..0.861 rows=7 loops=1)

  • Join Filter: (cm.forma_pagamento_id = fp.forma_pagamento_id)
  • Rows Removed by Join Filter: 112
10. 0.182 0.739 ↓ 7.0 7 1

Nested Loop Left Join (cost=7.27..350.72 rows=1 width=599) (actual time=0.185..0.739 rows=7 loops=1)

  • Join Filter: (c.conta_id = cm.conta_id)
  • Rows Removed by Join Filter: 364
11. 0.015 0.375 ↓ 7.0 7 1

Nested Loop Left Join (cost=7.27..348.55 rows=1 width=497) (actual time=0.137..0.375 rows=7 loops=1)

12. 0.063 0.339 ↓ 7.0 7 1

Nested Loop Left Join (cost=6.85..348.03 rows=1 width=366) (actual time=0.127..0.339 rows=7 loops=1)

  • Join Filter: (f.forma_pagamento_id = fpf.forma_pagamento_id)
  • Rows Removed by Join Filter: 112
13. 0.016 0.220 ↓ 7.0 7 1

Nested Loop Left Join (cost=6.85..346.67 rows=1 width=288) (actual time=0.105..0.220 rows=7 loops=1)

  • Filter: (COALESCE((f.cancelado)::bpchar, '0'::bpchar) = '0'::bpchar)
14. 0.013 0.148 ↑ 4.6 7 1

Nested Loop (cost=6.43..323.96 rows=32 width=164) (actual time=0.093..0.148 rows=7 loops=1)

15. 0.004 0.111 ↑ 11.0 2 1

Nested Loop (cost=6.01..307.60 rows=22 width=132) (actual time=0.081..0.111 rows=2 loops=1)

16. 0.005 0.095 ↑ 11.0 2 1

Nested Loop (cost=5.73..287.70 rows=22 width=148) (actual time=0.070..0.095 rows=2 loops=1)

17. 0.005 0.078 ↑ 11.0 2 1

Nested Loop (cost=5.44..280.96 rows=22 width=148) (actual time=0.061..0.078 rows=2 loops=1)

18. 0.006 0.063 ↑ 11.0 2 1

Nested Loop (cost=5.30..277.43 rows=22 width=164) (actual time=0.052..0.063 rows=2 loops=1)

19. 0.004 0.040 ↑ 9.0 1 1

Nested Loop (cost=0.86..130.83 rows=9 width=116) (actual time=0.035..0.040 rows=1 loops=1)

20. 0.013 0.013 ↑ 1.0 1 1

Index Scan using pk_pessoa on pessoa e (cost=0.29..8.30 rows=1 width=37) (actual time=0.012..0.013 rows=1 loops=1)

  • Index Cond: (pessoa_id = '175589fb-5eaf-4c5a-934a-6e55c546ac2d'::uuid)
21. 0.005 0.023 ↑ 9.0 1 1

Nested Loop (cost=0.57..122.43 rows=9 width=95) (actual time=0.020..0.023 rows=1 loops=1)

22. 0.011 0.011 ↑ 9.0 1 1

Index Scan using idx_data_venda on vendas v (cost=0.29..47.69 rows=9 width=90) (actual time=0.010..0.011 rows=1 loops=1)

  • Index Cond: ((data_venda >= '2019-09-27'::date) AND (data_venda <= '2019-09-27'::date))
  • Filter: ((situacao = ANY ('{A,F}'::bpchar[])) AND (empresa_id = '175589fb-5eaf-4c5a-934a-6e55c546ac2d'::uuid))
23. 0.007 0.007 ↑ 1.0 1 1

Index Scan using pk_pessoa on pessoa p (cost=0.29..8.30 rows=1 width=37) (actual time=0.006..0.007 rows=1 loops=1)

  • Index Cond: (pessoa_id = v.pagante_id)
24. 0.007 0.017 ↑ 1.5 2 1

Bitmap Heap Scan on vendas_produtos vpr (cost=4.44..16.26 rows=3 width=80) (actual time=0.013..0.017 rows=2 loops=1)

  • Recheck Cond: (vendas_id = v.id)
  • Heap Blocks: exact=2
25. 0.010 0.010 ↑ 1.5 2 1

Bitmap Index Scan on idx_vendas_produtos_vendas_id (cost=0.00..4.44 rows=3 width=0) (actual time=0.009..0.010 rows=2 loops=1)

  • Index Cond: (vendas_id = v.id)
26. 0.010 0.010 ↑ 1.0 1 2

Index Only Scan using pk_produtos on produtos pr (cost=0.14..0.16 rows=1 width=16) (actual time=0.004..0.005 rows=1 loops=2)

  • Index Cond: (id = vpr.produto_id)
  • Heap Fetches: 0
27. 0.012 0.012 ↑ 1.0 1 2

Index Scan using pk_fornecimento on fornecimento fn (cost=0.28..0.31 rows=1 width=32) (actual time=0.006..0.006 rows=1 loops=2)

  • Index Cond: (fornecimento_id = vpr.fornecimento_id)
28. 0.012 0.012 ↑ 1.0 1 2

Index Only Scan using pk_pessoa on pessoa pf (cost=0.29..0.90 rows=1 width=16) (actual time=0.005..0.006 rows=1 loops=2)

  • Index Cond: (pessoa_id = fn.fornecedor_id)
  • Heap Fetches: 2
29. 0.024 0.024 ↓ 2.0 4 2

Index Scan using idx_financeiro_item_vendas_produtos_id on financeiro_item fi (cost=0.42..0.72 rows=2 width=64) (actual time=0.007..0.012 rows=4 loops=2)

  • Index Cond: (vendas_produtos_id = vpr.vendas_produtos_id)
  • Filter: ((tipo <> 'SAL'::bpchar) AND (tipo <> 'RMB'::bpchar) AND (cliente_fornecedor = 'C'::bpchar))
  • Rows Removed by Filter: 1
30. 0.056 0.056 ↑ 1.0 1 7

Index Scan using pk_financeiro on financeiro f (cost=0.42..0.70 rows=1 width=142) (actual time=0.007..0.008 rows=1 loops=7)

  • Index Cond: (fi.financeiro_id = financeiro_id)
31. 0.056 0.056 ↑ 1.0 16 7

Seq Scan on forma_pagamento fpf (cost=0.00..1.16 rows=16 width=94) (actual time=0.002..0.008 rows=16 loops=7)

32. 0.021 0.021 ↓ 0.0 0 7

Index Scan using idx_conta_movimento_financeiro_id on conta_movimento cm (cost=0.42..0.51 rows=1 width=147) (actual time=0.003..0.003 rows=0 loops=7)

  • Index Cond: (financeiro_id = f.financeiro_id)
33. 0.182 0.182 ↑ 1.0 52 7

Seq Scan on conta c (cost=0.00..1.52 rows=52 width=134) (actual time=0.002..0.026 rows=52 loops=7)

34. 0.056 0.056 ↑ 1.0 16 7

Seq Scan on forma_pagamento fp (cost=0.00..1.16 rows=16 width=94) (actual time=0.002..0.008 rows=16 loops=7)

35. 0.021 0.021 ↑ 1.0 1 7

Index Scan using pk_pessoa on pessoa vendedor (cost=0.29..8.30 rows=1 width=37) (actual time=0.003..0.003 rows=1 loops=7)

  • Index Cond: (v.vendedor_id = pessoa_id)
36. 0.007 0.007 ↓ 0.0 0 7

Index Scan using pk_pessoa on pessoa intermediario (cost=0.29..8.30 rows=1 width=37) (actual time=0.001..0.001 rows=0 loops=7)

  • Index Cond: (v.intermediario_id = pessoa_id)
37. 0.007 0.007 ↓ 0.0 0 7

Index Scan using pk_financeiro_item_cartao on financeiro_item_pagamento fip (cost=0.28..0.30 rows=1 width=174) (actual time=0.001..0.001 rows=0 loops=7)

  • Index Cond: (fi.financeiro_item_pagamento_id = financeiro_item_pagamento_id)
38. 0.056 0.056 ↑ 1.0 16 7

Seq Scan on forma_pagamento fpi (cost=0.00..1.16 rows=16 width=94) (actual time=0.001..0.008 rows=16 loops=7)

39. 0.021 0.021 ↓ 0.0 0 7

Index Scan using idx_vendas_pagamentos_financeiro_id on vendas_pagamentos vfp (cost=0.41..0.53 rows=1 width=52) (actual time=0.003..0.003 rows=0 loops=7)

  • Index Cond: (financeiro_id = f.financeiro_id)
  • Filter: (forma_pagamento_venda_id = '13b49005-3505-40c0-8043-978813f9c941'::uuid)
40. 0.021 0.021 ↑ 1.0 1 7

Seq Scan on forma_pagamento_venda fpv (cost=0.00..1.20 rows=1 width=134) (actual time=0.003..0.003 rows=1 loops=7)

  • Filter: (forma_pagamento_venda_id = '13b49005-3505-40c0-8043-978813f9c941'::uuid)
  • Rows Removed by Filter: 15
Planning time : 6.242 ms
Execution time : 1.715 ms