Changeset: 3fa0a17123c9 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3fa0a17123c9
Modified Files:
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_statement.c
sql/benchmarks/tpch/Tests/04-explain.stable.out
sql/benchmarks/tpch/Tests/05-explain.stable.out
sql/benchmarks/tpch/Tests/05-explain.stable.out.32bit
sql/benchmarks/tpch/Tests/05-explain.stable.out.int128
sql/benchmarks/tpch/Tests/08-explain.stable.out
sql/benchmarks/tpch/Tests/08-explain.stable.out.int128
sql/benchmarks/tpch/Tests/11-explain.stable.out
sql/benchmarks/tpch/Tests/11-explain.stable.out.int128
sql/benchmarks/tpch/Tests/12-explain.stable.out
sql/benchmarks/tpch/Tests/12-explain.stable.out.int128
sql/benchmarks/tpch/Tests/13-explain.stable.out
sql/benchmarks/tpch/Tests/13-explain.stable.out.32bit
sql/benchmarks/tpch/Tests/15-explain.stable.out.int128
sql/benchmarks/tpch/Tests/18-explain.stable.out.int128
sql/benchmarks/tpch/Tests/21-explain.stable.out
sql/benchmarks/tpch/Tests/21-explain.stable.out.32bit
sql/benchmarks/tpch/Tests/22-explain.stable.out.int128
sql/storage/bat/bat_storage.c
sql/test/BugTracker-2011/Tests/crash_on_alias.Bug-2798.stable.out.int128
Branch: Jul2015
Log Message:
mark a extend.project(grpby) column as key (when we only have one grpby column).
This solves bug 3374 (and possibly other performance issues)
diffs (truncated from 1610 to 300 lines):
diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -2627,8 +2627,11 @@ rel2bin_groupby( mvc *sql, sql_rel *rel,
aggrstmt = list_find_column(sql->sa, l, aggrexp->l,
aggrexp->r);
if (gbexps && !aggrstmt && aggrexp->type == e_column) {
aggrstmt = list_find_column(sql->sa, gbexps,
aggrexp->l, aggrexp->r);
- if (aggrstmt && groupby)
+ if (aggrstmt && groupby) {
aggrstmt = stmt_project(sql->sa, ext, aggrstmt);
+ if (list_length(gbexps) == 1)
+ aggrstmt->key = 1;
+ }
}
if (!aggrstmt)
diff --git a/sql/backends/monet5/sql_gencode.c
b/sql/backends/monet5/sql_gencode.c
--- a/sql/backends/monet5/sql_gencode.c
+++ b/sql/backends/monet5/sql_gencode.c
@@ -1714,15 +1714,21 @@ static int
return s->nr;
}
/* projections, ie left is void headed */
- if (cmp == cmp_project)
+ if (cmp == cmp_project) {
q = newStmt1(mb, algebraRef,
"leftfetchjoin");
- else
+ } else
q = newStmt2(mb, algebraRef,
leftjoinRef);
q = pushArgument(mb, q, l);
q = pushArgument(mb, q, r);
if (q == NULL)
return -1;
s->nr = getDestVar(q);
+ if (cmp == cmp_project && s->key) {
+ q = newStmt1(mb, batRef, "setKey");
+ q = pushArgument(mb, q, s->nr);
+ q = pushBit(mb, q, TRUE);
+ s->nr = getDestVar(q);
+ }
return s->nr;
}
diff --git a/sql/backends/monet5/sql_statement.c
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -912,7 +912,7 @@ stmt_join(sql_allocator *sa, stmt *op1,
s->op1 = op1;
s->op2 = op2;
s->flag = cmptype;
- s->key = op1->key;
+ s->key = 0;
s->nrcols = 2;
return s;
}
diff --git a/sql/benchmarks/tpch/Tests/04-explain.stable.out
b/sql/benchmarks/tpch/Tests/04-explain.stable.out
--- a/sql/benchmarks/tpch/Tests/04-explain.stable.out
+++ b/sql/benchmarks/tpch/Tests/04-explain.stable.out
@@ -52,22 +52,22 @@ Ready.
% clob # type
% 460 # length
function user.s2_1{autoCommit=true}(A0:date,A1:date,A2:int):void;
- X_113:void := querylog.define("explain
select\n\to_orderpriority,\n\tcount(*) as
order_count\nfrom\n\torders\nwhere\n\to_orderdate >= date
\\'1993-07-01\\'\n\tand o_orderdate < date \\'1993-07-01\\' + interval \\'3\\'
month\n\tand exists
(\n\t\tselect\n\t\t\t*\n\t\tfrom\n\t\t\tlineitem\n\t\twhere\n\t\t\tl_orderkey =
o_orderkey\n\t\t\tand l_commitdate < l_receiptdate\n\t)\ngroup
by\n\to_orderpriority\norder by\n\to_orderpriority;","sequential_pipe",65);
- X_87 := bat.new(nil:oid,nil:str);
- X_95 := bat.append(X_87,"sys.orders");
- X_104 := bat.append(X_95,"sys.L1");
- X_90 := bat.new(nil:oid,nil:str);
- X_97 := bat.append(X_90,"o_orderpriority");
- X_106 := bat.append(X_97,"order_count");
+ X_114:void := querylog.define("explain
select\n\to_orderpriority,\n\tcount(*) as
order_count\nfrom\n\torders\nwhere\n\to_orderdate >= date
\\'1993-07-01\\'\n\tand o_orderdate < date \\'1993-07-01\\' + interval \\'3\\'
month\n\tand exists
(\n\t\tselect\n\t\t\t*\n\t\tfrom\n\t\t\tlineitem\n\t\twhere\n\t\t\tl_orderkey =
o_orderkey\n\t\t\tand l_commitdate < l_receiptdate\n\t)\ngroup
by\n\to_orderpriority\norder by\n\to_orderpriority;","sequential_pipe",66);
+ X_88 := bat.new(nil:oid,nil:str);
+ X_96 := bat.append(X_88,"sys.orders");
+ X_105 := bat.append(X_96,"sys.L1");
X_91 := bat.new(nil:oid,nil:str);
- X_98 := bat.append(X_91,"char");
- X_108 := bat.append(X_98,"wrd");
- X_92 := bat.new(nil:oid,nil:int);
- X_100 := bat.append(X_92,15);
- X_110 := bat.append(X_100,64);
- X_94 := bat.new(nil:oid,nil:int);
- X_102 := bat.append(X_94,0);
- X_112 := bat.append(X_102,0);
+ X_98 := bat.append(X_91,"o_orderpriority");
+ X_107 := bat.append(X_98,"order_count");
+ X_92 := bat.new(nil:oid,nil:str);
+ X_99 := bat.append(X_92,"char");
+ X_109 := bat.append(X_99,"wrd");
+ X_93 := bat.new(nil:oid,nil:int);
+ X_101 := bat.append(X_93,15);
+ X_111 := bat.append(X_101,64);
+ X_95 := bat.new(nil:oid,nil:int);
+ X_103 := bat.append(X_95,0);
+ X_113 := bat.append(X_103,0);
X_5 := sql.mvc();
X_6:bat[:oid,:oid] := sql.tid(X_5,"sys","orders");
X_9:bat[:oid,:date] := sql.bind(X_5,"sys","orders","o_orderdate",0);
@@ -110,11 +110,12 @@ function user.s2_1{autoCommit=true}(A0:d
X_74:bat[:oid,:str] := algebra.leftfetchjoinPath(X_65,X_20,X_6,X_73);
(X_75,r1_84,r2_84) := group.subgroupdone(X_74);
X_78 := algebra.leftfetchjoin(r1_84,X_74);
- X_83:bat[:oid,:wrd] := aggr.subcount(X_75,X_75,r1_84,false);
- (X_79,r1_88,r2_88) := algebra.subsort(X_78,false,false);
- X_82 := algebra.leftfetchjoin(r1_88,X_78);
- X_85 := algebra.leftfetchjoin(r1_88,X_83);
- sql.resultSet(X_104,X_106,X_108,X_110,X_112,X_82,X_85);
+ X_85:bat[:oid,:wrd] := aggr.subcount(X_75,X_75,r1_84,false);
+ X_79 := bat.setKey(X_78,true);
+ (X_80,r1_89,r2_89) := algebra.subsort(X_79,false,false);
+ X_84 := algebra.leftfetchjoin(r1_89,X_79);
+ X_86 := algebra.leftfetchjoin(r1_89,X_85);
+ sql.resultSet(X_105,X_107,X_109,X_111,X_113,X_84,X_86);
end user.s2_1;
# 22:53:26 >
diff --git a/sql/benchmarks/tpch/Tests/05-explain.stable.out
b/sql/benchmarks/tpch/Tests/05-explain.stable.out
--- a/sql/benchmarks/tpch/Tests/05-explain.stable.out
+++ b/sql/benchmarks/tpch/Tests/05-explain.stable.out
@@ -143,12 +143,12 @@ function user.s2_1{autoCommit=true}(A0:b
X_129 := algebra.leftfetchjoin(r1_141,X_128);
X_132:bat[:oid,:str] := sql.bind(X_7,"sys","region","r_name",0);
X_130:bat[:oid,:oid] := sql.tid(X_7,"sys","region");
- X_262 := algebra.subselect(X_132,X_130,A1,A1,true,false,false);
+ X_264 := algebra.subselect(X_132,X_130,A1,A1,true,false,false);
(X_134,r1_158) := sql.bind(X_7,"sys","region","r_name",2);
- X_263 :=
algebra.subselect(r1_158,nil:bat[:oid,:oid],A1,A1,true,false,false);
+ X_265 :=
algebra.subselect(r1_158,nil:bat[:oid,:oid],A1,A1,true,false,false);
X_137:bat[:oid,:str] := sql.bind(X_7,"sys","region","r_name",1);
- X_265 := algebra.subselect(X_137,X_130,A1,A1,true,false,false);
- X_138 := sql.subdelta(X_262,X_130,X_134,X_263,X_265);
+ X_267 := algebra.subselect(X_137,X_130,A1,A1,true,false,false);
+ X_138 := sql.subdelta(X_264,X_130,X_134,X_265,X_267);
X_140 := X_138;
(X_141,r1_168) :=
algebra.subjoin(X_129,X_140,nil:BAT,nil:BAT,false,nil:lng);
X_143 := algebra.leftfetchjoin(X_103,X_98);
diff --git a/sql/benchmarks/tpch/Tests/05-explain.stable.out.32bit
b/sql/benchmarks/tpch/Tests/05-explain.stable.out.32bit
--- a/sql/benchmarks/tpch/Tests/05-explain.stable.out.32bit
+++ b/sql/benchmarks/tpch/Tests/05-explain.stable.out.32bit
@@ -143,12 +143,12 @@ function user.s2_1{autoCommit=true}(A0:b
X_129 := algebra.leftfetchjoin(r1_141,X_128);
X_132:bat[:oid,:str] := sql.bind(X_7,"sys","region","r_name",0);
X_130:bat[:oid,:oid] := sql.tid(X_7,"sys","region");
- X_262 := algebra.subselect(X_132,X_130,A1,A1,true,false,false);
+ X_264 := algebra.subselect(X_132,X_130,A1,A1,true,false,false);
(X_134,r1_158) := sql.bind(X_7,"sys","region","r_name",2);
- X_263 :=
algebra.subselect(r1_158,nil:bat[:oid,:oid],A1,A1,true,false,false);
+ X_265 :=
algebra.subselect(r1_158,nil:bat[:oid,:oid],A1,A1,true,false,false);
X_137:bat[:oid,:str] := sql.bind(X_7,"sys","region","r_name",1);
- X_265 := algebra.subselect(X_137,X_130,A1,A1,true,false,false);
- X_138 := sql.subdelta(X_262,X_130,X_134,X_263,X_265);
+ X_267 := algebra.subselect(X_137,X_130,A1,A1,true,false,false);
+ X_138 := sql.subdelta(X_264,X_130,X_134,X_265,X_267);
X_140 := X_138;
(X_141,r1_168) :=
algebra.subjoin(X_129,X_140,nil:BAT,nil:BAT,false,nil:lng);
X_143 := algebra.leftfetchjoin(X_103,X_98);
diff --git a/sql/benchmarks/tpch/Tests/05-explain.stable.out.int128
b/sql/benchmarks/tpch/Tests/05-explain.stable.out.int128
--- a/sql/benchmarks/tpch/Tests/05-explain.stable.out.int128
+++ b/sql/benchmarks/tpch/Tests/05-explain.stable.out.int128
@@ -55,32 +55,32 @@ Ready.
% clob # type
% 592 # length
function user.s2_1{autoCommit=true}(A0:bte,A1:str,A2:date,A3:date,A4:int):void;
- X_218:void := querylog.define("explain
select\n\tn_name,\n\tsum(l_extendedprice * (1 - l_discount)) as
revenue\nfrom\n\tcustomer,\n\torders,\n\tlineitem,\n\tsupplier,\n\tnation,\n\tregion\nwhere\n\tc_custkey
= o_custkey\n\tand l_orderkey = o_orderkey\n\tand l_suppkey = s_suppkey\n\tand
c_nationkey = s_nationkey\n\tand s_nationkey = n_nationkey\n\tand n_regionkey =
r_regionkey\n\tand r_name = \\'ASIA\\'\n\tand o_orderdate >= date
\\'1994-01-01\\'\n\tand o_orderdate < date \\'1994-01-01\\' + interval \\'1\\'
year\ngroup by\n\tn_name\norder by\n\trevenue desc;","sequential_pipe",123);
- X_190 := bat.new(nil:oid,nil:str);
- X_198 := bat.append(X_190,"sys.nation");
- X_208 := bat.append(X_198,"sys.L1");
- X_193 := bat.new(nil:oid,nil:str);
- X_200 := bat.append(X_193,"n_name");
- X_210 := bat.append(X_200,"revenue");
- X_194 := bat.new(nil:oid,nil:str);
- X_202 := bat.append(X_194,"char");
- X_212 := bat.append(X_202,"decimal");
- X_195 := bat.new(nil:oid,nil:int);
- X_204 := bat.append(X_195,25);
- X_214 := bat.append(X_204,39);
+ X_220:void := querylog.define("explain
select\n\tn_name,\n\tsum(l_extendedprice * (1 - l_discount)) as
revenue\nfrom\n\tcustomer,\n\torders,\n\tlineitem,\n\tsupplier,\n\tnation,\n\tregion\nwhere\n\tc_custkey
= o_custkey\n\tand l_orderkey = o_orderkey\n\tand l_suppkey = s_suppkey\n\tand
c_nationkey = s_nationkey\n\tand s_nationkey = n_nationkey\n\tand n_regionkey =
r_regionkey\n\tand r_name = \\'ASIA\\'\n\tand o_orderdate >= date
\\'1994-01-01\\'\n\tand o_orderdate < date \\'1994-01-01\\' + interval \\'1\\'
year\ngroup by\n\tn_name\norder by\n\trevenue desc;","sequential_pipe",125);
+ X_192 := bat.new(nil:oid,nil:str);
+ X_200 := bat.append(X_192,"sys.nation");
+ X_210 := bat.append(X_200,"sys.L1");
+ X_195 := bat.new(nil:oid,nil:str);
+ X_202 := bat.append(X_195,"n_name");
+ X_212 := bat.append(X_202,"revenue");
+ X_196 := bat.new(nil:oid,nil:str);
+ X_204 := bat.append(X_196,"char");
+ X_214 := bat.append(X_204,"decimal");
X_197 := bat.new(nil:oid,nil:int);
- X_206 := bat.append(X_197,0);
- X_216 := bat.append(X_206,4);
+ X_206 := bat.append(X_197,25);
+ X_216 := bat.append(X_206,39);
+ X_199 := bat.new(nil:oid,nil:int);
+ X_208 := bat.append(X_199,0);
+ X_218 := bat.append(X_208,4);
X_7 := sql.mvc();
X_11:bat[:oid,:date] := sql.bind(X_7,"sys","orders","o_orderdate",0);
X_8:bat[:oid,:oid] := sql.tid(X_7,"sys","orders");
X_19:date := mtime.addmonths(A3,A4);
- X_258 := algebra.subselect(X_11,X_8,A2,X_19,true,false,false);
+ X_260 := algebra.subselect(X_11,X_8,A2,X_19,true,false,false);
(X_14,r1_14) := sql.bind(X_7,"sys","orders","o_orderdate",2);
- X_259 :=
algebra.subselect(r1_14,nil:bat[:oid,:oid],A2,X_19,true,false,false);
+ X_261 :=
algebra.subselect(r1_14,nil:bat[:oid,:oid],A2,X_19,true,false,false);
X_17:bat[:oid,:date] := sql.bind(X_7,"sys","orders","o_orderdate",1);
- X_261 := algebra.subselect(X_17,X_8,A2,X_19,true,false,false);
- X_20 := sql.subdelta(X_258,X_8,X_14,X_259,X_261);
+ X_263 := algebra.subselect(X_17,X_8,A2,X_19,true,false,false);
+ X_20 := sql.subdelta(X_260,X_8,X_14,X_261,X_263);
X_22:bat[:oid,:oid] :=
sql.bind_idxbat(X_7,"sys","orders","orders_o_custkey_fkey",0);
(X_24,r1_29) :=
sql.bind_idxbat(X_7,"sys","orders","orders_o_custkey_fkey",2);
X_26:bat[:oid,:oid] :=
sql.bind_idxbat(X_7,"sys","orders","orders_o_custkey_fkey",1);
@@ -143,12 +143,12 @@ function user.s2_1{autoCommit=true}(A0:b
X_129 := algebra.leftfetchjoin(r1_141,X_128);
X_132:bat[:oid,:str] := sql.bind(X_7,"sys","region","r_name",0);
X_130:bat[:oid,:oid] := sql.tid(X_7,"sys","region");
- X_262 := algebra.subselect(X_132,X_130,A1,A1,true,false,false);
+ X_264 := algebra.subselect(X_132,X_130,A1,A1,true,false,false);
(X_134,r1_158) := sql.bind(X_7,"sys","region","r_name",2);
- X_263 :=
algebra.subselect(r1_158,nil:bat[:oid,:oid],A1,A1,true,false,false);
+ X_265 :=
algebra.subselect(r1_158,nil:bat[:oid,:oid],A1,A1,true,false,false);
X_137:bat[:oid,:str] := sql.bind(X_7,"sys","region","r_name",1);
- X_265 := algebra.subselect(X_137,X_130,A1,A1,true,false,false);
- X_138 := sql.subdelta(X_262,X_130,X_134,X_263,X_265);
+ X_267 := algebra.subselect(X_137,X_130,A1,A1,true,false,false);
+ X_138 := sql.subdelta(X_264,X_130,X_134,X_265,X_267);
X_140 := X_138;
(X_141,r1_168) :=
algebra.subjoin(X_129,X_140,nil:BAT,nil:BAT,false,nil:lng);
X_143 := algebra.leftfetchjoin(X_103,X_98);
@@ -172,10 +172,12 @@ function user.s2_1{autoCommit=true}(A0:b
X_177:bat[:oid,:str] := algebra.leftfetchjoinPath(X_141,r1_141,X_176);
(X_178,r1_222,r2_222) := group.subgroupdone(X_177);
X_181:bat[:oid,:hge] := aggr.subsum(X_166,X_178,r1_222,true,true);
+ X_187 := algebra.leftfetchjoin(r1_222,X_177);
(X_183,r1_227,r2_227) := algebra.subsort(X_181,true,false);
- X_187:bat[:oid,:str] := algebra.leftfetchjoinPath(r1_227,r1_222,X_177);
- X_188 := algebra.leftfetchjoin(r1_227,X_181);
- sql.resultSet(X_208,X_210,X_212,X_214,X_216,X_187,X_188);
+ X_188 := bat.setKey(X_187,true);
+ X_189 := algebra.leftfetchjoin(r1_227,X_188);
+ X_190 := algebra.leftfetchjoin(r1_227,X_181);
+ sql.resultSet(X_210,X_212,X_214,X_216,X_218,X_189,X_190);
end user.s2_1;
# 22:53:26 >
diff --git a/sql/benchmarks/tpch/Tests/08-explain.stable.out
b/sql/benchmarks/tpch/Tests/08-explain.stable.out
--- a/sql/benchmarks/tpch/Tests/08-explain.stable.out
+++ b/sql/benchmarks/tpch/Tests/08-explain.stable.out
@@ -83,12 +83,12 @@ function user.s2_1{autoCommit=true}(A0:s
X_21 := sql.projectdelta(X_10,X_13,X_16,r1_16,X_19);
X_24:bat[:oid,:date] := sql.bind(X_9,"sys","orders","o_orderdate",0);
X_22:bat[:oid,:oid] := sql.tid(X_9,"sys","orders");
- X_291 := algebra.subselect(X_24,X_22,A4,A5,true,true,false);
+ X_294 := algebra.subselect(X_24,X_22,A4,A5,true,true,false);
(X_26,r1_27) := sql.bind(X_9,"sys","orders","o_orderdate",2);
- X_292 := algebra.subselect(r1_27,nil:bat[:oid,:oid],A4,A5,true,true,false);
+ X_295 := algebra.subselect(r1_27,nil:bat[:oid,:oid],A4,A5,true,true,false);
X_28:bat[:oid,:date] := sql.bind(X_9,"sys","orders","o_orderdate",1);
- X_294 := algebra.subselect(X_28,X_22,A4,A5,true,true,false);
- X_29 := sql.subdelta(X_291,X_22,X_26,X_292,X_294);
+ X_297 := algebra.subselect(X_28,X_22,A4,A5,true,true,false);
+ X_29 := sql.subdelta(X_294,X_22,X_26,X_295,X_297);
X_31 := X_29;
(X_32,r1_37) := algebra.subjoin(X_21,X_31,nil:BAT,nil:BAT,false,nil:lng);
X_36:bat[:oid,:int] := sql.bind(X_9,"sys","lineitem","l_partkey",0);
@@ -130,12 +130,12 @@ function user.s2_1{autoCommit=true}(A0:s
X_105 := algebra.leftfetchjoin(r1_108,X_104);
X_108:bat[:oid,:str] := sql.bind(X_9,"sys","region","r_name",0);
X_106:bat[:oid,:oid] := sql.tid(X_9,"sys","region");
- X_299 := algebra.subselect(X_108,X_106,A3,A3,true,false,false);
+ X_302 := algebra.subselect(X_108,X_106,A3,A3,true,false,false);
(X_110,r1_126) := sql.bind(X_9,"sys","region","r_name",2);
- X_300 :=
algebra.subselect(r1_126,nil:bat[:oid,:oid],A3,A3,true,false,false);
+ X_303 :=
algebra.subselect(r1_126,nil:bat[:oid,:oid],A3,A3,true,false,false);
X_112:bat[:oid,:str] := sql.bind(X_9,"sys","region","r_name",1);
- X_302 := algebra.subselect(X_112,X_106,A3,A3,true,false,false);
- X_113 := sql.subdelta(X_299,X_106,X_110,X_300,X_302);
+ X_305 := algebra.subselect(X_112,X_106,A3,A3,true,false,false);
+ X_113 := sql.subdelta(X_302,X_106,X_110,X_303,X_305);
X_115 := X_113;
(X_116,r1_135) :=
algebra.subjoin(X_105,X_115,nil:BAT,nil:BAT,false,nil:lng);
X_118:bat[:oid,:int] := sql.bind(X_9,"sys","lineitem","l_suppkey",0);
diff --git a/sql/benchmarks/tpch/Tests/08-explain.stable.out.int128
b/sql/benchmarks/tpch/Tests/08-explain.stable.out.int128
--- a/sql/benchmarks/tpch/Tests/08-explain.stable.out.int128
+++ b/sql/benchmarks/tpch/Tests/08-explain.stable.out.int128
@@ -59,22 +59,22 @@ Ready.
% clob # type
% 963 # length
function
user.s2_1{autoCommit=true}(A0:str,A1:bte,A2:bte,A3:str,A4:date,A5:date,A6:str):void;
- X_242:void := querylog.define("explain
select\n\to_year,\n\tsum(case\n\t\twhen nation = \\'BRAZIL\\' then
volume\n\t\telse 0\n\tend) / sum(volume) as
mkt_share\nfrom\n\t(\n\t\tselect\n\t\t\textract(year from o_orderdate) as
o_year,\n\t\t\tl_extendedprice * (1 - l_discount) as volume,\n\t\t\tn2.n_name
as
nation\n\t\tfrom\n\t\t\tpart,\n\t\t\tsupplier,\n\t\t\tlineitem,\n\t\t\torders,\n\t\t\tcustomer,\n\t\t\tnation
n1,\n\t\t\tnation n2,\n\t\t\tregion\n\t\twhere\n\t\t\tp_partkey =
l_partkey\n\t\t\tand s_suppkey = l_suppkey\n\t\t\tand l_orderkey =
o_orderkey\n\t\t\tand o_custkey = c_custkey\n\t\t\tand c_nationkey =
n1.n_nationkey\n\t\t\tand n1.n_regionkey = r_regionkey\n\t\t\tand r_name =
\\'AMERICA\\'\n\t\t\tand s_nationkey = n2.n_nationkey\n\t\t\tand o_orderdate
between date \\'1995-01-01\\' and date \\'1996-12-31\\'\n\t\t\tand p_type =
\\'ECONOMY ANODIZED STEEL\\'\n\t) as all_nations\ngroup by\n\to_year\norder
by\n\to_year;","sequential_pipe",134);
- X_215 := bat.new(nil:oid,nil:str);
- X_223 := bat.append(X_215,"sys.all_nations");
- X_233 := bat.append(X_223,"sys.L3");
+ X_245:void := querylog.define("explain
select\n\to_year,\n\tsum(case\n\t\twhen nation = \\'BRAZIL\\' then
volume\n\t\telse 0\n\tend) / sum(volume) as
mkt_share\nfrom\n\t(\n\t\tselect\n\t\t\textract(year from o_orderdate) as
o_year,\n\t\t\tl_extendedprice * (1 - l_discount) as volume,\n\t\t\tn2.n_name
as
nation\n\t\tfrom\n\t\t\tpart,\n\t\t\tsupplier,\n\t\t\tlineitem,\n\t\t\torders,\n\t\t\tcustomer,\n\t\t\tnation
n1,\n\t\t\tnation n2,\n\t\t\tregion\n\t\twhere\n\t\t\tp_partkey =
l_partkey\n\t\t\tand s_suppkey = l_suppkey\n\t\t\tand l_orderkey =
o_orderkey\n\t\t\tand o_custkey = c_custkey\n\t\t\tand c_nationkey =
n1.n_nationkey\n\t\t\tand n1.n_regionkey = r_regionkey\n\t\t\tand r_name =
\\'AMERICA\\'\n\t\t\tand s_nationkey = n2.n_nationkey\n\t\t\tand o_orderdate
between date \\'1995-01-01\\' and date \\'1996-12-31\\'\n\t\t\tand p_type =
\\'ECONOMY ANODIZED STEEL\\'\n\t) as all_nations\ngroup by\n\to_year\norder
by\n\to_year;","sequential_pipe",135);
X_218 := bat.new(nil:oid,nil:str);
- X_225 := bat.append(X_218,"o_year");
- X_235 := bat.append(X_225,"mkt_share");
- X_219 := bat.new(nil:oid,nil:str);
- X_227 := bat.append(X_219,"int");
- X_237 := bat.append(X_227,"decimal");
- X_220 := bat.new(nil:oid,nil:int);
- X_229 := bat.append(X_220,32);
- X_239 := bat.append(X_229,39);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list