Efficient evaluation of production rules in a DBMS