A pseudo-function that tells the optimizer to avoid indexing a filter expression.

unindexed($input as item()*) ➔ xs:string





The expression to be evaluated without indexing




Saxon availability

Requires Saxon-EE. Implemented since Saxon 11.

Notes on the Saxon implementation

Available since Saxon 11.


The function returns the value of its argument unchanged.

The reason for calling this function is that it signals to the optimizer that the argument expression (which will typically be a filter expression) should not result in construction of an index.

For example, Saxon would normally build an index to evaluate an expression such as //person[@ssn=$ssn]. But there are cases where this is not the best strategy, for example:

  • If the expression will only be evaluated once.
  • If impure extension functions are used to modify the data between evaluations.
  • If the set of nodes selected by //person is small.
  • If most of the nodes selected by //person have the same value for @ssn.

Writing saxon:unindexed(//person[@ssn=$ssn]) delivers the same result, but using a serial search of the data.