Patent attributes
While generating an execution plan for a database statement that includes a user-defined table function that requires partitioning of input data to the function, it is determined whether the partitioning of output data from an operation that feeds the function is compatible with the partitioning required by the function. If the partitioning of output data from the operation that feeds the function is compatible with the partitioning required by the function, then the execution plan is constructed to specify execution of both (1) the function and (2) the operation that feeds the function, by a same set of processes. For example, the operation that feeds the function and the function itself are clumped into the same sub-plan or sub-tree, which is scheduled and run in parallel on a set of parallel execution slaves.