Performance
Friday, 21 March 2014 · 2 messages
ML
Marco Lettere21 Mar 2014 10:38 #
Hello to everyone,
while trying to trace the performance I could expect from my RestXQ app I created a DB with something like 300/400k documents. For the test the documents are rather homogenoeus and stored plainly in the DB root collection.
I had two major objectives.
1) understand the behaviour of the query when run on a significant (even if not huge) number of documents.
I've noticed that something like collection('db')/a[@att = 'xxx' and b/text() = 'zzz']
on my laptop (Intel I7, 8 GB Ram and SSD) takes some 5 to 7 seconds. Is this reasonable? I was expecting slightly better performance but I must admit that the documents are rather similar thus maybe the indexing is not very selective.
What I noticed and this is feeling strange is that the time is often spent in rather similar proportion between query compilation and query evaluation and in some runs (1 every 5) most of the time is spent in compilation and only few msec in evaluation. But the query is rather simple so I assume that time spent in opening large collections (or accessing the indexes) is computed in the compilation phase. Is it like that?
Is there a way to restructure my query to be somehow more selective reducing the time of accessing the collection/index?
2) to measure the difference between the same query when run directly and when run through
xquery:eval.
Here I noticed that the difference between plain and xquery:eval() execution is negligible when the time for the evaluation increases. So I assume that the xquery:eval is using the indexing system even if this is not reported in the info view of the GUI. Is it like that?
Thank you all.
Regards,
Marco.CG
Christian Grün21 Mar 2014 11:34 #
Quoted text · Marco Lettere · 2 lines
> collection('db')/a[@att = 'xxx' and b/text() = 'zzz'] > on my laptop (Intel I7, 8 GB Ram and SSD) takes some 5 to 7 seconds.
How does your query plan look like?
Quoted text · Marco Lettere · 4 lines
> What I noticed and this is feeling strange is that the time is often spent > in rather similar proportion between query compilation and query evaluation > and in some runs (1 every 5) most of the time is spent in compilation and > only few msec in evaluation.
Do the query plany differ as well? What times do you get?
Quoted text · Marco Lettere · 4 lines
> Here I noticed that the difference between plain and xquery:eval() execution > is negligible when the time for the evaluation increases. So I assume that > the xquery:eval is using the indexing system even if this is not reported in > the info view of the GUI. Is it like that?
Exactly;
xquery:eval queries are optimized the same way as usual queries.Written for BaseX 7.8. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery