1
0
Fork 0

Add profile query example

This commit is contained in:
Wilfried Goesgens 2016-02-10 15:52:44 +01:00
parent d57a7efd3e
commit 3514e30a96
1 changed files with 28 additions and 2 deletions

View File

@ -234,3 +234,29 @@ on the server-side and may be able to apply optimizations if a result set is not
a client.
!SUBSUBSECTION Using cursors to obtain additional information on internal timings
Cursors can also optionally provide statistics of the internal execution phases. By default, they do not.
To get to know how long parsing, otpimisation, instanciation and execution took,
make the server return that by setting the *profile* attribute to
*true* when creating a statement:
@startDocuBlockInline 06_workWithAQL_statements11
@EXAMPLE_ARANGOSH_OUTPUT{06_workWithAQL_statements11}
|stmt = db._createStatement( {
| "query": "FOR i IN [ 1, 2, 3, 4 ] RETURN i",
options: {"profile": true}} );
@END_EXAMPLE_ARANGOSH_OUTPUT
@endDocuBlock 06_workWithAQL_statements11
After executing this query, you can use the *getExtra()* method of the cursor to get the
produced statistics:
@startDocuBlockInline 06_workWithAQL_statements12
@EXAMPLE_ARANGOSH_OUTPUT{06_workWithAQL_statements12}
~var stmt = db._createStatement( { "query": "FOR i IN [ 1, 2, 3, 4 ] RETURN i", options: {"profile": true}} );
var c = stmt.execute();
c.getExtra();
@END_EXAMPLE_ARANGOSH_OUTPUT
@endDocuBlock 06_workWithAQL_statements12