1. A method of query optimization, the method being implemented by one or more processors and comprising: receiving a query to aggregate data from a plurality of datasets, wherein at least one of the plurality of datasets contains private information for one or more people; retrieving data from the plurality of datasets, wherein (1) each of the plurality of datasets has associated privacy parameters that determine a level of noise to be applied to query results obtained from that dataset, and (2) the levels of noise are used to determine an order of operations for the query to retrieve the data from the plurality of datasets; applying the levels of noise to each query result obtained from each of the plurality of datasets in accordance with the privacy parameters associated with that dataset; computing aggregated data from the query results with the levels of noise applied; and responding to the query with the aggregated data.