public class AqlQueryOptions extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
AqlQueryOptions.Optimizer |
static class |
AqlQueryOptions.Options |
Constructor and Description |
---|
AqlQueryOptions() |
public Boolean getCount()
public AqlQueryOptions count(Boolean count)
count
- indicates whether the number of documents in the result set should be returned in the "count"
attribute of the result. Calculating the "count" attribute might have a performance impact for some
queries in the future so this option is turned off by default, and "count" is only returned when
requested.public Integer getTtl()
public AqlQueryOptions ttl(Integer ttl)
ttl
- The time-to-live for the cursor (in seconds). The cursor will be removed on the server automatically
after the specified amount of time. This is useful to ensure garbage collection of cursors that are
not fully fetched by clients. If not set, a server-defined value will be used.public Integer getBatchSize()
public AqlQueryOptions batchSize(Integer batchSize)
batchSize
- maximum number of result documents to be transferred from the server to the client in one roundtrip.
If this attribute is not set, a server-controlled default value will be used. A batchSize value of 0
is disallowed.public Long getMemoryLimit()
public AqlQueryOptions memoryLimit(Long memoryLimit)
memoryLimit
- the maximum number of memory (measured in bytes) that the query is allowed to use. If set, then the
query will fail with error "resource limit exceeded" in case it allocates too much memory. A value of
0 indicates that there is no memory limit.public Boolean getCache()
public AqlQueryOptions cache(Boolean cache)
cache
- flag to determine whether the AQL query cache shall be used. If set to false, then any query cache
lookup will be skipped for the query. If set to true, it will lead to the query cache being checked
for the query if the query cache mode is either on or demand.public Boolean getFillBlockCache()
public AqlQueryOptions fillBlockCache(Boolean fillBlockCache)
fillBlockCache
- if set to true
or not specified, this will make the query store
the data it reads via the RocksDB storage engine in the RocksDB block cache. This is
usually the desired behavior. The option can be set to false
for queries that
are known to either read a lot of data that would thrash the block cache, or for queries
that read data known to be outside of the hot set. By setting the option
to false
, data read by the query will not make it into the RocksDB block cache if
it is not already in there, thus leaving more room for the actual hot set.protected com.arangodb.velocypack.VPackSlice getBindVars()
protected AqlQueryOptions bindVars(com.arangodb.velocypack.VPackSlice bindVars)
bindVars
- key/value pairs representing the bind parametersprotected String getQuery()
protected AqlQueryOptions query(String query)
query
- the query which you want parsepublic Boolean getFailOnWarning()
public AqlQueryOptions failOnWarning(Boolean failOnWarning)
failOnWarning
- When set to true, the query will throw an exception and abort instead of producing a warning. This
option should be used during development to catch potential issues early. When the attribute is set to
false, warnings will not be propagated to exceptions and will be returned with the query result. There
is also a server configuration option --query.fail-on-warning for setting the default value for
failOnWarning so it does not need to be set on a per-query level.public AqlQueryOptions maxRuntime(Double timeout)
timeout
- The query has to be executed within the given runtime or it will be killed. The value is specified
in seconds. The default value is 0.0 (no timeout).public Boolean getProfile()
public AqlQueryOptions profile(Boolean profile)
profile
- If set to true, then the additional query profiling information will be returned in the sub-attribute
profile of the extra return attribute if the query result is not served from the query cache.public Long getMaxTransactionSize()
public AqlQueryOptions maxTransactionSize(Long maxTransactionSize)
maxTransactionSize
- Transaction size limit in bytes. Honored by the RocksDB storage engine only.public Long getMaxWarningCount()
public AqlQueryOptions maxWarningCount(Long maxWarningCount)
maxWarningCount
- Limits the maximum number of warnings a query will return. The number of warnings a query will return
is limited to 10 by default, but that number can be increased or decreased by setting this attribute.public Long getIntermediateCommitCount()
public AqlQueryOptions intermediateCommitCount(Long intermediateCommitCount)
intermediateCommitCount
- Maximum number of operations after which an intermediate commit is performed automatically. Honored by
the RocksDB storage engine only.public Long getIntermediateCommitSize()
public AqlQueryOptions intermediateCommitSize(Long intermediateCommitSize)
intermediateCommitSize
- Maximum total size of operations after which an intermediate commit is performed automatically.
Honored by the RocksDB storage engine only.public Double getSatelliteSyncWait()
public AqlQueryOptions satelliteSyncWait(Double satelliteSyncWait)
satelliteSyncWait
- This enterprise parameter allows to configure how long a DBServer will have time to bring the
satellite collections involved in the query into sync. The default value is 60.0 (seconds). When the
max time has been reached the query will be stopped.public Boolean getSkipInaccessibleCollections()
public AqlQueryOptions skipInaccessibleCollections(Boolean skipInaccessibleCollections)
skipInaccessibleCollections
- AQL queries (especially graph traversals) will treat collection to which a user has no access rights
as if these collections were empty. Instead of returning a forbidden access error, your queries will
execute normally. This is intended to help with certain use-cases: A graph contains several
collections and different users execute AQL queries on that graph. You can now naturally limit the
accessible results by changing the access rights of users on collections. This feature is only
available in the Enterprise Edition.public Boolean getFullCount()
public AqlQueryOptions fullCount(Boolean fullCount)
fullCount
- if set to true and the query contains a LIMIT clause, then the result will have an extra attribute
with the sub-attributes stats and fullCount, { ... , "extra": { "stats": { "fullCount": 123 } } }. The
fullCount attribute will contain the number of documents in the result before the last LIMIT in the
query was applied. It can be used to count the number of documents that match certain filter criteria,
but only return a subset of them, in one go. It is thus similar to MySQL's SQL_CALC_FOUND_ROWS hint.
Note that setting the option will disable a few LIMIT optimizations and may lead to more documents
being processed, and thus make queries run longer. Note that the fullCount attribute will only be
present in the result if the query has a LIMIT clause and the LIMIT clause is actually used in the
query.public Integer getMaxPlans()
public AqlQueryOptions maxPlans(Integer maxPlans)
maxPlans
- Limits the maximum number of plans that are created by the AQL query optimizer.public Collection<String> getRules()
public AqlQueryOptions rules(Collection<String> rules)
rules
- A list of to-be-included or to-be-excluded optimizer rules can be put into this attribute, telling the
optimizer to include or exclude specific rules. To disable a rule, prefix its name with a -, to enable
a rule, prefix it with a +. There is also a pseudo-rule all, which will match all optimizer rulespublic Boolean getStream()
public AqlQueryOptions stream(Boolean stream)
stream
- Specify true and the query will be executed in a streaming fashion. The query result is not stored on
the server, but calculated on the fly. Beware: long-running queries will need to hold the collection
locks for as long as the query cursor exists. When set to false a query will be executed right away in
its entirety. In that case query results are either returned right away (if the resultset is small
enough), or stored on the arangod instance and accessible via the cursor API (with respect to the
ttl). It is advisable to only use this option on short-running queries or without exclusive locks
(write-locks on MMFiles). Please note that the query options cache, count and fullCount will not work
on streaming queries. Additionally query statistics, warnings and profiling data will only be
available after the query is finished. The default value is falsepublic Collection<String> getShardIds()
public AqlQueryOptions shardIds(String... shardIds)
shardIds
- public String getForceOneShardAttributeValue()
public AqlQueryOptions forceOneShardAttributeValue(String forceOneShardAttributeValue)
forceOneShardAttributeValue
- This query option can be used in complex queries in case the query optimizer
cannot automatically detect that the query can be limited to only a single
server (e.g. in a disjoint smart graph case).
If the option is set incorrectly, i.e. to a wrong shard key value, then the
query may be shipped to a wrong DB server and may not return results (i.e.
empty result set).
Use at your own risk.public AqlQueryOptions allowDirtyRead(Boolean allowDirtyRead)
allowDirtyRead
- Set to true
allows reading from followers in an active-failover setup.public Boolean getAllowDirtyRead()
public String getStreamTransactionId()
public AqlQueryOptions streamTransactionId(String streamTransactionId)
streamTransactionId
- If set, the operation will be executed within the transaction.Copyright © 2016–2023 ArangoDB GmbH. All rights reserved.