explain.depesz.com

PostgreSQL's explain analyze made readable

Result: yFdP

Settings
# exclusive inclusive rows x rows loops node
1. 9.550 9.550 ↓ 2.0 2 1

CTE Scan on consulta co (cost=22,698.53..22,698.56 rows=1 width=378) (actual time=9.543..9.550 rows=2 loops=1)

2.          

CTE consulta

3. 0.015 9.541 ↓ 2.0 2 1

GroupAggregate (cost=22,698.46..22,698.53 rows=1 width=267) (actual time=9.538..9.541 rows=2 loops=1)

  • Group Key: c.cvc_extrato_id, v.numero, v.situacao, (COALESCE(((vp.taxa_servico)::numeric + (vp.fee_agencia)::numeric), '0'::numeric)), (COALESCE((vp.desconto)::numeric, '0'::numeric))
4. 0.011 9.526 ↓ 2.0 2 1

Sort (cost=22,698.46..22,698.47 rows=1 width=155) (actual time=9.525..9.526 rows=2 loops=1)

  • Sort Key: c.cvc_extrato_id, v.numero, (COALESCE(((vp.taxa_servico)::numeric + (vp.fee_agencia)::numeric), '0'::numeric)), (COALESCE((vp.desconto)::numeric, '0'::numeric))
  • Sort Method: quicksort Memory: 25kB
5. 0.006 9.515 ↓ 2.0 2 1

Nested Loop Left Join (cost=280.47..22,698.45 rows=1 width=155) (actual time=9.460..9.515 rows=2 loops=1)

6. 0.003 9.495 ↓ 2.0 2 1

Nested Loop Left Join (cost=280.06..22,697.91 rows=1 width=100) (actual time=9.448..9.495 rows=2 loops=1)

7. 0.003 9.478 ↓ 2.0 2 1

Nested Loop (cost=279.64..22,677.33 rows=1 width=68) (actual time=9.440..9.478 rows=2 loops=1)

8. 0.005 9.461 ↓ 2.0 2 1

Nested Loop (cost=279.22..22,676.71 rows=1 width=78) (actual time=9.430..9.461 rows=2 loops=1)

9. 8.583 9.422 ↓ 2.0 2 1

Bitmap Heap Scan on cvc_extrato c (cost=278.80..22,668.27 rows=1 width=53) (actual time=9.416..9.422 rows=2 loops=1)

  • Recheck Cond: (empresa_id = '47eab639-fa02-40c0-b996-f9376f125c33'::uuid)
  • Filter: (((deposito)::numeric > '0'::numeric) AND (data_movimentacao >= '2019-05-14'::date) AND (data_movimentacao <= '2019-05-14'::date) AND ((excluido)::bpchar = '0'::bpchar))
  • Rows Removed by Filter: 12719
  • Heap Blocks: exact=2820
10. 0.839 0.839 ↓ 1.1 12,721 1

Bitmap Index Scan on idx_cvc_extrato_empresa_id (cost=0.00..278.80 rows=12,050 width=0) (actual time=0.839..0.839 rows=12,721 loops=1)

  • Index Cond: (empresa_id = '47eab639-fa02-40c0-b996-f9376f125c33'::uuid)
11. 0.034 0.034 ↑ 1.0 1 2

Index Scan using pk_vendas_produtos on vendas_produtos vp (cost=0.42..8.44 rows=1 width=41) (actual time=0.017..0.017 rows=1 loops=2)

  • Index Cond: (vendas_produtos_id = c.vendas_produtos_id)
  • Filter: ((cancelado)::bpchar = '0'::bpchar)
12. 0.014 0.014 ↑ 1.0 1 2

Index Scan using pk_vendas on vendas v (cost=0.42..0.62 rows=1 width=22) (actual time=0.006..0.007 rows=1 loops=2)

  • Index Cond: (id = vp.vendas_id)
  • Filter: (situacao = 'F'::bpchar)
13. 0.014 0.014 ↑ 731.0 1 2

Index Scan using idx_vendas_pagamentos_produtos_vendas_produtos_id on vendas_pagamentos_produtos vpp (cost=0.42..13.27 rows=731 width=64) (actual time=0.006..0.007 rows=1 loops=2)

  • Index Cond: (vp.vendas_produtos_id = vendas_produtos_id)
14. 0.014 0.014 ↑ 1.0 1 2

Index Scan using pk_vendas_pagamentos on vendas_pagamentos vpa (cost=0.41..0.54 rows=1 width=32) (actual time=0.007..0.007 rows=1 loops=2)

  • Index Cond: (vendas_pagamentos_id = vpp.vendas_pagamentos_id)
  • Filter: ((enviado_fornecedor)::bpchar = '0'::bpchar)
Planning time : 1.614 ms
Execution time : 9.649 ms