[FIX] OPW 577963: ir_attachment: speed up ir.attachment search for large databases
authorOlivier Dony <odo@openerp.com>
Tue, 21 Aug 2012 14:39:26 +0000 (16:39 +0200)
committerXavier ALT <xal@openerp.com>
Tue, 21 Aug 2012 14:39:26 +0000 (16:39 +0200)
commit463aac54daec35cc18b9d57f3b8f7fc24b1b69d3
treeed6e5584aa9c667d1a7b46f52a8948f5779aab0b
parente406b65c0b8b6a392efe5c0d0b3a411f1ac607a7
[FIX] OPW 577963: ir_attachment: speed up ir.attachment search for large databases

  Frequents calls to list.remove() were being a bottleneck for large
  document lists (100k+). Using a set make remove() calls much faster.

  Also turned a read() into a pure SQL command, as its high-level
  features were unnecessary (security checks performed before and
  after it anyways) and it was 50% slower than the direct SQL version.

  This commit has a corresponding addons patch in order to use a set
  instead of a list in the document module as well.

bzr revid: xal@openerp.com-20120821143926-ta75gd98qi30wbp9
bin/addons/base/ir/ir_attachment.py