From 91a0d108bf1207dca8eb442e80e92c93fae5590c Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Sun, 19 Dec 2010 22:08:42 +0200 Subject: [PATCH] workflow.instance: remove excess indices It is a table with 4 columns, doesn't worth 5 indices! I hope that these combined indexed plus the wkf_id one will allow Postgres to always come up with a good plan. bzr revid: p_christ@hol.gr-20101219200842-4vr72wqal2t8k2xq --- bin/addons/base/ir/workflow/workflow.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/addons/base/ir/workflow/workflow.py b/bin/addons/base/ir/workflow/workflow.py index e5bb3f25d67..c638855aacf 100644 --- a/bin/addons/base/ir/workflow/workflow.py +++ b/bin/addons/base/ir/workflow/workflow.py @@ -173,15 +173,15 @@ class wkf_instance(osv.osv): _log_access = False _columns = { 'wkf_id': fields.many2one('workflow', 'Workflow', ondelete='cascade', select=True), - 'res_id': fields.integer('Resource ID', select=True), - 'res_type': fields.char('Resource Object', size=64, select=True), - 'state': fields.char('State', size=32, select=True), + 'res_id': fields.integer('Resource ID'), + 'res_type': fields.char('Resource Object', size=64), + 'state': fields.char('State', size=32), } def _auto_init(self, cr, context=None): super(wkf_instance, self)._auto_init(cr, context) - cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'wkf_instance_res_id_res_type_state_index\'') + cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'wkf_instance_res_type_res_id_state_index\'') if not cr.fetchone(): - cr.execute('CREATE INDEX wkf_instance_res_id_res_type_state_index ON wkf_instance (res_id, res_type, state)') + cr.execute('CREATE INDEX wkf_instance_res_type_res_id_state_index ON wkf_instance (res_type, res_id, state)') cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'wkf_instance_res_id_wkf_id_index\'') if not cr.fetchone(): cr.execute('CREATE INDEX wkf_instance_res_id_wkf_id_index ON wkf_instance (res_id, wkf_id)')