Product
Database
Overview

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:

  1. Go to Environments and select your environment
  2. Click the Settings tab
  3. 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:

IndicatorMeaning
RunningDatabase is running normally
StoppedDatabase container is stopped
ErrorConnection 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 connections or connection refused

For small environments (under 10 users), PgBouncer adds a small amount of overhead without a meaningful benefit.

Enabling PgBouncer

  1. Go to your environment's SettingsDatabase tab
  2. Find the PostgreSQL Optimization panel
  3. Enable the PgBouncer toggle
  4. Set the pool size (default: 20 — increase for high-traffic environments)
  5. Click Save and then Redeploy your environment

PgBouncer listens on port 6432 (primary) in transaction pooling mode.

Pool Size Guidelines

UsersRecommended Pool Size
Under 2020 (default)
20–5040–60
50–10080–100
Over 100Contact 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

  1. Go to your environment's SettingsDatabase tab
  2. Find the PostgreSQL Optimization panel
  3. Check Enable Read Replica
  4. Click Save Settings
  5. Redeploy the environment to apply changes
  6. After redeployment, click Deploy Replica to start the replica container
  7. 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:

StatusDescription
OnlineReplica is synchronized and healthy
LaggingReplica is falling behind — review lag metrics
OfflineReplica container is not running
ErrorReplication error (see error details in the widget)

Lag metrics:

MetricWarningCritical
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:

  1. Go to SettingsDatabase tab
  2. Click Rebuild in the Read Replica section
  3. 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

  1. Go to your environment's SettingsDatabase tab
  2. Click Remove in the Read Replica section
  3. Confirm the removal

Removing the replica frees up the quota used by the replica containers. The primary database is not affected.