A computer-implemented method of joining a first dataset with a second dataset, the first dataset configured to store a set of data entries each identified by a respective key of a first type and the second dataset configured to store a second set of data entries each identified by a respective key of a second type, the method comprising: providing a set of possible intermediate mapping entities, each mapping entity comprising a mapping database storing keys of the first type and associated respective keys of the second type, each key of the second type identifying a data entry of the second set of data entries that matches a data entry of the first set of data entries identified by the associated first key; determining a first intersection weight between the first dataset and each intermediate mapping entity, the first intersection weight being the proportion of data entries in the first data set which match keys of the first type in the intermediate mapping entity; determining a second intersection weight between the second dataset and each intermediate mapping entity, the second intersection weight being the proportion of keys of the second type in the intermediate mapping entity that match data entries of the second data set; computing a respective third intersection weight for each intermediate mapping entity by combining the first and second intersections weights, the third intersection weight representing a respective loss when a join is made between the first and second data sets using that intermediate mapping entity; selecting one or more intermediate mapping entity from the set of possible intermediate mapping entities based on the respective loss; accessing the selected intermediate mapping entity to transform a set of keys of the first type, identified from the first dataset in response to a query, into a generated set of keys of the second type for use in applying the query at the second data set; and applying the query at the second data set using the generated set of keys of the second type, including determining at least one matching data entry of the second data set which is identified by a key of the second type which matches one of the generated set of keys of the second type. providing a set of possible intermediate mapping entities, each mapping entity comprising a mapping database storing keys of the first type and associated respective keys of the second type, each key of the second type identifying a data entry of the second set of data entries that matches a data entry of the first set of data entries identified by the associated first key; determining a first intersection weight between the first dataset and each intermediate mapping entity, the first intersection weight being the proportion of data entries in the first data set which match keys of the first type in the intermediate mapping entity; determining a second intersection weight between the second dataset and each intermediate mapping entity, the second intersection weight being the proportion of keys of the second type in the intermediate mapping entity that match data entries of the second data set; computing a respective third intersection weight for each intermediate mapping entity by combining the first and second intersections weights, the third intersection weight representing a respective loss when a join is made between the first and second data sets using that intermediate mapping entity; selecting one or more intermediate mapping entity from the set of possible intermediate mapping entities based on the respective loss; accessing the selected intermediate mapping entity to transform a set of keys of the first type, identified from the first dataset in response to a query, into a generated set of keys of the second type for use in applying the query at the second data set; and applying the query at the second data set using the generated set of keys of the second type, including determining at least one matching data entry of the second data set which is identified by a key of the second type which matches one of the generated set of keys of the second type.