Search code examples
sessiongoogle-cloud-platformgoogle-cloud-spanner

Show the number of open sessions on a spanner database


Is there a way to display the number of currently open sessions on a database in google spanner?

The limit is mentioned here:

Sessions per database per node - 10,000

I have looked through the documentation on SQL functions and gcloud spanner command line tool, but neither mentioned a way to show how many were open.


Solution

  • There is now a command to list active sessions:

    gcloud spanner databases sessions list --instance <your-spanner-instance> --database <your-database>

    You can then parse this file or count the lines and figure out how many open sessions there are.