1. A method of query optimization, comprising: comparing a complexity measure of a client query received from a client application to a predetermined threshold, wherein the predetermined threshold is determined using at least one of system data and query execution data; generating an optimized query by modifying the client query to reduce the complexity measure of the client query if the complexity measure of the client query exceeds the predetermined threshold; submitting the optimized query to a server application on a server; and selecting a post-processing routine to be applied to the result set.