1. A method comprising: pre-computing a first query result based on a first segment of data stored in a database in response to receiving a first query; storing the first query result in the database; receiving a second query specifying a second segment of data stored in the database; determining whether the first segment of data is included in the second segment of data; performing the second query on one or more third segments of data included in the second segment of data, wherein the one or more third segments of data do not include data from the first segment of data; and computing a second query result based on a result of the performing the second query on the one or more third segments of data and, in response to determining that the first segment of data is included in the second segment of data, the first query result.