Hello,

I was stressing the BaseX 8.6 planner/optimizer when I noticed that expressions like `count(//elem)` are not optimized at all, even though they are correctly indexed, as demonstrated by `index:element-names()`.

The current database is a 300 MB TEI document. All the elements are in the `http://www.tei-c.org/ns/1.0` namespace.

The following test case will report the correct number, but it will take a couple of seconds to run, instead of a few milliseconds.

```
declare namespace tei="http://www.tei-c.org/ns/1.0";;

let $n := index:element-names("monier")[. = 're']/@count

let $c := count(//tei:re)

return <res><in-index>{$n}</in-index><in-doc>{$c}</in-doc></res>
```

I wonder if the presence of the namespace somehow confuses the optimizer. The same problem can be observed running the same test case with

```
declare default element namespace "http://www.tei-c.org/ns/1.0";;
[...]
let $c := count(//re)
```

Regards,

--
Gioele Barabucci <[email protected]>

Reply via email to