Skip to Content

Odoo Performance Tuning

Find out why Odoo is slow and fix it: workers, memory, PostgreSQL, web server and slow custom code, measured before and after.

MEASURE, DON'T GUESS

Every change is backed by numbers

"Odoo is slow" can mean a small server, a missing database index, a badly written report or one heavy scheduled job. Buying a bigger server fixes only the first. The work starts by finding which one it is.

MeasurePage, report and search timings under normal use
FindLogs, slow queries and server load show the cause
FixOne change at a time, on a copy first
Measure againBefore and after numbers, side by side
WHERE ODOO USUALLY SLOWS DOWN

Common causes and their signs

Workers and memory

Sign: the site freezes when several people work at once.

Odoo workers, memory limits and timeouts sized to the server and to how many people use it.

PostgreSQL

Sign: lists and searches get slower as data grows.

Memory settings, missing indexes and table maintenance for large tables.

Web server

Sign: pages load slowly even when the server is idle.

Compression, caching of images and static files, and correct proxy settings.

Custom code and scheduled jobs

Sign: one screen, report or time of day is always slow.

Slow computed fields, database queries inside loops and heavy scheduled jobs, rewritten or moved.

HOW IT IS IMPLEMENTED

From measurement to fix

  1. Find the slow queries

    PostgreSQL is told to log every query slower than half a second, and its statistics show which queries use the most time overall.

    postgresql.conf
    log_min_duration_statement = 500ms
    shared_preload_libraries = 'pg_stat_statements'
    Top 10 queries by total time
    SELECT round(total_exec_time) AS total_ms, calls,
           round(mean_exec_time::numeric, 1) AS avg_ms,
           left(query, 90) AS query
    FROM pg_stat_statements
    ORDER BY total_exec_time DESC
    LIMIT 10;
  2. Size the workers to the server

    Too few workers and users wait in line; too many and the server runs out of memory. A common start is (CPU cores Γ— 2) + 1, then adjusted to the memory each worker really uses.

    odoo.conf for a 2-core, 8 GB server (example)
    workers = 5
    max_cron_threads = 1
    limit_memory_soft = 2147483648   ; recycle a worker above 2 GB
    limit_memory_hard = 2684354560   ; stop it above 2.5 GB
    limit_time_cpu = 600
    limit_time_real = 1200
  3. Give PostgreSQL the right memory

    The defaults are made for tiny machines. Common starting points, adjusted to your server:

    postgresql.conf for 8 GB of RAM (example)
    shared_buffers = 2GB             # about 25% of RAM
    effective_cache_size = 5GB       # about 60% of RAM
    work_mem = 32MB
    maintenance_work_mem = 512MB
    random_page_cost = 1.1           # SSD storage
  4. Cache what never changes

    Odoo's scripts, styles and images are served from nginx's cache and compressed, so Odoo workers spend their time on real work.

    nginx
    location ~* /web/static/ {
      proxy_cache_valid 200 90m;
      proxy_buffering on;
      expires 864000;
      proxy_pass http://odoo;
    }
    gzip on;
    gzip_types text/css text/plain application/json application/javascript text/xml;
  5. Fix slow custom code

    The most common problem in custom modules: one database query per record inside a loop. Rewritten as one grouped query, it stays fast no matter how many records there are.

    Before: one query per customer
    for partner in partners:
        partner.order_count = self.env['sale.order'].search_count(
            [('partner_id', '=', partner.id)])
    After: one query for all customers
    counts = dict(self.env['sale.order']._read_group(
        [('partner_id', 'in', partners.ids)], ['partner_id'], ['__count']))
    for partner in partners:
        partner.order_count = counts.get(partner, 0)

    Fields that are searched or filtered often get a database index (index=True), and heavy scheduled jobs are moved out of office hours or split into batches.

YOU RECEIVE

A short report with real numbers

Example of the before/after table, with illustrative values:

ActionBeforeAfter
Open sales orders list4.8 s0.9 s
Customer search3.1 s0.4 s
Stock valuation report52 s11 s
  • What was slow and why
  • Every change made, and how to undo it
  • Advice on server size for the next year
HOW YOU BENEFIT

A faster day for everyone

⏳Less waiting

Seconds saved on every screen add up to hours each week across a team.

πŸ’°No unnecessary upgrade

Often the server you have is enough once it is set up properly.

πŸ“ˆReady for growth

Fixes that keep working as your data and team grow.

QUESTIONS

Common questions

Do you change my live system during the analysis?

No. Measuring is read-only; changes are tried on a copy first and applied to live only with your approval.

Can you speed up a module someone else wrote?

Yes, as long as the source code is available. Changes are made in a way that survives later updates.