explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 9I8j

Settings
# exclusive inclusive rows x rows loops node
1. 143,683.637 143,683.637 ↑ 4.5 2 1

CTE Scan on consulta co (cost=1,191.23..1,191.50 rows=9 width=378) (actual time=143,683.630..143,683.637 rows=2 loops=1)

2.          

CTE consulta

3. 0.022 143,683.612 ↑ 4.5 2 1

GroupAggregate (cost=1,190.61..1,191.23 rows=9 width=346) (actual time=143,683.608..143,683.612 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.015 143,683.590 ↑ 4.5 2 1

Sort (cost=1,190.61..1,190.63 rows=9 width=234) (actual time=143,683.589..143,683.590 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.011 143,683.575 ↑ 4.5 2 1

Nested Loop Left Join (cost=107.94..1,190.47 rows=9 width=234) (actual time=143,328.030..143,683.575 rows=2 loops=1)

6. 0.011 143,683.546 ↑ 4.5 2 1

Nested Loop Left Join (cost=107.53..1,185.60 rows=9 width=266) (actual time=143,328.013..143,683.546 rows=2 loops=1)

7. 302.834 143,683.517 ↓ 2.0 2 1

Nested Loop (cost=88.28..1,058.39 rows=1 width=234) (actual time=143,328.000..143,683.517 rows=2 loops=1)

8. 290.687 1,486.783 ↓ 181,450.0 181,450 1

Nested Loop (cost=17.24..967.42 rows=1 width=124) (actual time=14.953..1,486.783 rows=181,450 loops=1)

9. 225.090 237.681 ↓ 2,426.4 191,683 1

Bitmap Heap Scan on vendas_produtos vp (cost=16.82..317.01 rows=79 width=128) (actual time=14.940..237.681 rows=191,683 loops=1)

  • Recheck Cond: ((cancelado)::bpchar = '0'::bpchar)
  • Heap Blocks: exact=15711
10. 12.591 12.591 ↓ 2,426.4 191,683 1

Bitmap Index Scan on idx_vendas_produtos_vendas_id_ativos (cost=0.00..16.80 rows=79 width=0) (actual time=12.591..12.591 rows=191,683 loops=1)

11. 958.415 958.415 ↑ 1.0 1 191,683

Index Scan using pk_vendas on vendas v (cost=0.41..8.23 rows=1 width=28) (actual time=0.005..0.005 rows=1 loops=191,683)

  • Index Cond: (id = vp.vendas_id)
  • Filter: (situacao = 'F'::bpchar)
  • Rows Removed by Filter: 0
12. 181.450 141,893.900 ↓ 0.0 0 181,450

Bitmap Heap Scan on cvc_extrato c (cost=71.04..90.96 rows=1 width=126) (actual time=0.782..0.782 rows=0 loops=181,450)

  • Recheck Cond: ((vendas_produtos_id = vp.vendas_produtos_id) AND (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: 0
  • Heap Blocks: exact=11122
13. 233.877 141,712.450 ↓ 0.0 0 181,450

BitmapAnd (cost=71.04..71.04 rows=5 width=0) (actual time=0.781..0.781 rows=0 loops=181,450)

14. 725.800 725.800 ↑ 994.0 1 181,450

Bitmap Index Scan on idx_cvc_extrato_vendas_produtos_id (cost=0.00..30.91 rows=994 width=0) (actual time=0.004..0.004 rows=1 loops=181,450)

  • Index Cond: (vendas_produtos_id = vp.vendas_produtos_id)
15. 140,752.773 140,752.773 ↓ 12.8 12,743 181,149

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

  • Index Cond: (empresa_id = '47eab639-fa02-40c0-b996-f9376f125c33'::uuid)
16. 0.006 0.018 ↑ 731.0 1 2

Bitmap Heap Scan on vendas_pagamentos_produtos vpp (cost=19.25..119.90 rows=731 width=64) (actual time=0.009..0.009 rows=1 loops=2)

  • Recheck Cond: (vp.vendas_produtos_id = vendas_produtos_id)
  • Heap Blocks: exact=2
17. 0.012 0.012 ↑ 731.0 1 2

Bitmap Index Scan on idx_vendas_pagamentos_produtos_vendas_produtos_id (cost=0.00..19.07 rows=731 width=0) (actual time=0.006..0.006 rows=1 loops=2)

  • Index Cond: (vp.vendas_produtos_id = vendas_produtos_id)
18. 0.018 0.018 ↑ 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.009..0.009 rows=1 loops=2)

  • Index Cond: (vendas_pagamentos_id = vpp.vendas_pagamentos_id)
  • Filter: ((enviado_fornecedor)::bpchar = '0'::bpchar)