Specifying efficient evaluation strategies by meta-interpreters, and then eliminating the interpretation overhead by partial evaluation with respect to given object programs, is an elegant technique for the transformation of logic programs. In this paper we show how to apply this technique to the compilation of instantiation based evaluation strategies for DATALOG with negation, and hence to query optimization in deductive databases. We demonstrate our approach on two well-known optimizations, dealing with the passing of information between literals (sideways information passing strategies or SIPS), and the early evaluation of constraining literals (the C-transformation).