[prev in list] [next in list] [prev in thread] [next in thread] 

List:       monetdb-checkins
Subject:    MonetDB: Jun2020 - if no-mitosis is set, and we have a simple se...
From:       Niels Nes <commits+niels=cwi.nl () monetdb ! org>
Date:       2021-01-30 22:07:00
Message-ID: hg.33032ce1a860.1612044420.6315528441665844383 () monetdb-vm0 ! spin-off ! cwi ! nl
[Download RAW message or body]

Changeset: 33032ce1a860 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=33032ce1a860
Modified Files:
	sql/backends/monet5/rel_bin.c
Branch: Jun2020
Log Message:

if no-mitosis is set, and we have a simple semijoin case (don't use the more general \
join/semijoin route)


diffs (59 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
@@ -2230,6 +2230,7 @@ split_join_exps(sql_rel *rel, list *join
 }
 
 #define is_equi_exp(e) ((e)->flag == cmp_equal || (e)->flag == mark_in || (e)->flag \
== mark_notin) +#define is_equi_exp_(e) ((e)->flag == cmp_equal || (e)->flag == \
mark_in)  
 static list *
 get_equi_joins_first(mvc *sql, list *exps, int *equality_only)
@@ -2554,6 +2555,7 @@ rel2bin_semijoin(backend *be, sql_rel *r
 	list *l, *sexps = NULL;
 	node *en = NULL, *n;
 	stmt *left = NULL, *right = NULL, *join = NULL, *jl, *jr, *c, *lcand = NULL;
+	int semijoin_only = 0;
 
 	if (rel->op == op_anti && !list_empty(rel->exps) && list_length(rel->exps) == 1 && \
((sql_exp*)rel->exps->h->data)->flag == mark_notin)  return rel2bin_antijoin(be, rel, \
refs); @@ -2634,7 +2636,13 @@ rel2bin_semijoin(backend *be, sql_rel *r
 
 					if (!l || !r)
 						return NULL;
-					s = stmt_join_cand(be, column(be, l), column(be, r), left->cand, \
NULL/*right->cand*/, e->anti, (comp_type) e->flag, 0, is_semantics(e), false); \
+					if (sql->no_mitosis && list_length(jexps) == 1 && list_empty(sexps) && rel->op \
== op_semi && !e->anti && is_equi_exp_(e)) { +						join = stmt_semijoin(be, \
column(be, l), column(be, r), left->cand, NULL/*right->cand*/, is_semantics(e), \
false); +						semijoin_only = 1;
+						en = NULL;
+						break;
+					} else
+						s = stmt_join_cand(be, column(be, l), column(be, r), left->cand, \
NULL/*right->cand*/, e->anti, (comp_type) e->flag, 0, is_semantics(e), false);  lcand \
= left->cand;  } else {
 					s = exp_bin(be, e, left, right, NULL, NULL, NULL, NULL, NULL, 0, 1);
@@ -2741,14 +2749,16 @@ rel2bin_semijoin(backend *be, sql_rel *r
 
 	/* We did a full join, thats too much.
 	   Reduce this using difference and intersect */
-	c = stmt_mirror(be, left->op4.lval->h->data);
-	if (rel->op == op_anti) {
-		join = stmt_tdiff(be, c, jl, lcand);
-	} else {
-		if (lcand)
-			join = stmt_semijoin(be, c, jl, lcand, NULL/*right->cand*/, 0, false);
-		else
-			join = stmt_tinter(be, c, jl, false);
+	if (!semijoin_only) {
+		c = stmt_mirror(be, left->op4.lval->h->data);
+		if (rel->op == op_anti) {
+			join = stmt_tdiff(be, c, jl, lcand);
+		} else {
+			if (lcand)
+				join = stmt_semijoin(be, c, jl, lcand, NULL/*right->cand*/, 0, false);
+			else
+				join = stmt_tinter(be, c, jl, false);
+		}
 	}
 
 	/* project all the left columns */
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic