Changeset: 18df2f2f1c6e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/18df2f2f1c6e
Modified Files:
monetdb5/optimizer/opt_emptybind.c
sql/backends/monet5/sql_optimizer.c
sql/backends/monet5/sql_statement.c
Branch: default
Log Message:
improved emptybinds of indices
diffs (53 lines):
diff --git a/monetdb5/optimizer/opt_emptybind.c
b/monetdb5/optimizer/opt_emptybind.c
--- a/monetdb5/optimizer/opt_emptybind.c
+++ b/monetdb5/optimizer/opt_emptybind.c
@@ -159,6 +159,9 @@ OPTemptybindImplementation(Client cntxt,
setFunctionId(p,bindidxRef);
p->typechk= TYPE_UNKNOWN;
empty[getArg(p,0)] = i;
+ if( p->retc == 2){
+ empty[getArg(p,1)] = i;
+ }
// replace the call into a empty bat creation unless
the table was updated already in the same query
sch = getVarConstant(mb,getArg(p,2 +
(p->retc==2))).val.sval;
tbl = getVarConstant(mb,getArg(p,3 +
(p->retc==2))).val.sval;
diff --git a/sql/backends/monet5/sql_optimizer.c
b/sql/backends/monet5/sql_optimizer.c
--- a/sql/backends/monet5/sql_optimizer.c
+++ b/sql/backends/monet5/sql_optimizer.c
@@ -32,6 +32,14 @@ SQLgetColumnSize(sql_trans *tr, sql_colu
return store->storage_api.count_col(tr, c, access);
}
+static lng
+SQLgetIdxSize(sql_trans *tr, sql_idx *i, int access)
+{
+ sqlstore *store = tr->store;
+ return store->storage_api.count_idx(tr, i, access);
+}
+
+
/*
* The maximal space occupied by a query is calculated
* under the assumption that the complete database should fit in memory.
@@ -95,8 +103,7 @@ SQLgetSpace(mvc *m, MalBlkPtr mb, int pr
sql_idx *i = mvc_bind_idx(m, s, idxname);
if (i && (!isRemote(i->t) &&
!isMergeTable(i->t))) {
- sql_column *c =
ol_first_node(i->t->columns)->data;
- size = SQLgetColumnSize(tr, c, access);
+ size = SQLgetIdxSize(tr, i, access);
if( !prepare && size == 0 && !
i->t->system){
setFunctionId(p,
emptybindidxRef);
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
@@ -696,6 +696,8 @@ stmt_idxbat(backend *be, sql_idx *i, int
s->flag = access;
s->nr = getDestVar(q);
s->q = q;
+ s->tname = i->t->base.name;
+ s->cname = i->base.name;
return s;
}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list