Expand my Community achievements bar.

SOLVED

QueryResult.getRows() returning very slowly

Avatar

Former Community Member

I'm doing a very simple query to find tags that match a given search term: 

ex) select * from [cq:Tag] as item where  contains(*,'queryTerm')  and  isdescendantnode(item, '/etc/tags/TagNamespace')

I am not using QueryBuilder. I'm using the JCR Query API directly. The query is executing very quickly never taking more than 44ms. However, when I try to retrieve the results from the query with QueryResult.getRows() or QueryResult.getNodes() my application consistently hangs for anywhere from 10,000 - 20,000 ms. Even more odd, I see these same slow times when there are no query results. 

I'm seeing this on AEM 6.0. 

Any thoughts would be most appreciated. 

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi,

In the jackrabbit implementation a JCR query is split into 2 parts: the execution and then fetching of the results. The result is returned lazy, therefor the decision was made to deliver the first results fast and accept a delay when displaying further results. This is different to common SQL databases, where you get your result set all at once (after a potential slow execution). So to judge the performance of a query, you always have to consider the execution and the time to fetch.

kind regards,
Jörg

View solution in original post

2 Replies

Avatar

Correct answer by
Employee Advisor

Hi,

In the jackrabbit implementation a JCR query is split into 2 parts: the execution and then fetching of the results. The result is returned lazy, therefor the decision was made to deliver the first results fast and accept a delay when displaying further results. This is different to common SQL databases, where you get your result set all at once (after a potential slow execution). So to judge the performance of a query, you always have to consider the execution and the time to fetch.

kind regards,
Jörg