In a relational database computer system including a data processor, a stored database and a plurality of database relations, wherein one or more of said relations are retrieved by the processor by means of query commands performing a plurality of join operations on said relations, a method for optimizing processing of said join operations, comprising the steps of:
- (a) assigning a join method at random to each of said join operations to produce a current join method assignment scheme;
- (b) identifying an optimal join order for said join operations given said current join method assignment scheme;
- (c) assigning a current join order scheme in response to said identified optimal join order;
- (d) identifying an optimal join method to be used for each said join operation given said current join order scheme;
- (e) assigning said current join method assignment scheme in response to said identified optimal join methods;
- and
- (f) repeating steps (b) through (e) until there is no change produced to said current join order scheme and said current join method assignment scheme.