← Back to team overview

openerp-expert-framework team mailing list archive

Re: Performance issue - 100.000 rows, 10 function fields (most with store true) which are also m2o

 

Hi Ferdinand

Ferdinand Gassauer [via openerp-expert-framework] wrote:
>
> trying to open this table we usually get response times of 24 seconds 
> for 80 records
>
Wow, that's way too much!

You may be able to do a small optimization if instead of 10 methods (one 
for each of the function fields), you are be able to use a single 
'multi' method to get all the function field values.
Take a look at the accounting module: the debit, credit and balance of 
the accounts all use the same method.

You might also want to store the function fields, reads are much quicker 
that way.

 From the OpenERP Technical Memento:

/To optimize function fields, two mechanisms are available:
? multi: all fields sharing the same multi attribute value will be 
computed with one single call to the function, which should then return 
a dictionary of values in its values map
? store: function fields with a store attribute will be stored in the 
database, and recomputed on demand when the relevant trigger objects are 
modified. The format for the trigger specification is as follows: store 
= {'model': (_ref_fnct, fields, priority)}/


> * for each such m2o function field and for each record displayed (not 
> new) the following statements are issued
>
> select ir_model.id from "ir_model" where (ir_model.model = 
> E'dimu.track') order by id
>
> select audittrail_rule.id from "audittrail_rule" where 
> (audittrail_rule.object_id = 248) AND (audittrail_rule.state = 
> E'subscribed') order by id
>
> SELECT audittail_rules_users.rule_id,audittail_rules_users.user_id 
> FROM audittail_rules_users , res_users WHERE 
> audittail_rules_users.user_id in (20) AND 
> audittail_rules_users.rule_id = res_users.id order by res_users.id 
> offset 0
>
AuditTrail slows things a bit.
>
> SET DATESTYLE TO 'ISO'
>
> SHOW client_encoding
>
> SHOW default_transaction_isolation
>
> BEGIN; SET TRANSACTION ISOLATION LEVEL READ COMMITTED
>
> SELECT "name",id FROM "dimu_track" WHERE id IN (30259) ORDER BY 
> track_number
>
> COMMIT
>
> about 10 of such group of statements are processed according to 
> database log
>
> in ONE second.
>
At least the GTK client does a /name_get/ request for each many2one 
field: It tries to get the name (of the referenced record) to display on 
the list view. That may be the reason you see 10 query groups per record 
(one /name_get/ call per many2one).

-- 
Borja López Soilán
borjals@xxxxxxxxx

Pexego Sistemas Informáticos S.L.
Avenida de Magoi 66 - 27002 Lugo (España)
Tel./Fax 982801517
http://www.pexego.es 


AVISO LEGAL - CLÁUSULA DE PRIVACIDAD
Este mensaje se dirige exclusivamente a su destinatario y puede contener información privilegiada o confidencial. Si no es usted el destinatario indicado, queda informado de que la utilización, divulgación y/o copia sin autorización está prohibida en virtud de la legislación vigente. Si ha recibido este mensaje por error, le rogamos que nos lo comunique inmediatamente por esta misma vía y proceda a su destrucción. 


-- 
View this message in context: http://openerp-expert-framework.71550.n3.nabble.com/Performance-issue-100-000-rows-10-function-fields-most-with-store-true-which-are-also-m2o-tp819683p825650.html
Sent from the openerp-expert-framework mailing list archive at Nabble.com.

References