12. The non-transitory computer-readable storage medium of claim 9 , wherein generating the set of sub-queries involves: selecting a column from the table; and selecting data from the table by specifying a range of data for the column.
9. A non-transitory computer-readable storage medium storing instructions that when executed by a computer cause the computer to perform a method for performing multi-stage table updates, the method comprising: receiving a query for updating a table in a database; responsive to a storage space needed for storing a transaction log associated with the received query exceeding a pre-determined threshold, dividing the query into a set of sub-queries by: identifying partitions in the table; and for each partition: determining if a storage space needed for storing a transaction log associated with a sub-query corresponding to the partition exceeds the pre-determined threshold; if not, processing the sub-query corresponding to the partition; and if so, dividing the partition into multiple subsets such that a storage space needed for storing a transaction log associated with each sub-query corresponding to a subset is less than the pre-determined threshold.