1. A computer-implemented method comprising: in response to receiving a query of a database, said query having an expression, said expression comprising a plurality of filters, said expression comprising at least one AND operator and at least one OR operator connecting said plurality of filters; providing a tree representing said expression, said tree comprising a first plurality of nodes, said at least one AND operator being associated with at least one AND node of said first plurality of nodes, respectively; said at least one OR operator being associated with at least one OR node of said first plurality of nodes, respectively; said plurality of filters being associated with a second plurality of nodes of said first plurality of nodes, respectively; matching at least one index to at least a portion of said expression thereby identifying at least one eligible index to satisfy one or more filters of said plurality of filters; creating a partition set comprising a plurality of partitions, each partition comprising at least one filter of said plurality of filters; merging, for said partition set, one partition with another partition based on a filter of said one partition having a least common ancestor that is an AND node with a filter of said another partition, thereby reducing a number of partitions of said partition set; and generating an index plan based on, at least in part, an eligible index matched with at least one filter of each partition of said partition set.