Skip to content

Commit

Permalink
Merge pull request #202 from Saifallak/fix/mysql-count-per-user
Browse files Browse the repository at this point in the history
Mysql Connections Count is not accurate Fixes #198
  • Loading branch information
freekmurze committed Nov 8, 2023
2 parents 51eafac + a56c914 commit 8740e80
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Support/DbConnectionInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class DbConnectionInfo
public function connectionCount(ConnectionInterface $connection): int
{
return match (true) {
$connection instanceof MySqlConnection => (int) $connection->selectOne('show status where variable_name = "threads_connected"')->Value,
$connection instanceof MySqlConnection => (int) $connection->selectOne('SELECT COUNT(*) FROM information_schema.PROCESSLIST')->{"COUNT(*)"},
$connection instanceof PostgresConnection => (int) $connection->selectOne('select count(*) as connections from pg_stat_activity')->connections,
default => throw DatabaseNotSupported::make($connection),
};
Expand Down

0 comments on commit 8740e80

Please sign in to comment.