← Back to team overview

openerp-expert-framework team mailing list archive

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

 

trying to open this table we usually get response times of 24 seconds for 80 
records

The following issues seem to contribute to this 

I suspect that the function field breaks the caching of the m2o field
all these look like
********************
    def _track_id(self, cr, uid, ids, field_name, arg, context={}):
        track_obj = self.pool.get ("dimu.track")
        result    = {}
        for obj in self.browse(cr, uid, ids, context):
            if obj.isrc and len(obj.isrc.replace(' ','')) > 0:
                track_ids = track_obj.search (cr, uid, [("isrc", "=", 
obj.isrc)])
                tracks    = track_obj.browse (cr, uid, track_ids)
                if tracks :
                    result[obj.id] = tracks[0].id
            if obj.id not in result :
                result[obj.id] = False
        return result
********************
'track_id'           : fields.function
    ( _track_id
    , method = True
    , string = "Track"
    , type   = 'many2one'
    , obj    = 'dimu.track'
    , store  = True
    ),
********************

* 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
  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.

temporary work around (other than not using function fields which solves the 
problem)
reduce the limit of displayed records to 20 (instead of 80) for such tables
to get response times of ~4 seconds (over fast internet connection)

Any hint how to avoid/solve this problem

@xrg - are you investigating this issue? 
-- 
regards
Ferdinand Gassauer
ChriCar Beteiligungs- und Beratungs- GmbH
Official OpenERP Partner

Follow ups