Patent attributes
A device, system, and method are directed towards combining a plurality of queries to a database into a combined execution plan. The plurality of queries is received. The queries may be Structured Query Language (SQL) statements. The database may be a relational database. The plurality of queries is transformed into a plurality of parse trees. A determination is made whether the plurality of queries operates on at least the same portion of the same table. If so, then the plurality of query trees is query-optimized. The plurality of query trees are combined into a master query tree based on similar nodes in the plurality of query trees. A split node in the master query tree represents non-similarities between the plurality of query trees. The master query tree is transformed into an execution plan. The execution plan is applied to a database to return at least one result.