1. An apparatus comprising: at least one processor; a memory coupled to the at least one processor; a deterministic user-defined function (UDF) residing in the memory and executed by the at least one processor, the deterministic UDF accessing at least one database table; and a deterministic user-defined function processing mechanism residing in the memory and executed by the at least one processor, the deterministic user-defined function processing mechanism collecting historical access patterns that indicate how the deterministic UDF accesses the at least one database table, and allocating a plurality of hash tables to the deterministic UDF based on the historical access patterns, wherein the deterministic user-defined function processing mechanism allocates the plurality of hash tables by evaluating columns passed to the deterministic UDF, grouping similar columns together and disjoint columns apart, and allocating one of the plurality of hash tables to each group of columns.