Is your application multi-tenancy, where each tenant lives in its own database? We have such a scenario at VividCortex, and many of our customers do as well. Wouldn’t it be nice to understand which tenants are causing more load than others, which are the noisy neighbors impacting others’ experience, and so on? Well, now you can!
We now support per-database metrics in Top Queries. You can change the Rank menu from Queries to Databases, and you will see a breakdown of database activity in the familiar format, all in 1-second resolution.
As you can see from the Lock Waits column in the image, computed columns work as usual too, so you can quickly figure out which databases are consuming more resources such as CPU or IO in addition to the standard metrics (time, count, latency, and so on).
We detect the database by sniffing it from the TCP traffic, as usual. There are three places we can capture it: during connection, from a
COM_CHANGE_DB packet, or from a
USE command in SQL. As you can see, sometimes we can’t detect a database for a connection, so we show that as
unknown_database. If a connection simply does not have a default database, we will show that as
If this piques your interest, but your multitenancy model doesn’t work per-database, there’s another option – we can generate custom per-tenant metrics from tags embedded in query comments. We’ve supported this for a long time, and our early customers use it extensively. Comments tags are in name-value pairs, and we pull the name and value out and use it to generate metrics.