1. A computer program product for processing a query in a database, the computer program product comprising: one or more computer-readable storage devices and program instructions stored on at least one of the one or more tangible storage devices, the program instructions executable by a processor, the program instructions comprising: program instructions to determine a plurality of reference values for a plurality of datasets with entries associated with the database, wherein the database is stored on a first computer, wherein a number of characters in each reference value within the determined plurality of reference values is equal to or less than a maximum number of characters per entry of the datasets, wherein determining the plurality of reference values comprises determining a frequency of a certain character on a certain digit of the entries of the database and selecting each reference value within the plurality of reference values based on a plurality of characters being found with a highest frequency on a plurality of individual digits per entry of the datasets, and wherein a sequence of the plurality of characters associated with each reference value within the plurality of reference values is adapted to a plurality of sequences of characters of the plurality of values of the entries of the dataset; program instructions to assign the determined plurality of reference values to the plurality of datasets with entries associated with the database; program instructions to assign a plurality of distance statistics to the plurality of datasets associated with the database, wherein the assigned plurality of distance statistics describe a minimum and a maximum distance between a plurality of values of the entries of a dataset within the plurality of datasets and an assigned reference value within the assigned plurality of reference values; program instructions to receive, from a second computer, the query associated with the database, wherein the received query comprises a search value; program instructions to identify the search value within the received query; program instructions to determine a search reference value based on the identified search value, wherein a first three characters of the identified search value matches a first three characters of the determined search reference value; program instructions to determine the distance between the identified search value and the determined search reference value, said determination resulting in a search distance; program instructions to determine a subset of datasets from the plurality of datasets for which the search distance is within a limit given by the minimum and maximum distances described by the respective distance statistics; and program instructions to search for the search value in the subset of datasets.