Changeset: 5db43e9615db for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/5db43e9615db
Modified Files:
        gdk/gdk_sketch.c
Branch: default
Log Message:

Use BAT properties to speed up guessing number of unique values.
This shaves off more than 100 seconds from the hot_snapshot_huge_file test.


diffs (16 lines):

diff --git a/gdk/gdk_sketch.c b/gdk/gdk_sketch.c
--- a/gdk/gdk_sketch.c
+++ b/gdk/gdk_sketch.c
@@ -250,7 +250,11 @@ bat_guess_uniques(BAT *b, BATiter *bi, s
        uint8_t cnting_sketch[BUCKETS][CLZ_BUCKETS] = {0};
        double unique_guess = 0;
 
-       if (sketch_populate(b, bi, bci, cnting_sketch) == GDK_SUCCEED)
+       if (b->tsorted && b->trevsorted) /* all values are the same */
+               unique_guess = (double) (b->batCount > 0);
+       else if (b->tkey)       /* all values are distinct */
+               unique_guess = (double) b->batCount;
+       else if (sketch_populate(b, bi, bci, cnting_sketch) == GDK_SUCCEED)
                unique_guess = sketch_estimate(cnting_sketch);
 
        b->tunique_est = unique_guess;
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to