1. A method for collecting and storing string match and substring match statistics, comprising: providing a memory limit value; providing a database including a plurality of data content values, wherein said data content values comprise strings and substrings; constructing a histogram consisting of multiple buckets using a data model to construct a value synopsis, wherein the constructing is such that the value synopsis encodes the probability that a full string belongs to a given bucket, a frequency of sub-strings in each bucket, and summarization of data model parameters so that entire histogram fits within said memory limit value.