Start typing to
🚨 The recurring pattern in production
Many Odoo environments show the same:
CPU almost unused
High or full RAM
Odoo slow or frozen
users reporting timeouts
And the classic question:
“Why is it slow if the server is not at its limit?”
The answer often lies inPostgreSQL and connections.
🔒 Symptom 1 – Locks that block everything
In production, you see:
operations that do not finish
users waiting without feedback
crons piling up
In PostgreSQL, you see:
SELECT * FROM pg_locks;
And you notice:
locks waiting
cascading locks
transactions that do not progress
👉 A slow transaction in Odoocan block many more.
🧠 Why this happens
Odoo:
groups many operations into a single transaction
holds locks longer than expected
uses the ORM intensively
If additionally:
there are many open connections
there is no pooling
👉 the system becomes fragile.
💤 Symptom 2 – CPU idle but system slow
This symptom is very confusing.
You see:
CPU at 10–20 %
low load
disks are fine
But Odoo:
takes time
freezes
makes the user wait
Why?
the processesare not working
they arewaiting for resources
mainly connections or locks
🧠 PostgreSQL waiting on PostgreSQL
With many connections:
PostgreSQL spends more time coordinating processes
less time executing queries
more context switching
👉 free CPUdoes not mean a healthy system.
🧠 Symptom 3 – Full RAM (even when "everything is idle")
In PostgreSQL:
each connection reserves memory
even when idle
If you have:
200 connections
10 MB per connection
👉 2 GB of RAMjust in connections.
This causes:
memory pressure
swapping
unpredictable latency
⏱️ Symptom 4 – Intermittent timeouts
Odoo starts to show:
timeout errors
screens that never load
sessions that "drop"
But:
not always
not all users
not always the same
That is typical of:
saturated pools
held connections
long transactions
🔍 How to confirm this is your problem
In PostgreSQL
SELECT state, count(*) FROM pg_stat_activity GROUP BY state;
Bad sign:
many idle
several idle in transaction
In the system
low CPU
high RAM
numerous PostgreSQL processes
🧩 The complete pattern
If you have:
locks
idle CPU
full RAM
timeouts
👉 It's not hardware
👉 It's not poorly made Odoo
👉 It's connection architecture
🚀 The way out of the loop
To break this pattern you need to:
limit actual connections
reuse them well
free up memory
reduce contention
That is not achieved by:
increasing max_connections
restarting services
It is achieved with:
PgBouncer
correct configuration
well-sized pools
🔗 Related links
📌 Conclusion
These symptoms are not a coincidence.
They are clear signs that:
PostgreSQL is juggling too many connections.
The good news:
you don't need more hardware
you needbetter architecture
And that starts by controlling connections here...
Next chapter ->