Odoo Performance Tuner
Overview
This skill helps diagnose and resolve Odoo performance problems — from slow page loads and database bottlenecks to worker misconfiguration and memory bloat. It covers PostgreSQL query tuning, Odoo worker settings, and built-in profiling tools.
When to Use This Skill
- Odoo is slow in production (slow page loads, timeouts).
- Getting
MemoryError or Worker timeout errors in logs.
- Diagnosing a slow database query using Odoo's profiler.
- Tuning
odoo.conf for a specific server spec.
How It Works
- Activate: Mention
@odoo-performance-tuner and describe your performance issue.
- Diagnose: Share relevant log lines or config and receive a root cause analysis.
- Fix: Get exact configuration changes with explanations.
Examples
Example 1: Recommended Worker Configuration
# odoo.conf — tuned for a 4-core, 8GB RAM server
workers = 9 # (CPU_cores × 2) + 1 — never set to 0 in production
max_cron_threads = 2 # background cron jobs; keep ≤ 2 to preserve user-facing capacity
limit_memory_soft = 1610612736 # 1.5 GB — worker is recycled gracefully after this
limit_memory_hard = 2147483648 # 2.0 GB — worker is killed immediately; prevents OOM crashes
limit_time_cpu = 600 # max CPU seconds per request
limit_time_real = 1200 # max wall-clock seconds per request
limit_request = 8192 # max requests before worker recycles (prevents memory leaks)
Example 2: Find Slow Queries with PostgreSQL
-- Step 1: Enable pg_stat_statements extension (run once as postgres superuser)
CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
-- Step 2: Also add to postgresql.conf and reload:
-- shared_preload_libraries = 'pg_stat_statements'
-- log_min_duration_statement = 1000 -- log queries taking > 1 second
-- Step 3: Find the top 10 slowest average queries
SELECT
LEFT(query, 100) AS query_snippet,
round(mean_exec_time::numeric, 2) AS avg_ms,
calls,
round(total_exec_time::numeric, 2) AS total_ms
FROM pg_stat_statements
ORDER BY mean_exec_time DESC
LIMIT 10;
-- Step 4: Check for missing indexes causing full table scans
SELECT schemaname, tablename, attname, n_distinct, correlation
FROM pg_stats
WHERE tablename = 'sale_order_line'
AND correlation < 0.5 -- low correlation = poor index efficiency
ORDER BY n_distinct DESC;
Example 3: Use Odoo's Built-In Profiler
Prerequisites: Run Odoo with ?debug=1 in the URL to enable debug mode.
Menu: Settings → Technical → Profiling
Steps:
1. Click "Enable Profiling" — set a duration (e.g., 60 seconds)
2. Navigate to and reproduce the slow action
3. Return to Settings → Technical → Profiling → View Results
What to look for:
- Total SQL queries > 100 on a single page → N+1 query problem
- Single queries taking > 100ms → missing DB index
- Same query repeated many times → missing cache, use @ormcache
- Python time high but SQL low → compute field inefficiency
Best Practices
- ✅ Do: Use
mapped(), filtered(), and sorted() on in-memory recordsets — they don't trigger additional SQL.
- ✅ Do: Add PostgreSQL B-tree indexes on columns frequently used in domain filters (
partner_id, state, date_order).
- ✅ Do: Enable Odoo's HTTP caching for static assets and put a CDN (Cloudflare, AWS CloudFront) in front of the website.
- ✅ Do: Use
@tools.ormcache decorator on methods pulled repeatedly with the same arguments.
- ❌ Don't: Set
workers = 0 in production — single-threaded mode serializes all requests and blocks all users on any slow operation.
- ❌ Don't: Ignore
limit_memory_soft — workers exceeding it are recycled between requests; without the limit they grow unbounded and crash.
- ❌ Don't: Directly manipulate
prefetch_ids on recordsets — rely on Odoo's automatic batch prefetching, which activates by default.
Limitations
- PostgreSQL tuning (
shared_buffers, work_mem, effective_cache_size) is highly server-specific and not covered in depth here — use PGTune as a starting baseline.
- The built-in Odoo profiler only captures Python + SQL traces; JavaScript rendering performance requires browser DevTools.
- Odoo.sh managed hosting restricts direct PostgreSQL and
odoo.conf access — some tuning options are unavailable.
- Does not cover Redis-based session store or Celery task queue optimizations, which are advanced patterns for very high-traffic instances.
1---
2name: odoo-performance-tuner
3description: "Expert guide for diagnosing and fixing Odoo performance issues: slow queries, worker configuration, memory limits, PostgreSQL tuning, and profiling tools."
4version: 1.0.0
5author:
6 name: "sickn33 / Antigravity Community"
7 github: sickn33
8tags: [odoo, performance, tuner, business]
9category: business
10platforms: [macos, linux, windows]
11license: MIT
12metadata:
13 hermes:
14 source: https://skillmd.com/skills/nous-hermeshub/odoo-performance-tuner
15 upstream: "antigravity-awesome-skills"
16 risk: "safe"
17 original_author: "Antigravity Community"
18---
19
20# Odoo Performance Tuner
21
22## Overview
23
24This skill helps diagnose and resolve Odoo performance problems — from slow page loads and database bottlenecks to worker misconfiguration and memory bloat. It covers PostgreSQL query tuning, Odoo worker settings, and built-in profiling tools.
25
26## When to Use This Skill
27
28- Odoo is slow in production (slow page loads, timeouts).
29- Getting `MemoryError` or `Worker timeout` errors in logs.
30- Diagnosing a slow database query using Odoo's profiler.
31- Tuning `odoo.conf` for a specific server spec.
32
33## How It Works
34
351. **Activate**: Mention `@odoo-performance-tuner` and describe your performance issue.
362. **Diagnose**: Share relevant log lines or config and receive a root cause analysis.
373. **Fix**: Get exact configuration changes with explanations.
38
39## Examples
40
41### Example 1: Recommended Worker Configuration
42
43```ini
44# odoo.conf — tuned for a 4-core, 8GB RAM server
45
46workers = 9 # (CPU_cores × 2) + 1 — never set to 0 in production
47max_cron_threads = 2 # background cron jobs; keep ≤ 2 to preserve user-facing capacity
48limit_memory_soft = 1610612736 # 1.5 GB — worker is recycled gracefully after this
49limit_memory_hard = 2147483648 # 2.0 GB — worker is killed immediately; prevents OOM crashes
50limit_time_cpu = 600 # max CPU seconds per request
51limit_time_real = 1200 # max wall-clock seconds per request
52limit_request = 8192 # max requests before worker recycles (prevents memory leaks)
53```
54
55### Example 2: Find Slow Queries with PostgreSQL
56
57```sql
58-- Step 1: Enable pg_stat_statements extension (run once as postgres superuser)
59CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
60
61-- Step 2: Also add to postgresql.conf and reload:
62-- shared_preload_libraries = 'pg_stat_statements'
63-- log_min_duration_statement = 1000 -- log queries taking > 1 second
64
65-- Step 3: Find the top 10 slowest average queries
66SELECT
67 LEFT(query, 100) AS query_snippet,
68 round(mean_exec_time::numeric, 2) AS avg_ms,
69 calls,
70 round(total_exec_time::numeric, 2) AS total_ms
71FROM pg_stat_statements
72ORDER BY mean_exec_time DESC
73LIMIT 10;
74
75-- Step 4: Check for missing indexes causing full table scans
76SELECT schemaname, tablename, attname, n_distinct, correlation
77FROM pg_stats
78WHERE tablename = 'sale_order_line'
79 AND correlation < 0.5 -- low correlation = poor index efficiency
80ORDER BY n_distinct DESC;
81```
82
83### Example 3: Use Odoo's Built-In Profiler
84
85```text
86Prerequisites: Run Odoo with ?debug=1 in the URL to enable debug mode.
87
88Menu: Settings → Technical → Profiling
89
90Steps:
91 1. Click "Enable Profiling" — set a duration (e.g., 60 seconds)
92 2. Navigate to and reproduce the slow action
93 3. Return to Settings → Technical → Profiling → View Results
94
95What to look for:
96 - Total SQL queries > 100 on a single page → N+1 query problem
97 - Single queries taking > 100ms → missing DB index
98 - Same query repeated many times → missing cache, use @ormcache
99 - Python time high but SQL low → compute field inefficiency
100```
101
102## Best Practices
103
104- ✅ **Do:** Use `mapped()`, `filtered()`, and `sorted()` on in-memory recordsets — they don't trigger additional SQL.
105- ✅ **Do:** Add PostgreSQL B-tree indexes on columns frequently used in domain filters (`partner_id`, `state`, `date_order`).
106- ✅ **Do:** Enable Odoo's HTTP caching for static assets and put a CDN (Cloudflare, AWS CloudFront) in front of the website.
107- ✅ **Do:** Use `@tools.ormcache` decorator on methods pulled repeatedly with the same arguments.
108- ❌ **Don't:** Set `workers = 0` in production — single-threaded mode serializes all requests and blocks all users on any slow operation.
109- ❌ **Don't:** Ignore `limit_memory_soft` — workers exceeding it are recycled between requests; without the limit they grow unbounded and crash.
110- ❌ **Don't:** Directly manipulate `prefetch_ids` on recordsets — rely on Odoo's automatic batch prefetching, which activates by default.
111
112## Limitations
113
114- PostgreSQL tuning (`shared_buffers`, `work_mem`, `effective_cache_size`) is highly server-specific and not covered in depth here — use [PGTune](https://pgtune.leopard.in.ua/) as a starting baseline.
115- The built-in Odoo profiler only captures **Python + SQL** traces; JavaScript rendering performance requires browser DevTools.
116- **Odoo.sh** managed hosting restricts direct PostgreSQL and `odoo.conf` access — some tuning options are unavailable.
117- Does not cover **Redis-based session store** or **Celery task queue** optimizations, which are advanced patterns for very high-traffic instances.