Queries Module
The query module provides the infrastructure for working with currently running AQL queries via arangosh.
Returns the servers current query tracking configuration; we change the slow query threshold to get better results:
Show execution results
- {
- "code" : 200,
- "enabled" : true,
- "trackSlowQueries" : true,
- "trackBindVars" : true,
- "maxSlowQueries" : 64,
- "slowQueryThreshold" : 10,
- "slowStreamingQueryThreshold" : 10,
- "maxQueryStringLength" : 4096
- }
- {
- "code" : 200,
- "trackSlowQueries" : true,
- "trackBindVars" : true,
- "maxSlowQueries" : 64,
- "slowQueryThreshold" : 1,
- "slowStreamingQueryThreshold" : 10,
- "maxQueryStringLength" : 4096
- }
- {
- "code" : 200,
- "enabled" : true,
- "trackSlowQueries" : true,
- "trackBindVars" : true,
- "maxSlowQueries" : 64,
- "slowQueryThreshold" : 1,
- "slowStreamingQueryThreshold" : 1,
- "maxQueryStringLength" : 4096
- }
Hide execution results
We create a task that spawns queries, so we have nice output. Since this taskuses resources, you may want to increase (and not forget to remove it… afterwards):
- arangosh> var tasks = require("@arangodb/tasks");
- arangosh> tasks.register({
- ........> id: "mytask-1",
- ........> name: "this is a sample task to spawn a slow aql query",
- ........> command: "require('@arangodb').db._query('" + theQuery + "');"
- ........> });
- arangosh> queries.current();
Hide execution results
The function returns the currently running AQL queries as an array.
The function returns the last AQL queries that exceeded the slow query threshold as an array:
- arangosh> queries.slow();
Show execution results
- [ ]
Hide execution results
Show execution results
- {
- "code" : 200
- }
- [ ]
Hide execution results
Kill a running AQL query:
- arangosh> var runningQueries = queries.current().filter(function(query) {
- ........> return query.query === theQuery;
- ........> });
- arangosh> queries.kill(runningQueries[0].id);
Show execution results
Hide execution results