Patent ID: 8799266

Claim:
A computer-implemented method for managing execution of a query against a partitioned database having a plurality of data partitions, comprising: providing a user-defined function comprising a plurality of conditional statements each being associated with one or more instructions defining operations to be performed on data returned in response to execution of the query; for each of the plurality of data partitions: examining data of the data partition; and on the basis of examined data, implementing (i) a copy of the user-defined function on the data partition when data exists in the respective data partition for all of the plurality of conditional statements and (ii) a modified form of the user-defined function on the data partition when data exists in the respective data partition for only a subset of the plurality of conditional statements, wherein the modified form of the user-defined function contains only the subset of the plurality of conditional statements for which data exists in the respective data partition; and executing, by operation of one or more computer processors, the query referring to the user-defined function against the plurality of data partitions; wherein execution of the query on each data partition invokes execution of the respective user-defined function against the data returned in response to execution of the query against the respective data partition.