||We propose an XQuery cost model that is able to estimate the performance gain of source-level transformation. The cost of major language constructs, including FLWOR, quantified, path, element construction, and predicate expressions are captured. The evaluation of optimization using existing real engines suffer from problems, such as lack of applicability to other engines, instability that comes from evolution,
difficulties in reproduction as a result of difficulties in acquisition, as well as unsuitability for evaluation of the optimization based on a static analysis in the absence of run-time information. This research is a first attempt to provide a virtual engine to facilitate the evaluation of various optimization techniques without introducing real engines. The
cost model consists of simple recursive functions based on functional language constructs. They are determined using formal semantics and other known efficient algorithms. The model enables analytic comparison of costs between expressions before and after transformation in an engine-independent manner. An engine-specific evaluation strategy can be incorporated if necessary. We have succeeded in proving that various transformations, including auxiliary ones used in optimization are not cost-increasing, as well as in detecting cost-increasing transformations that should be avoided.