Database performance
When a database gets slower, the same questions apply whichever engine you run. Here’s how to work through them, and what SQL Cockpit can show you on each one.
The problem
“The database is slow” can mean many things: a queue behind one lock, too many connections, a cold cache, a changed query plan or a disk running out of room. Tuning before you know which one you’re dealing with usually wastes time.
Recognise the symptoms
- Pages or reports slowing down with no obvious release to blame
- Timeouts that come and go at busy times
- Sessions or connections climbing higher than usual
- Disk reads rising while the workload looks the same
A practical approach
Check what changed
Start with the time it began. Look for releases, data growth, new jobs or configuration changes around then, and compare with a period when things were fine.
Look for waiting before working
See whether sessions are running or stuck behind others. A queue behind one lock needs a different fix from a server that’s simply busy.
Check activity and storage
Compare reads, transactions and cache behaviour with your normal figures, and check that the database isn’t short of space. Cumulative ratios can hide a recent change, so compare over a known period.
Find the query, then change one thing
Use query statistics and execution plans to find the statement responsible. Make one targeted change, then compare the same figures under a similar workload.
Database performance by technology
SQL Server
Available: Active sessions, CPU, long-running queries and blocking chains; SQL Agent job and step runtimes; and Query Analyser for explaining and optimising queries.
Query Store, execution plans and dynamic management views.
PostgreSQL
Read-only figures: Connected, active and lock-waiting sessions; transactions, disk reads, buffer hits, deadlocks and temporary bytes; and the cumulative buffer hit ratio.
pg_stat_statements, pg_stat_activity and EXPLAIN (ANALYZE).
MySQL
Read-only figures: Connected and running threads next to the connection limit; queries, network bytes and InnoDB I/O; and the cumulative buffer pool hit ratio.
The slow query log, Performance Schema and EXPLAIN.
MariaDB
Read-only figures: Connected and running threads next to the connection limit; queries, network bytes and InnoDB I/O; and the cumulative buffer pool hit ratio.
The slow query log, Performance Schema and ANALYZE.
Oracle
Read-only figures: Sessions, active and blocked sessions, commits, rollbacks, and logical and physical block counters. Most of these need the optional monitoring grants.
V$SQL and DBMS_XPLAN, plus AWR and ASH where your Oracle licence includes them.
SQLite
File capacity only: File size, reusable free pages and how long the Agent took to read them. SQLite is embedded, so there are no session or throughput figures to show.
EXPLAIN QUERY PLAN and ANALYZE, run from your application or the sqlite3 shell.
What success looks like
You can explain why it got slower, show what changed and show that the fix worked.
Outside SQL Server, SQL Cockpit shows current read-only figures, with no history, alerts or query tracing, so query-level detail comes from the engine’s own tools. Low figures don’t prove a database is healthy.