1. 性能低,比如产品导入1000多行,可能要半个小时,需要改进。

2. 导入一条失败,则整个失败。

3. many2one字段导入不友好,需要做转换,转换成xml_id。

4. 必填字段导入前需要做检查。

5. 导入可能需要手工校对栏位。

性能问题是瓶颈问题,性能低严重影响工作效率。

性能之所以低,原因是因为默认的导入(csv导入)用到了savepoint,当所有的transaction 都ok时,savepoint 才commit,否则roll back。

解决方案:

可以考虑用 autocommit来处理可能提升性能。

导入数据另行进行开发,需要用到xmlrpc, 最好使用单线程,因为数据库类在设计上,为了避免读取脏数据,采用了Serializable级别的,详见以下描述:

 One very important property of database transactions is the

        level of isolation between concurrent transactions.
        The SQL standard defines four levels of transaction isolation,
        ranging from the most strict *Serializable* level, to the least
        strict *Read Uncommitted* level. These levels are defined in
        terms of the phenomena that must not occur between concurrent
        transactions, such as *dirty read*, etc.
        In the context of a generic business data management software
        such as OpenERP, we need the best guarantees that no data
        corruption can ever be cause by simply running multiple
        transactions in parallel. Therefore, the preferred level would
        be the *serializable* level, which ensures that a set of
        transactions is guaranteed to produce the same effect as
        running them one at a time in some order.

 

因此,多线程容易引发并发事物,从而导致死锁,降低了性能。

此外,采用更高版本的postgresql数据库能有所优化。