Odoo General

How To Resolve Memory Issues In Odoo & Postgre SQL?

April 6, 2018 · 3 minutes read

One needs to take care of few steps in order to resolve memory issues in Odoo. Firstly, try to remove unwanted un-used add-ons from “addons” folder. Secondly, Tune Postgres for better performance.

Apart from this, the following are some more steps that you should consider. This article takes a tour down to the conditions that you need to uphold while implementing an Open Source ERP.

1. listen_addresses

PostgreSQL only responds to the connections from localhost, (by default). In that case, you need to change listen_addresses from its default function. This ensures accessibility of the server from other systems via standard TCP/IP networking. The usual approach followed: listen_addresses = ‘*and then control who can and cannot connect via the pg_hba.conf file.

2. max_connections

max_connections sets exactly the maximum number of clients a particular connection can allow. If you want more than thousand in number, use additional connection pooling software to reduce connection overhead.

3. shared_buffers

The shared_buffers, the configuration parameter, determines how much memory is dedicated to PostgreSQL for caching data. One reason the defaults gets low is that on some platforms the large values require invasive actions like recompiling the kernel. In such scenario, be aware that your system or PostgreSQL is built in 32-bit, and it might not be practical to get shared with buffers above 2 ~ 2.5GB.Also note that on Windows, large values for shared_buffers aren’t as effective, may find better results via keeping it relatively low. On Windows, the useful range is 64MB to 512MB.

4. effective_cache_size

effective_cache_size should be set to an estimate of how much memory is available for disk caching by the OS and within the database. This shows the available memory status in an operating system and PostgreSQL. This value is used only by the PostgreSQL query planner to figure out whether plans in consideration would be expected to fit in RAM or not. If it’s set too low, indexes may not be used for executing queries the way you’d expected it to be. PostgreSQL writes new transactions to the database in files called WAL segments that are 16MB in size. Every time checkpoint_segments worth of these files is written, by default a checkpoint occurs.

5. work_mem

If you do a lot of complex sorts and have a lot of memory, then increasing the work_mem parameter allows PostgreSQL to do larger in-memory sorts faster than disk-based equivalents.

6. maintenance_work_mem

Specifies the maximum amount of memory to be used by maintenance operations, such as vacuum, create an index, and alter table add a foreign key. It defaults to 16 megabytes (16MB). Since only one of these operations can be executed at a time by a database session, and an installation normally doesn’t have many of them running concurrently, it’s safe to set this value significantly larger than work_mem. Larger settings might improve performance for vacuuming and for restoring database dumps.


Leave a Reply

Your email address will not be published. Required fields are marked *