![]() Note also that when splitting the query into chunks this won't provide snapshot isolation, but depending on the use case it may be good enough already. If result.field is not unique and there are no other unique keys in the collection covered by a skiplist, then the described method will be at least an approximation. That should work fine if result.field is unique. Now run the query again, but now with an additional FILTER: FOR result IN CollectionįILTER result.field > LIMIT 10000 RETURN result (I actually used a non-English word and not foo as needle, but that's irrelevant. Then process these first 10,000 documents offline, and note the result value of the last processed document. // This query took ca 11-13 ms: FOR t IN texts FILTER CONTAINS (LOWER (t.text), 'foo') RETURN KEEP (t, 'text', 'createtime') This issue might be relevant, which is related to this question: On multiple index usage in ArangoDB. If a large result set is desired, LIMIT can be used to retrieve slices of the results in several chunks, which will cause less stress on the machine.įor example, first iteration: FOR result IN Collection SORT result.field LIMIT 10000 RETURN result However, the query will still build a huge result in memory which will take time and consume RAM. If the index is present and non-sparse, then the query should use the index for sorting and no additional sorting will be required - which can be revalidated using Explain. This can be revalidated by running db.Collection.getIndexes() If there is a skiplist index present on the field attribute, it could be used for the sort. There are two fundamental types of AQL queries: queries which access data (read documents) queries which modify data (create, update, replace, delete documents) Data Access Queries Retrieving data from the database with AQL does always include a RETURN operation. ![]()
0 Comments
Leave a Reply. |