Databases
Slow application? Investigate the database queries
Diagnose slow lists and reports through measurements, data volume, repeated queries, execution plans and verification of improvements.
A larger server can temporarily conceal an inefficient query. Before changing infrastructure, identify where time is spent and which operations are performed unnecessarily.
The key decision
Measure the same operation under comparable conditions. Without a baseline, it is difficult to evaluate an optimisation.
Separate the time spent in each layer
Inspect the browser, network, application and database. A slow table might come from a large response, repeated fetching for every row or an expensive report. Record parameters and data volume for a reproducible example.
Do not test only a convenient small account. An organisation with extensive history or a product with many related records may behave differently.
Inspect the query and execution plan
PostgreSQL EXPLAIN reveals the selected query plan. EXPLAIN ANALYZE actually executes the statement, so its use needs to account for data changes and workload.
- Unnecessary columns and rows being fetched.
- Numerous separate queries for a single list.
- Indexes aligned with filtering and sorting.
- A bounded page size.
- Whether expensive reporting belongs in a background job.
Verify the benefit and side effects
Repeat measurements with equivalent data and parameters. Confirm that results remain correct and critical writes or other reports have not deteriorated.
MSS can review SQL queries, APIs and application flow. The objective is a measurable improvement rather than adding caches or indexes without a defined reason.