ir.attachment: Index on res_model,res_id
_All_ client forms are trying to locate attachments of records, so they are querying ir.attachment for their (res_model, res_id). Speed that up! bzr revid: p_christ@hol.gr-20100627200016-gt9cyafm97if51e5
This commit is contained in:
@@ -124,6 +124,13 @@ class ir_attachment(osv.osv):
|
||||
'type': 'binary',
|
||||
}
|
||||
|
||||
def _auto_init(self, cr, context=None):
|
||||
super(ir_attachment, self)._auto_init(cr, context)
|
||||
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = %s', ('ir_attachment_res_idx',))
|
||||
if not cr.fetchone():
|
||||
cr.execute('CREATE INDEX ir_attachment_res_idx ON ir_attachment (res_model, res_id)')
|
||||
cr.commit()
|
||||
|
||||
ir_attachment()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user