Patent ID: 7461057

Claim:
A system for executing a query plan, the system comprising: a logical index server configured to receive the query plan; one or more physical index servers in communication with the logical index server, each physical index server configured to receive a portion of the query plan from the logical index server, and determine plan operations of the portion of the query plan; and an execution engine associated with each of the one or more physical index servers, the execution engine configured to execute the plan operations of the query plan to generate a result, the execution engine executing plan operations specified by a query plan by initiating operations comprising: establishing a session object on each of the index servers; distributing the query plan to each of the index servers; counting, at each of the index servers, a number of references corresponding to a number of plan operations on such index server that consume a plan data object plus a number of remote index servers that run at least one operation that consumes the plan data object; initiating, at each of the index servers, a plan operation execution thread for each plan operation to be executed on such index server, within such plan operation execution thread, the server waits for inputs of the plan operation to become available, executes the operation, decrements reference counts for the inputs and deletes inputs when their reference count reaches zero, and wakes up plan operation execution threads that depend on an output of the plan operation; initiating, at each of the index servers, a plan data request thread for each plan data object that will be consumed on such server and produced on a different index server, within such plan data request, the server sends a message to the session object on the producing index server requesting a data item, receives the data item, and wakes up plan data request threads waiting for the data item; and returning, by each index server to the logical server, all outputs of the execution plan when the corresponding outputs become available on such index server.