explain.depesz.com

PostgreSQL's explain analyze made readable

Result: PNCG

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

CTE Scan on consulta co (cost=3,456.83..3,456.86 rows=1 width=378) (actual time=535.927..535.933 rows=2 loops=1)

2.          

CTE consulta

3. 0.020 535.923 ↓ 2.0 2 1

GroupAggregate (cost=3,456.76..3,456.83 rows=1 width=346) (actual time=535.919..535.923 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.016 535.903 ↓ 2.0 2 1

Sort (cost=3,456.76..3,456.77 rows=1 width=234) (actual time=535.902..535.903 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.013 535.887 ↓ 2.0 2 1

Nested Loop Left Join (cost=41.54..3,456.75 rows=1 width=234) (actual time=532.887..535.887 rows=2 loops=1)

6. 0.008 532.984 ↓ 2.0 2 1

Nested Loop Left Join (cost=41.13..3,456.21 rows=1 width=179) (actual time=530.987..532.984 rows=2 loops=1)

7. 0.006 528.986 ↓ 2.0 2 1

Nested Loop (cost=40.71..3,435.63 rows=1 width=147) (actual time=528.923..528.986 rows=2 loops=1)

8. 0.009 528.954 ↓ 2.0 2 1

Nested Loop (cost=40.30..3,435.01 rows=1 width=151) (actual time=528.902..528.954 rows=2 loops=1)

9. 527.996 528.867 ↓ 2.0 2 1

Bitmap Heap Scan on cvc_extrato c (cost=39.88..3,426.57 rows=1 width=126) (actual time=528.846..528.867 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=2821
10. 0.871 0.871 ↓ 12.8 12,743 1

Bitmap Index Scan on idx_cvc_extrato_empresa_id (cost=0.00..39.88 rows=994 width=0) (actual time=0.871..0.871 rows=12,743 loops=1)

  • Index Cond: (empresa_id = '47eab639-fa02-40c0-b996-f9376f125c33'::uuid)
11. 0.078 0.078 ↑ 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.039..0.039 rows=1 loops=2)

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

Index Scan using pk_vendas on vendas v (cost=0.41..0.62 rows=1 width=28) (actual time=0.013..0.013 rows=1 loops=2)

  • Index Cond: (id = vp.vendas_id)
  • Filter: (situacao = 'F'::bpchar)
13. 3.990 3.990 ↑ 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=1.634..1.995 rows=1 loops=2)

  • Index Cond: (vp.vendas_produtos_id = vendas_produtos_id)
14. 2.890 2.890 ↑ 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=1.445..1.445 rows=1 loops=2)

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