surrealdb / surrealdb

A scalable, distributed, collaborative, document-graph database, for the realtime web
https://surrealdb.com
Other
27.96k stars 917 forks source link

Feature: DBA tools (list active connections/queries) #3173

Open LucyEgan opened 11 months ago

LucyEgan commented 11 months ago

Is your feature request related to a problem?

Currently when theres a performance/abuse releated issue theres no simple way to see/kill running queries

Describe the solution

Able to view running connections (quick example) INFO FOR CONNECTIONS

{
   "connection-id":{
        "queries": 0,
        "successfulQueriesCount": 0,
        "failedQueriesCount": 0,
        "runningQueriesCount": 0,
        "bytesRecieved": 0,
        "bytesSent": 0,
        "runningQueries": {
               "query-id":{
                     "query": "SELECT *, (SELECT count(), (SELECT count() FROM accounts GROUP ALL) as hahaha FROM accounts GROUP ALL) as haha FROM accounts",
                      "started|runtime": "2021-02-03...|2y"
               }
        ]
    }
}

Able to kill the whole connection of a accidental long running query/someone sending abusive queries KILL CONNECTION {connection-id}

Able to kill a single query of a accidental long running query/someone sending abusive queries KILL CONNECTION {connection-id} QUERY {query-id} KILL QUERY {query-id}

Alternative methods

Monitoring connections/queries via a WS proxy, but no way to kill the queries that are running from what i can tell.

SurrealDB version

1.0.0+20231211.28e3547 for linux on x86_64

Contact Details

lucy.e@aspirecomps.co.uk

Is there an existing issue for this?

Code of Conduct

sgirones commented 10 months ago

yes, this is definitely something we want to add to the database 👍