# The `api/sql/stat` Resource

> The `api/sql/stat` resource displays database statistics for the SQL engine managing the database(s) and remote clients.

> ### For an overview see page eXtremeDB Web Service Resources

> With the REST server started (listening on port 8083), the following http request will display statistics for the SQL Engine and remote clients for the database(s):

>         http://localhost:8083/api/sql/stat

> For example, the page would appear like the following:

>         {
>             "clients":
>             [
>                 {
>                     "clientid": 107173520884043,
>                     "statementid": 1,
>                     "connected": 1,
>                     "begin": 1514548415379034,
>                     "ip": "0:0:0:0:0:0:0:1",
>                     "port": 57480,
>                     "state": "DONE",
>                     "sql": "select * from Statistic",
>                     "params" :
>                     {
>                         "total_size": 0,
>                         "elements":
>                         [
>                         ]
>                     },
>                     "failmsg": "",
>                     "memory": 70612,
>                     "rows": 0,
>                     "bytes": 176,
>                     "exectime": 776,
>                     "txtime": 51,
>                     "res_ucpu": 0,
>                     "res_scpu": 0,
>                     "res_inb": 0,
>                     "res_outb": 0,
>                     "res_maxrss": 0,
>                     "res_nswap": 0,
>                     "res_ncsw": 0
>                 },
>             ],
>             "sql_engine":
>             {
>                 "engine_heap_size": 724936,
>                 "total_heap_size": 0
>             }
>         }

> ## SQL Statistics

> ### clients

> The `clients` array displays the following statistics for each client:

> clientid | The Id of the client
> statementid | The Id of the statement
> connected | The client status: 1 = connected, 0 = disconnected
> begin | The query start timestamp
> ip | The client IP address
> port | The client port
> state | The statement execution state (`ACTIVE`, `DONE`, `FAILED` or `CANCELED`)
> sql | The SQL statement
> params | The array of the query parameters
> failmsg | The error message, if present
> memory | The peak memory consumption
> rows | The number of rows in the result set
> bytes | The result set size in bytes
> exectime | The statement execution time in microseconds
> txtime | The result set transmission time in microseconds
> res_ucpu | The CPU user time
> res_scpu | The CPU kernel time
> res_inb | The number of bytes read from persistent media
> res_outb | The number of bytes written to persistent media
> res_maxrss | The maximum resident set size
> res_nswap | The total swap size during the statement execution
> res_ncsw | The number of context switches during the statement execution

> ### sql_engine

> The `sql_engine` section displays the following statistics for the SQL Engine managing this database:

> engine_heap_size | The size of the heap reserved by the SQL engine allocator
> total_heap_size | The total heap allocated by the SQL engine