Author: thomasm
Date: Tue Feb 11 14:03:13 2014
New Revision: 1567132

URL: http://svn.apache.org/r1567132
Log:
OAK-1395 Automatically cancel long running queries

Modified:
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/query.md

Modified: jackrabbit/oak/trunk/oak-doc/src/site/markdown/query.md
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-doc/src/site/markdown/query.md?rev=1567132&r1=1567131&r2=1567132&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-doc/src/site/markdown/query.md (original)
+++ jackrabbit/oak/trunk/oak-doc/src/site/markdown/query.md Tue Feb 11 14:03:13 
2014
@@ -24,6 +24,41 @@ work but probably be very slow.
 
 Query Indices are defined under the `oak:index` node.
 
+### Compatibility
+
+The query parser is now generally more strict about invalid syntax.
+The following query used to work in Jackrabbit 2.x, but not in Oak,
+because multiple way to quote the path are used at the same time:
+
+    SELECT * FROM [nt:base] AS s 
+    WHERE ISDESCENDANTNODE(s, ["/libs/sling/config"])
+    
+Instead, the query now needs to be:
+
+    SELECT * FROM [nt:base] AS s 
+    WHERE ISDESCENDANTNODE(s, [/libs/sling/config])
+    
+### Slow Queries and Read Limits
+
+Slow queries are logged as follows:
+
+    *WARN* Traversed 1000 nodes with filter Filter(query=select ...)
+    consider creating an index or changing the query
+
+If this is the case, an index might need to be created, or the condition 
+of the query might need to be changed to take advantage of an existing index.
+
+If a query reads more than 10 thousand nodes in memory, then the query is 
cancelled
+with an UnsupportedOperationException saying that 
+"The query read more than 10000 nodes in memory. To avoid running out of 
memory, processing was stopped."
+As a workaround, this limit can be changed using the system property 
"oak.queryLimitInMemory".
+
+If a query traversed more than 100 thousand nodes (for example because there 
is no index
+at all and the whole repository is traversed), then the query is cancelled
+with an UnsupportedOperationException saying that 
+"The query read or traversed more than 10000 nodes. To avoid affecting other 
tasks, processing was stopped.".
+As a workaround, this limit can be changed using the system property 
"oak.queryLimitReads".
+
 ### XPath to SQL2 Transformation
 
 To support the XPath query language, such queries are internally converted to 
SQL2. 
@@ -41,20 +76,6 @@ Every conversion is logged in `debug` le
 
 _Each transformed SQL2 query contains the original XPath query as a comment._
 
-### Compatibility
-
-The query parser is now generally more strict about invalid syntax.
-The following query used to work in Jackrabbit 2.x, but not in Oak,
-because multiple way to quote the path are used at the same time:
-
-    SELECT * FROM [nt:base] AS s 
-    WHERE ISDESCENDANTNODE(s, ["/libs/sling/config"])
-    
-Instead, the query now needs to be:
-
-    SELECT * FROM [nt:base] AS s 
-    WHERE ISDESCENDANTNODE(s, [/libs/sling/config])
-
 ### Query Processing
 
 Internally, the query engine uses a cost based query optimizer that asks all 
the available
@@ -177,5 +198,3 @@ The returned value is supposed to be an 
 
 If an index implementation can not query the data, it has to return 
`Double.POSITIVE_INFINITY`.
 
-TODO Traversal warnings
-


Reply via email to