Performance Tuning on Odoo Account Table
<p>i have around 30K's of account records in an Odoo database, and it takes too long even to list those accounts. Analysing the query logs, i found that these kind of query are taking to long to finish (around 3000 ms) each...</p>

<pre><code>SELECT "account_account".id FROM "account_account" 
WHERE (("account_account"."active" = true)  
AND  ("account_account"."parent_id" in 
   (62315,62316,62317,62318,62319,62320,62321,62322,62323,62324,62325,62326,
   62327,62328,62329,62330,62331,62332,62333,62334,62335,62336,62337,62338,62339,
   62340,62341,62342,62343,62344,62345,62346,62347,62348,62349,62350,62351,62352,
   62353,62354,62355,62356,62357,62358,62359,62360,62361,62362,62363,62364,62365,
   62366,62367,62368,62369,62370,62371,62372,62373,62374,62375,62376,62377,62378,62379,62380,62381,62382,62383,62384,62385,62386,62387,62388,62389,62390,62391,62392,62393,62394,62395,62396,62397,62398,62399,62400,62401,62402,62403,62404,62405,62406,62407,62408,62409,62410,62411,62412,62413,62414,62415,62416,62417,62418,62419,62420,62421,62422,62423,62424,62425,62426,62427,62428,62429,62430,62431,62432,62433,62434,62435,62436,62437,62438,62439,62440,62441,62442,62443,62444,62445,62446,62447,62448,62449,62450,62451,62452,62453,62454,62455,62456,62457,62458,62459,62460,62461,62462,62463,62464,62465,62466,62467,62468,62469,62470,62471,62472,62473,62474,62475,62476,62477,62478,62479,62480,62481,62482,62483,62484,62485,62486,62487,62488,62489,62490,62491,62492,62493,62494,62495,62496,62497,62498,62499,62500,62501,62502,62503,62504,62505,62506,62507,62508,62509,62510,62511,62512,65083,65355,65410))) 
ORDER BY "account_account"."parent_left" 
</code></pre>

<p>any body have any idea to tune the query or the database setting ?
currently my postgres.conf setting using pgtune is like this:</p>

<pre><code>default_statistics_target = 50 # pgtune wizard 2016-03-24
maintenance_work_mem = 120MB # pgtune wizard 2016-03-24
constraint_exclusion = on # pgtune wizard 2016-03-24
checkpoint_completion_target = 0.9 # pgtune wizard 2016-03-24
effective_cache_size = 1408MB # pgtune wizard 2016-03-24
work_mem = 12MB # pgtune wizard 2016-03-24
wal_buffers = 8MB # pgtune wizard 2016-03-24
checkpoint_segments = 16 # pgtune wizard 2016-03-24
shared_buffers = 480MB # pgtune wizard 2016-03-24
max_connections = 80 # pgtune wizard 2016-03-24
</code></pre>

<p>thanks !</p>