MonetDB 5 server v11.19.12 (64-bit, 64-bit oids) This is an unreleased version Copyright (c) 1993-July 2008 CWI Copyright (c) August 2008-2015 MonetDB B.V., all rights reserved Visit http://www.monetdb.org/ for further information Found 15.6GiB available memory, 8 available cpu cores Libraries: libpcre: 8.35 2014-04-04 (compiled with 8.35) openssl: OpenSSL 1.0.1k 8 Jan 2015 (compiled with OpenSSL 1.0.1k-fips 8 Jan 2015) libxml2: 2.9.1 (compiled with 2.9.1) Compiled by: roberto@photon.spinque.com (x86_64-unknown-linux-gnu) Compilation: gcc -g -Werror -Wall -Wextra -W -Werror-implicit-function-declaration -Wpointer-arith -Wdeclaration-after-statement -Wundef -Wformat=2 -Wno-format-nonliteral -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-format-attribute -Wmissing-prototypes -Wold-style-definition -Wpacked -Wunknown-pragmas -Wvariadic-macros -fstack-protector-all -Wstack-protector -Wpacked-bitfield-compat -Wsync-nand -Wjump-misses-init -Wmissing-include-dirs -Wlogical-op -Wunreachable-code Linking : /usr/bin/ld -m elf_x86_64 =========== Q1 =========== ========================== Equality join on string column == Left == - 1.6M strings (not null) - 16 unique values - not sorted == Right == - 1 string == Results == - Hash on right (small), cold: 430ms - Hash on right (small), hot: 430ms - Hash on left (large), cold: 35ms - Hash on left (large), hot: 1ms == Observations == The fact that the large table has only 16 distinct values makes the hash table very small. Still, 1.6M hash function calls are needed. Why is that much faster than 1.6M probes against 1 tuple? =========== Q2 =========== ========================== Equality join on string column == Left == - 1.2M strings (not null, unique) - 1.2M unique values - not sorted == Right == - 1 string == Results == - Hash on right (small), cold: 240ms - Hash on right (small), hot: 240ms - Hash on left (large), cold: 57ms - Hash on left (large), hot: 1ms == Observations == The sting colunt on left is marked not null and unique. Shouldn't it have a hash table already?