Recently, compare the query performance of xpath and JCR-SQL2 in jackrabbit, although JCR no longer recommends the use of xpath from version 2.0, but in terms of the query performance, XPath seems much higher than the JCR-SQL2
The following are the comparison results.
Test environment:
Jackrabbit 2.2.7
Windows 2003
4 GB memory
AMD athlon (TM) II X4 640 3.01 GHz processor
Data source:
1033 node records, including 917 files and 116 folders
Query comparison:
Test records |
JCR-SQL2 (MS) |
XPath (MS) |
1 |
2328 |
187 |
2 |
2484 |
188 |
3 |
2500 |
188 |
4 |
2344 |
187 |
5 |
2328 |
203 |
6 |
2344 |
187 |
7 |
2484 |
203 |
8 |
2344 |
188 |
9 |
2343 |
203 |
10 |
2343 |
188 |
Average |
2384 |
192 |
Query statement:
JCR-SQL2:
Select node. * from [krp: knode] As Node
Inner join [krp: krpacl] asacl on ischildnode (ACL, node)
Inner join [krp: kfolder] asparent on ischildnode (node, parent)
Wherecontains (ACL. [krp: browse], '1 ')
And issamenode (parent, '/krp/krepogroup [2]/krepository/kfolder ')
Order by node. [krp: folder] DESC
XPath:
// Krp/krepogroup [2]/krepository/kfolder/element (*, krp: kfolder) [kfolderacl/@ krp: browse = '1']