[xquery-talk] What do people do about warnings?

Michael Kay mike at saxonica.com
Fri Jan 12 11:45:31 PST 2007


> I'm surprised that you find it necessary to try to fool the 
> query optimiser into not getting rid of your trace() function 
> call. I would consider it a bug if it was optimised out of 
> your query - certainly the XQuery implementations I work on 
> would not do that.

It's a difficult decision. People might be using trace() to debug the logic
of the application, in which case it makes sense for the optimizer to treat
trace() as a signal to optimize less aggressively. On the other hand, they
might be using trace() to examine how the optimized query actually executes,
in which case the optimizer should try and treat a query containing trace()
calls exactly as if those calls weren't there: which means for example that
if the expression being traced isn't actually evaluated, then it isn't
traced.

Saxon tends towards the latter. For example if you write

(1 to 10, trace($x, "banana"))[1]

you will see no trace output, because the trace() expression is never
evaluated.

Michael Kay
http://www.saxonica.com/




More information about the talk mailing list