A method and apparatus for performing a distinct count metric by utilizing
aggregate navigation. For a distinct count query of an identifier of a
detail table, where the query specifies zero or more restrictions, an
aggregate table associated with the detail table is identified. It is
then determined whether the aggregate table contains the identifier that
is being distinct counted, and if so, whether the identifier is different
in every row of the aggregate table. If it is, then the rows of the
aggregate table that satisfy the specified restrictions are plain counted
to obtain a result for the distinct count query. If the identifier is not
different in every row of the aggregate table, a distinct count operation
is performed on the rows of the aggregate table that satisfy the
specified restrictions to obtain a result for the distinct count query.