dear all£¬
    Recently when I am reading MAL optimizer manual of MonetDB.and don't know the Merge Table optimizer,A merge association table (MAT). (1)How it perform optimize the MAL?
(2) for this example,
before optimize,
m0:= bat.new(:oid,:int);
m1:= bat.new(:oid,:int);
m2:= bat.new(:oid,:int);
b := mat.new(m0,m1,m2);
s := algebra.select(b,1,3);
i := aggr.count(s);
io.print(s);
io.print(i);
c0 := bat.new(:int,:int);
c1 := bat.new(:int,:int);
c := mat.new(c0,c1);
j := algebra.join(b,c);
io.print(j);
The selection and aggregate operations can simply be rewritten using a MAT:
_33 := algebra.select(m0,1,3);
_34 := algebra.select(m1,1,3);
_35 := algebra.select(m2,1,3);
s := mat.new(_33,_34,_35);
i := 0:int;
_36 := aggr.count(_33);
i := calc.+(i,_36);
Chapter 5: The MAL Optimizer 90
_37 := aggr.count(_34);
i := calc.+(i,_37);
_38 := aggr.count(_35);
i := calc.+(i,_38);
io.print(i);
It seems that mat is very same with the bat.kunion, but what different between them, and how it optimizer the MAL?
 
Best regards!