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, each of the plurality of datasets having associated privacy parameters that determine a level of noise to be applied to query results obtained from that dataseta; 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, the query results being obtained in accordance with an order of database operations determined by the levels of noise; computing aggregated data from the query results with the levels of noise applied; and responding to the query with the aggregated data.