Patent ID: 8818989

Claim:
A computer-implemented method for managing query execution, comprising: calculating an estimated memory usage value for executing a query, based at least in part on historical memory usage data relating to previously processed queries, wherein the estimated memory usage value approximates a total amount of memory that will be used when the query is executed, and wherein the estimated memory usage value is calculated before the received query is executed; determining whether executing the query would satisfy a memory consumption condition by comparing the estimated memory usage value with a predetermined threshold amount of memory; and upon determining that executing the query would not satisfy the memory consumption condition, and by operation of one or more computer processors: determining one or more optimizations for the query adapted to reduce an amount of memory used when the query is executed, such that the memory consumption condition will be satisfied when the query is executed; optimizing the query based on the determined one or more optimizations; and executing the optimized query to produce a first set of query results.