A method to process a query for information stored in a relational database using
indexes which have different granularity and/or composition is provided. The method
involves selecting indexes of various granularity and/or composition based on the
query, ordering and combining them (if necessary) in order to subset the data from
a relational table to be optimally scanned. The ability to combine indexes is very
useful to answer ad hoc queries for which no specific index exists. This requirement
may be met by using index ANDing and index ORing techniques.