0

I have the next INSERT with SELECT in MonetDB:`

insert into colombia.agregada_region_mes
(
  cod_anomes
, cod_produto
, sg_estado
, cod_subcanal
, qtd_vendidas
, valor
, valor_dolar
, valor_euro
, fact_count
)
select
  f.cod_anomes
, f.cod_produto
, f.sg_estado
, f.cod_subcanal
, sum(f.qtd_vendidas) as qtd_vendidas
, sum(f.valor) as valor
, sum(f.valor_dolar) as valor_dolar
, sum(f.valor_euro) as valor_euro
, count(*) as fact_count
from colombia.staging_rm_fact f
group by
  f.cod_anomes
, f.cod_produto
, f.sg_estado
, f.cod_subcanal;

(Please, note the GROUP BY part).

Table "staging_rm_fact" has 50 million of rows, and MonetDB exceeds 16Gb of memory trying to resolve the INSERT:

enter image description here

Is there any other efficient way to resolve this group by?

Llorieb
  • 25
  • 5
  • paginate the data that gets inserted to a manageable size – nbk Oct 16 '21 at 23:05
  • Your figure shows MonetDB has use ~6.5GB MEM and failed to allocate 1.1GB more MEM. You probably only gave MonetDB 8GB, instead of 16GB? Which MonetDB version is this? – Jennie Oct 17 '21 at 13:48
  • @Jennie Thanks. MonetDB version es 11.39.11 (Oct2020-SP2). MonetDB and application are running together in the same VM, so the 16Gb space is shared between them. The application uses between 4 Gb and 5Gb, and I cannot change that. Getting more memory is the only solution for this or there's a more efficient way to group and insert the data in this table? – Llorieb Oct 17 '21 at 18:50

0 Answers0