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

xrg/openerp-server,xrg/openerp-server