How can I get number of active connections to my DB?

Hi, I have a MemSQL DBMS with several DBs. I would like to know the throughput, activity and connection count for the cluster and for the specific database. Is it possible to get this information from the INFORMATION_SCHEMA?

I was looking in INFORMATION_SCHEMA and in SHOW DATABASES EXTENDED with no luck. Do you have any ideas where can I find this information? I don’t have access to the server shell, so I need to use the database query only.

Hi Beniamin,

Thank you for reaching out!

SHOW STATUS has four key elements that show the query rate for the cluster (below). It will give you information for a point in time.

However, if you set up SingleStore DB’s monitoring solution, then you can get data overtime. Specifically, we have pre-built dashboards that show these rates across the whole cluster.

Successful_read_queries 0 Number of read queries which have successfully run since server startup.
Successful_write_queries 0 Number of write queries which have successfully run since server startup.
Failed_read_queries 0 Number of read queries which have failed since server startup.
Failed_write_queries 0 Number of write queries which have failed since server startup.

Please let me know if you have any questions

Thank you. Do you know if it is possible to find a query number relating with each database separately?

@roxannapourzand I just wanted to know how many clients/connections are send to the specific database (either in last time period of overall)

Hi Beniamin,

As far as the variables I mentioned above, they are only cluster level. However, you can use the processlist to get connections on the database level.

SELECT * FROM INFORMATION_SCHEMA.MV_PROCESSLIST shows all the queries running on the cluster. If you filter by the field db, or group by db, you can get the number of connections by database.

For example:

singlestore> select db, count(*) from information_schema.mv_processlist where db is not NULL group by 1
    -> ;
+--------------------+----------+
| db                 | count(*) |
+--------------------+----------+
| information_schema |        2 |
| metrics            |        2 |
+--------------------+----------+

That’s awesome, thank you Roxanna.

1 Like