Chapter 13. Query Optimization
One of the key ideas behind XQuery was to create a language with a solid formal basis, like SQL has the relational calculus, and to encourage query optimization. In this chapter we explore what the XQuery standard says about optimization, and the effects query optimization have on your query—actually, more what effects your queries have on the optimizations that can be performed.
Every XQuery implementation optimizes its queries differently. Some don't perform any optimization at all, while others optimize queries so much you wouldn't even recognize them anymore. Here we focus on what optimizations can be performed, not necessarily what optimizations are performed by your particular implementation.