The cost of running a query (having a query range) on a multidimensional
database may be estimated using a process factors criteria beyond merely
the number of affected records. First, a materialized view of the
database may be represented as a container of tuples, sorted by key. Then
keys may be stepped through, each key representing a mapping of a
combination of tuples from the container. At each step, the process may
request the next smallest key in the query range greater than or equal to
the key of the current step, which results in the tuple in the database
whose key is the smallest, greater than or equal to the requested key,
and determine if the resulting tuple is in the query range. The cost of
the query may then be estimated as the number of tuples upon which the
range check was performed.