Home › Forums › kdb+ › What is the role played by key columns in a keyed table [ query join/performance ] ? › Re: What is the role played by key columns in a keyed table [ query join/performance ] ?
-
With qsql, the full column is searched before the result is presented. With key lookup, the search stops when it finds the first match. This is where the performance gain from key lookup comes from.
> The keys are basically nodes on a BST ( binary search tree ) which should look up in O(log(n)) time given n is size of the table
This isn’t true. KDB’s keyed table, or more generally a plain dictionary, does not use hashing techniques like Java’s HashMap. Lookup is done by searching through the table/list linearly. If one wishes less time for the lookup, grouped (conceptually the same as index) or parted (conceptually a space-optimized index that assumes data are sorted) attributes help.