1. A computer-implemented method for compressing a set of small strings, the method comprising: calculating, by a processor, n-gram frequencies for a plurality of n-grams over the set of small strings; selecting, by the processor, a subset of n-grams from the plurality of n-grams based on the calculated n-gram frequencies; defining, by the processor, a mapping table that maps each n-gram of the subset of n-grams to a unique code, wherein the unique codes are variable-length one or two byte codes; and compressing, by the processor, the set of small strings by replacing n-grams within each small string in the set of small strings with corresponding unique codes from the mapping table.