1. In a relational database having records stored on a medium, a method of optimizing processing of a query with a record selection condition that includes a number of predicates, comprising: a) identifying one or more candidate predicates of the selection condition that can be used to factorize the selection condition; b) computing a gain from using a candidate predicate to factorize the selection condition; c) factorizing a candidate predicate that results in a positive gain from said selection condition to produce a rewritten selection condition; and d) processing said query with said rewritten selection condition.