ARTIFICIAL INTELLIGENCE 171 Ordering Conjunctive Queries David E. Smith and Michael R. Genesereth Computer Science Department, Stanford University, Stanford, CA 94305, U.S.A. Recommended by Drew McDermott ABSTRACT Conjunctive problems are pervasive in artificial intelligence and database applications. In general, such problems cannot be solved without carefully ordering the set of conjuncts for the problem-solving system. In this paper, the problem of determining the best ordering for a set of conjuncts is addressed. We first show how simple information about set sizes can be used to estimate the cost of solving a conjunctive problem. Assuming the availability of this information, methods for ordering conjuncts are developed, based on several theorems and corollaries about ordering. We also consider two well- known heuristic ordering rules and discuss their advantages and disadvantages. Finally, the overall efficiency of including conjunct ordering in a problem solver is considered. To help reduce the overhead we present an approach of monitoring problem -solving cost at run-time. In this way conjunct ordering is limited to difficult problems where the cost of ordering is less significant. We also consider several issues involved in extending conjunct ordering to problems involving inference and planning problems. I. Introduction A conjunctive problem is a set of propositions which share variables and must be satisfied simultaneously. Such problems occur in every sort of intelligent system as well as in many other kinds of programs. For example, any non- trivial PROLOG program contains conjunctive clauses, and most interesting database queries are conjunctions. In problem solvers and planners that deal with a wide range of tasks, conjunctive problems are often given to the top level. They also occur as the result of conjunctive rule premises in the knowledge base. In expert systems, this is the primary source of conjunctive problems. For example, in the MVCINsystem [2], nearly all of the over 400 rule premises are conjunctions of two or more clauses. Occasionally, with inference, a system can reduce a conjunctive problem to a single conjunct, and can readily enumerate the answers to that conjunct. But more often, no such reduction is possible, either because the system does not Artificial Intelligence 26 (1985) 171-215 0004-3702/85/$3.30 O 1985, Elsevier Science Publishers B.V. (North-Holland)