After migrating to DM or KingbaseES, the tooling you know no longer applies. This post lists the metrics worth collecting, a slow-SQL capture approach, deployment tips, and four pitfalls—charset, driver version, timing, and licensing—so you can build a reliable baseline.
After moving workloads to domestic databases like DM and KingbaseES, the first thing a DBA notices is that the old habits are gone: slow-query logs, performance_schema, pg_stat_statements—either they don't exist or they look nothing like before. When an incident hits, you're stuck guessing from vague built-in logs. The first job of an observability system is to fold these domestic databases into unified monitoring, sitting next to the hosts and applications in the same stack, instead of leaving them as a black-box island.
Whatever the underlying engine, build a baseline with these common metrics:
Observe connects to both engines through JDBC/standard collectors, pulling these metrics into one dashboard and aligning them on the same timeline as hosts and applications for easy cross-referencing. You don't need the full list on day one—collect connections, long transactions, and lock waits steadily for a week, plot the curves, and only then talk about alert thresholds.
Both DM and KingbaseES keep slow-SQL views, but the column names and how you enable them differ. For DM, turn on slow-statement recording with a threshold first:
-- DM: enable slow statement logging, 200ms threshold
SP_SET_PARA_VALUE(1, 'MONITOR_SQL_EXEC', 1);
ALTER SYSTEM SET 'SQL_TRACE_MASK' = 3;
The collector then polls the slow-SQL view on a schedule and reports execution count, average latency, rows scanned, and a digest of the SQL text. Two things matter here: mask the SQL text—replace parameters with ? so sensitive data never lands in your logs—and aggregate by template so the same statement with different parameters counts as one entry, which surfaces high-frequency slow queries instead of a thousand one-off variations.
Run the collector next to the database host or on the application side, connecting with a read-only account whose privileges stop at querying system views. Don't use a DBA account for collection against a production database—one mistake there is an incident. The default collection interval is 30 seconds; low-volume environments can stretch to 60 seconds to save overhead. Pull the slow-SQL view once a minute—trends tell you more than any single value. Xinchuang environments usually mean an isolated intranet with on-premises deployment, so the collector has to install offline and connect directly, with no dependency on the public internet.
One final suggestion: during migration, watch three numbers above all—slow-SQL count, long-transaction count, and lock waits. They best reflect whether the business is absorbing the new engine's performance profile. Add alert rules only once the baseline stabilizes, or you'll be chasing thresholds instead of real regressions.