Patent ID: 7580920
Filing Date: 2009-08-25
Classification: G06F,Y10S

Abstract:
1. A method to query a database, the method comprising: receiving and optimizing a query against a database; developing a query plan to retrieve database data, the plan comprising instructions for a row count operation, a corresponding expected number of row retrievals and a conditional row reordering operation for a row batch; executing the row count operation of the query plan, wherein rows are retrieved from the database and row retrievals are counted; switching to execution of a conditional row reordering operation comprising consuming, reordering, and returning a subset of remaining input rows retrieved for a row batch only if a quantity of counted row retrievals exceeds the expected number of row retrievals, otherwise not executing the row reordering operation; and producing database row results for all retrieved database rows, wherein the results comprise data from at least one of the row count operation or the conditional row reordering operation and wherein no retrieved row is processed more than once and no row result is discarded.