User bio
404 bio not found
Member since Nov 9, 2015
Replies:
David Loveluck · Aug 13, 2025 go to post

The previous replies talk about getting the free space for all the databases on the instance. That might be what really wanted.
But you asked about namespaces and I can see use cases where the alert would go to different people for different namepaces.
In that case, you need to figure out which databases a namespace uses. You need to find out what every global is mapped to, and add it to a list.
The documentation AI says this will do it, but I haven't checked.
 

Set namespace = "YourNamespace" Set $Namespace = namespace

Set mappings = ##class(Config.Namespaces).Open(namespace).Globals()

For {       Set global = mappings.GetNext(.sc)

Quit:global=""

Write "Global: ", global, " -> Database: ", mappings.Get(global), !

}

Assuming that is accurate, you probably want to replace the Write statement with something like 

      set databases(mappings.Get(global))=""

and then after the for loop, loop through that array of databases to get the free space.
 

David Loveluck · Oct 14, 2024 go to post

Emmanuel
That is a big question and it depends on what you are doing.
If you are writing SQL queries, then look at the SQL performance statistics in INFORMATION_SCHEMA.STATEMENT_DAILY_STATS. 
If you are using an interoperability production, look at the activity and volume statistics.
For general database activity, you could use ^SystemPerformance as described, but with that you have to process the data with an extra tool and it is difficult to interpret. I suggest you enable the History Monitor. It will give you almost everything ^SystemPerformance gives you, with a fraction of the effort. You just look at the DB and CPU stats with SQL.

Certifications & Credly badges:
David has no Certifications & Credly badges yet.
Followers:
David has no followers yet.
Following:
David has not followed anybody yet.