There are a few rules-of-thumb, of course, like avoiding stage-2 predicates in "sensitive" places, or avoiding multiple scans through large tables. Sometimes, it's just a matter of rewriting the SQL query (e.g., join instead of subquery or vice versa) and trying out which one takes longest to terminate ;-)