Patent ID: 7395270

Claim:
A classification-based method for string selectivity estimation in an XML database, comprising: (1) from an original data set including XML documents, constructing a partition-based histogram that is smaller in size than the original data set, the histogram-constructing comprising: (A) in an XML document, counting each path-value pair and outputting a collection of path-value-count triples sorted by count; (B) partitioning the collection of sorted path-value-count triples by applying a partitioning algorithm to provide a collection of partitions of path-value-count triples, each partition being a bucket; (C) for each partition, extracting a synopsis wherein the synopsis for each partition consists of average selectivity or count of all the path-value-count triples in the partitions and summary information that represents a set of path-value pairs belonging to the partition for which the synopsis is being extracted, further provided that the synopsis in each bucket consists of (i) occurrence counts of path associated with the bucket and (ii) occurrence counts of q-grams of values associated with the bucket, including: independently counting the paths and the q-grams on the values; provided that the histogram-constructing includes providing a memory limit value and fitting the histogram entirely within the memory limit value; and (2) applying the histogram to estimate selectivity for both exact/full string match queries and substring match queries in an XML database, comprising: receiving a match query that is an exact match query or a substring match query; when the query is an exact match query: computing an a posterior probability of each bucket given the input query, applying the synopsis in the histogram and finding the bucket that maximizes the a posteriori probability; from the histogram, for the bucket extracting an average selectivity and returning the average selectivity; when the query is a substring match query: computing for each bucket, an estimated number of times that the substring query occurs in the bucket to produce occurrence counts or frequencies from which to compute a weighted sum of frequency and average selectivity of the bucket, and returning the weighted sum as a selectivity estimate.