PostgreSQL powers many ERPs and business applications, including Odoo and many custom systems. It is fast and reliable, but default settings are conservative. A few changes, guided by measurement, often deliver dramatic improvements.
Measure first
- Enable
pg_stat_statementsto find the slowest and most frequent queries - Use
EXPLAIN ANALYZEto see how a slow query is executed - Watch for sequential scans on large tables
Common improvements
| Area | Typical action |
|---|---|
| Indexes | Add indexes for frequent filters and joins; remove unused ones |
| Memory | Size shared buffers and work memory for your server and workload |
| Connections | Use a pooler such as PgBouncer instead of hundreds of direct connections |
| Maintenance | Make sure autovacuum keeps up on busy tables |
| Data growth | Archive or partition very large historical tables |
Do not forget the application
Many slow queries come from application code, such as loading records one by one in a loop. Fixing the code often beats any database setting.