1. A method for processing data the method comprising: determining a dataset, wherein the dataset includes a plurality of data values and a plurality of identifiers, and wherein the plurality of identifiers are in a non-continuous order, and wherein the dataset is stored across a plurality of segments in a shared nothing distributed database; determining a number of samples to take from the dataset; identifying a minimum identifier and a maximum identifier, and a total number of identifiers; calculating a density based on the total number of identifiers, minimum identifier and maximum identifier; calculating a number of samples to take from each of the plurality of segments based on the calculated density, the number of samples to take from the dataset, the number of segments, and a sampling policy; each segment of the plurality of segments independently and randomly sampling identifiers of the dataset within its segment using the calculated number of samples to take from its respective portion of the dataset to generate a sub-dataset; joining the generated sub-datasets of the plurality of segments with the dataset; storing the joined dataset in a storage device; and generating one or more decision trees using the joined dataset.