sysop@hub:~/tools/database-slow$
database-slow
"The database is slow" in eight steps, for PostgreSQL, MySQL, MariaDB and SQL Server. Each step gives you the queries for all of them, tells you what to look at, and asks what you see. Start at the top: steps 2 to 5 find most causes.
what you found
The queries read system views and need an administrative account. They change nothing, except where a step says so. Stopping a session rolls its work back, which can take as long as the work did. Related: PostgreSQL, MySQL and MariaDB and SQL Server cheat sheets, SQL playground, the Linux server is slow.