Database Management
Every Odoo environment on OEC.sh runs on its own dedicated PostgreSQL database, created automatically at deployment time and isolated from other environments. It stores all your Odoo business data: customers, products, invoices, orders, user accounts, configuration, installed modules, and attachment metadata.
Viewing Database Information
To see your database details:
- Go to Environments and select your environment
- Click the Settings tab
- Click the Database sub-tab
Here you will find:
- PostgreSQL optimization settings
- Connection pooling configuration
- Read replica status (Odoo 18+ only)
Health Indicators
OEC.sh monitors your database health automatically. In the environment overview you can see:
| Indicator | Meaning |
|---|---|
| Running | Database is running normally |
| Stopped | Database container is stopped |
| Error | Connection or configuration issue detected |
If you see an error status, try restarting the environment. If problems persist, check your server connectivity or contact support.
Backups
Your database is included in every backup. OEC.sh snapshots:
- All database tables and records
- Your filestore (attachments and images)
- Configuration files
See Backups for how to create and restore backups.
PgBouncer Connection Pooling
PgBouncer sits in front of PostgreSQL and manages a pool of persistent database connections. Instead of Odoo opening a new connection for every request, it checks out a connection from the pool and returns it when done. This significantly reduces the overhead of connection establishment under concurrent load.
PgBouncer is available on Pro plans and above.
When to Enable PgBouncer
Enable PgBouncer when:
- You have more than 20 concurrent users
- Your environment handles background jobs and web requests simultaneously (common with Odoo workers)
- You see PostgreSQL errors mentioning
too many connectionsorconnection refused
For small environments (under 10 users), PgBouncer adds a small amount of overhead without a meaningful benefit.
Enabling PgBouncer
- Go to your environment's Settings → Database tab
- Find the PostgreSQL Optimization panel
- Enable the PgBouncer toggle
- Set the pool size (default: 20 — increase for high-traffic environments)
- Click Save and then Redeploy your environment
PgBouncer listens on port 6432 (primary) in transaction pooling mode.
Pool Size Guidelines
| Users | Recommended Pool Size |
|---|---|
| Under 20 | 20 (default) |
| 20–50 | 40–60 |
| 50–100 | 80–100 |
| Over 100 | Contact support for sizing guidance |
Redeploy is required after changing PgBouncer settings. Changes do not take effect until the environment is redeployed.
Read Replicas
A read replica is a second PostgreSQL instance that streams all writes from the primary in real time. Odoo routes read-only queries (reports, list views, dashboards) to the replica, leaving the primary free to handle writes. This improves response times when you have many concurrent users or run heavy reports alongside normal business operations.
Read replicas are available on Pro plans and above, for Odoo 18.0 and newer only.
How It Works
OEC.sh deploys the replica as a separate PostgreSQL container using streaming replication. The replica receives every write-ahead log (WAL) record from the primary and applies it continuously. Odoo's built-in db_replica parameter routes reads to it automatically — no code changes required.
The replica uses approximately 30% of the CPU and RAM allocated to the primary, plus 100% of the disk (it holds a full copy of the database).
Requirements
- Odoo 18.0 or newer (required — earlier versions do not support
db_replica) - Pro plan or above
- Sufficient resource quota for the additional replica containers
Enabling a Read Replica
- Go to your environment's Settings → Database tab
- Find the PostgreSQL Optimization panel
- Check Enable Read Replica
- Click Save Settings
- Redeploy the environment to apply changes
- After redeployment, click Deploy Replica to start the replica container
- Wait for the initial sync to complete (1–5 minutes for most databases; longer for large databases)
Monitoring Replica Health
OEC.sh checks replica health every 2 minutes. The Read Replica Status widget shows:
| Status | Description |
|---|---|
| Online | Replica is synchronized and healthy |
| Lagging | Replica is falling behind — review lag metrics |
| Offline | Replica container is not running |
| Error | Replication error (see error details in the widget) |
Lag metrics:
| Metric | Warning | Critical |
|---|---|---|
| Lag (bytes) | > 50 MB | > 100 MB |
| Lag (seconds) | > 15 s | > 30 s |
High lag typically means the primary is writing faster than the replica can apply. This can happen during bulk imports or large module upgrades — it usually self-corrects once the heavy operation finishes.
Rebuilding a Replica
If the replica falls into Offline or Error status and does not recover:
- Go to Settings → Database tab
- Click Rebuild in the Read Replica section
- Confirm — this recreates the replica container and re-syncs from the primary
A rebuild takes 1–5 minutes for most databases. The primary continues running normally throughout.
Removing a Read Replica
- Go to your environment's Settings → Database tab
- Click Remove in the Read Replica section
- Confirm the removal
Removing the replica frees up the quota used by the replica containers. The primary database is not affected.