A method, a system, and a computer program product for rewriting queries. A received query is parsed into a plurality of subqueries, where each subquery has one or more query elements. One or more identical subqueries are identified and grouped into one or more groups. Based on the groups of subqueries, an alias parameter is assigned to each identical subquery. The identical subqueries in the received query are replaced with corresponding aliases. An expression language statement is generated based on the received query, where each identical subquery is replaced with the corresponding assigned alias parameter in the expression language. The generated expression language statement is executed.
展开▼