  A well-established technique for capturing database provenance as annotations
on data is to instrument queries to propagate such annotations. However, even
sophisticated query optimizers often fail to produce efficient execution plans
for instrumented queries. We develop provenance-aware optimization techniques
to address this problem. Specifically, we study algebraic equivalences targeted
at instrumented queries and alternative ways of instrumenting queries for
provenance capture. Furthermore, we present an extensible heuristic and
cost-based optimization framework utilizing these optimizations. Our
experiments confirm that these optimizations are highly effective, improving
performance by several orders of magnitude for diverse provenance tasks.
