XQuery Efficiency


In my earlier post on XQuery, I said that XQuery was "imperative" and that's not strictly true. It is true that the for construct makes it look familiar and approachable to an imperative programmer, but it turns out that FLWOR blocks can be compiled to relational operators and have close analogs in SQL.

I was discussing XQuery over lunch with some colleagues and we got talking about XQuery efficiency. The bottom line for me is that if I'm using XML, I've got more confidence in the efficiency of the XQuery engine in DbXml than I do in the quick code I could write to do the joins, sorting, and filtering outside the DB. What's more, the XQuery implementation is likely to improve, which means that my code will get faster each time I upgrade the database.