Changeset: a4af77b5e0e3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a4af77b5e0e3
Modified Files:
gdk/gdk_join.c
Branch: Aug2024
Log Message:
Slight improvement in semijoin: if r is unique, use that information.
diffs (39 lines):
diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -4213,7 +4213,7 @@ leftjoin(BAT **r1p, BAT **r2p, BAT **r3p
/* maybe do a hash join on the swapped operands; if we
* do, we need to sort the output, so we take that into
* account as well */
- bool lhash, plhash, lcand;
+ bool lhash, plhash, lcand, rkey = r->tkey;
double lcost;
lcost = joincost(l, rci.ncand, &lci, &lhash, &plhash, &lcand);
@@ -4221,7 +4221,7 @@ leftjoin(BAT **r1p, BAT **r2p, BAT **r3p
rc = GDK_FAIL;
goto doreturn;
}
- if (semi)
+ if (semi && !rkey)
lcost += rci.ncand; /* cost of BATunique(r) */
/* add cost of sorting; obviously we don't know the
* size, so we guess that the size of the output is
@@ -4230,7 +4230,7 @@ leftjoin(BAT **r1p, BAT **r2p, BAT **r3p
if (lcost < rcost) {
BAT *tmp = sr;
BAT *r1, *r2;
- if (semi) {
+ if (semi && !rkey) {
sr = BATunique(r, sr);
if (sr == NULL) {
rc = GDK_FAIL;
@@ -4241,7 +4241,7 @@ leftjoin(BAT **r1p, BAT **r2p, BAT **r3p
rc = hashjoin(&r2, &r1, NULL, r, l, &rci, &lci,
nil_matches,
false, false, false, false, false, false,
estimate,
t0, true, lhash, plhash, lcand, func);
- if (semi)
+ if (semi && !rkey)
BBPunfix(sr->batCacheid);
if (rc != GDK_SUCCEED)
goto doreturn;
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]