Hi arcogabbo, Nearly 100% of the compile time is caused by the parsing of your 8 MB input file. If you create a database from the XML file, your query will be evaluated much faster. After you have created the database, you can save additional time by using db:open('name-of-the-db') instead of doc('name-of-the-input.xml'). Hope this helps, Christian On Tue, Jul 13, 2021 at 1:09 PM arcogabbo <arcogabbo@gmail.com> wrote:
Hi, I admit this is my first experience with BaseX and XQuery language, but this seems weird and i can't find anything on docs or issues related to this. I created a random dataset of calls and i wanted to query this dataset using XQuery, however it turns out compile time takes too long for a relatively simple query. The dataset can be found here .
The query is: doc("basex/etc/dataset25k.xml")/users/user[number= "605 6230540" and calls/call/location/@city = "Sandy Springs"]/fullName
Timing: - Parsing: 0.61 ms - Compiling: 382.43 ms - Evaluating: 2.1 ms - Printing: 0.14 ms - Total Time: 385.28 ms
Compiling: - rewrite fn:doc(uri) to document-node() item: doc("basex/etc/dataset25k.xml") -> document { "file:///home/arcogabbo/Scrivania/basex/etc/dataset25k.xml" } - rewrite to predicate: ((number = "605 6230540") and (calls/call/location/@city = "Sandy Springs")) - apply attribute index for "Sandy Springs"
Even if i try a simple query on the example dataset of the application(factbook.xml) the compilation time takes too long, for example:
Query: doc("basex/etc/factbook.xml")/mondial/country[@name="Norway"]/province/city
Timing: - Parsing: 0.34 ms - Compiling: 82.29 ms - Evaluating: 1.05 ms - Printing: 1.49 ms - Total Time: 85.17 ms
Compiling: - rewrite fn:doc(uri) to document-node() item: doc("basex/etc/factbook.xml") -> document { "file:///home/arcogabbo/Scrivania/basex/etc/factbook.xml" } - apply attribute index for "Norway"
I also tried BaseX version 9.5 and on another computer, yet compilation times are approximately the same. Any help is appreciated.