Changeset: 8470d7ec0a58 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8470d7ec0a58
Modified Files:
        sql/storage/bat/bat_storage.c
Branch: Jan2022
Log Message:

Avoid quadratic operation during startup, use linear instead.


diffs (28 lines):

diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -154,8 +154,8 @@ split_segment(segments *segs, segment *o
                return NULL;
        n->prev = NULL;
 
-       n->oldts = 0;
        if (o->ts == tr->tid) {
+               n->oldts = 0;
                n->ts = 1;
                n->deleted = true;
        } else {
@@ -3069,12 +3069,13 @@ load_storage(sql_trans *tr, sql_table *t
                        BATiter bi = bat_iterator(b);
                        oid *o = bi.base, n = o[0]+1;
                        size_t lcnt = 1;
+                       segment *seg = s->segs->h;
                        for (size_t i=1; i<icnt; i++) {
                                if (o[i] == n) {
                                        lcnt++;
                                        n++;
                                } else {
-                                       if ((ok = delete_range(tr, t, s, 
n-lcnt, lcnt)) != LOG_OK)
+                                       if ((ok = seg_delete_range(tr, t, s, 
&seg, n-lcnt, lcnt)) != LOG_OK)
                                                break;
                                        lcnt = 0;
                                }
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to