explain.depesz.com

PostgreSQL's explain analyze made readable

Result: wTD : Optimization for: Optimization for: plan #4X17; plan #KB30

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 55.044 198.613 ↓ 2,416.4 38,662 1

Group (cost=8,650.25..8,655.46 rows=16 width=57) (actual time=130.466..198.613 rows=38,662 loops=1)

  • Group Key: ecf.ecf_cd_ecf, ven.ven_cd_venda, cai.cai_fl_consolidado
2. 10.387 143.569 ↓ 4,295.8 38,662 1

Gather Merge (cost=8,650.25..8,651.35 rows=9 width=28) (actual time=130.439..143.569 rows=38,662 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
3. 4.407 133.182 ↓ 2,147.9 19,331 2 / 2

Group (cost=7,650.24..7,650.33 rows=9 width=28) (actual time=127.616..133.182 rows=19,331 loops=2)

  • Group Key: ecf.ecf_cd_ecf, ven.ven_cd_venda, cai.cai_fl_consolidado
4. 10.816 128.775 ↓ 2,147.9 19,331 2 / 2

Sort (cost=7,650.24..7,650.26 rows=9 width=28) (actual time=127.611..128.775 rows=19,331 loops=2)

  • Sort Key: ecf.ecf_cd_ecf, ven.ven_cd_venda, cai.cai_fl_consolidado
  • Sort Method: quicksort Memory: 2262kB
  • Worker 0: Sort Method: quicksort Memory: 2295kB
5. 0.000 117.959 ↓ 2,147.9 19,331 2 / 2

Nested Loop (cost=4,089.95..7,650.10 rows=9 width=28) (actual time=21.061..117.959 rows=19,331 loops=2)

6. 8.845 80.550 ↓ 2,147.9 19,331 2 / 2

Nested Loop (cost=4,089.53..7,630.88 rows=9 width=30) (actual time=21.051..80.550 rows=19,331 loops=2)

7. 5.094 52.374 ↓ 2,147.9 19,331 2 / 2

Parallel Hash Join (cost=4,089.25..7,617.50 rows=9 width=27) (actual time=21.036..52.374 rows=19,331 loops=2)

  • Hash Cond: (ven.ven_cd_cliente = (336567))
8. 38.535 44.215 ↓ 11.3 20,101 2 / 2

Parallel Bitmap Heap Scan on venda ven (cost=67.51..3,588.40 rows=1,776 width=31) (actual time=17.880..44.215 rows=20,101 loops=2)

  • Recheck Cond: ((ven_cd_unidade_negocio = 1588) AND (ven_fl_cancelada = 'N'::bpchar) AND (ven_dt_fiscal >= LEAST('2020-01-01'::date, '2020-01-31'::date)) AND (ven_dt_fiscal <= GREATEST('2020-01-01'::date, '2020-01-31'::date)))
  • Heap Blocks: exact=18665
9. 5.681 5.681 ↓ 13.4 40,318 1 / 2

Bitmap Index Scan on venda_ven_cd_unidade_negocio_ven_fl_cancelada_ven_dt_fiscal_ven (cost=0.00..66.75 rows=3,019 width=0) (actual time=11.361..11.361 rows=40,318 loops=1)

  • Index Cond: ((ven_cd_unidade_negocio = 1588) AND (ven_fl_cancelada = 'N'::bpchar) AND (ven_dt_fiscal >= LEAST('2020-01-01'::date, '2020-01-31'::date)) AND (ven_dt_fiscal <= GREATEST('2020-01-01'::date, '2020-01-31'::date)))
10. 0.019 3.065 ↑ 12.0 1 2 / 2

Parallel Hash (cost=4,020.51..4,020.51 rows=12 width=4) (actual time=3.065..3.065 rows=1 loops=2)

  • Buckets: 1024 Batches: 1 Memory Usage: 40kB
11. 0.001 3.046 ↑ 12.0 1 2 / 2

Parallel Append (cost=0.00..4,020.51 rows=12 width=4) (actual time=2.576..3.046 rows=1 loops=2)

12. 0.001 0.001 ↑ 1.0 1 1 / 2

Result (cost=0.00..0.10 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

13. 0.000 3.044 ↓ 0.0 0 2 / 2

Nested Loop (cost=26.42..4,018.21 rows=9 width=4) (actual time=2.841..3.044 rows=0 loops=2)

14. 0.510 0.586 ↑ 1.2 876 2 / 2

Parallel Bitmap Heap Scan on cliente_unidade_negocio cun (cost=26.00..1,731.45 rows=1,023 width=4) (actual time=0.119..0.586 rows=876 loops=2)

  • Recheck Cond: (cun_cd_unidade_negocio = 1588)
  • Heap Blocks: exact=541
15. 0.075 0.075 ↓ 1.0 1,751 1 / 2

Bitmap Index Scan on cliente_unidade_negocio_idx_unidade_negocio (cost=0.00..25.56 rows=1,739 width=0) (actual time=0.151..0.151 rows=1,751 loops=1)

  • Index Cond: (cun_cd_unidade_negocio = 1588)
16. 2.627 2.627 ↓ 0.0 0 1,751 / 2

Index Scan using cliente_pkey on cliente cli (cost=0.42..2.24 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=1,751)

  • Index Cond: (cli_cd_cliente = cun.cun_cd_cliente)
  • Filter: (cli_fl_identificado = 'N'::bpchar)
  • Rows Removed by Filter: 1
17. 19.331 19.331 ↑ 1.0 1 38,662 / 2

Index Scan using ecf_pkey on ecf (cost=0.28..1.49 rows=1 width=7) (actual time=0.001..0.001 rows=1 loops=38,662)

  • Index Cond: (ecf_cd_ecf = ven.ven_cd_ecf)
18. 38.662 38.662 ↑ 1.0 1 38,662 / 2

Index Scan using caixa_pkey on caixa cai (cost=0.42..2.14 rows=1 width=6) (actual time=0.002..0.002 rows=1 loops=38,662)

  • Index Cond: (cai_cd_caixa = ven.ven_cd_caixa)
Planning time : 0.776 ms
Execution time : 201.863 ms