数据库优化
公司总部现有商品2万多个,有时候商品信息修改之后(如价格等)总部需要及时的做数据同步.总共有30家,所以每次会产生30个trans_req(即同步传单)的商品下传记录(一般是把所以商品的信息都传过去,包括没有信息改动的商品),由于商品数量多每张单下传时间较久,会造成并发传单报错,具体的错误原因我查了informix error messages:
Temp table <table-name> already exists in session.
This statement tries to create a table with the name that is shown, but a temporary table with that name already exists. Only one temporary table with a given name can exist in a session.
Check the spelling of the name. If the name is spelled as you intended, check that a temporary table with the given name does not exist in the session. To review the names of temporary tables, query the systabnames table as follows:
SELECT dbsname, tabname FROM sysmaster:systabnames WHERE tabname = <table-name>
If the name exists, review this name by querying the systables table in <dbsname>:
SELECT tabname FROM <dbsname>:systables WHERE tabname = <table-name>
If the name does not exist in systables (" No rows found "), this table is a temporary table.
因为在存储过程中有临时表的建立,我想是不是因为数据传输量大,传输时间长而引起临时表在一个会话中没有及时的删除,从而导致上面的报错.
说明:在数据量相对较少的时候不会出现问题.
请教高手该怎么优化。
[解决办法]
建立索引试试,OR 生成不同的临时表名(如用时间做表名)
[解决办法]
你临时表是常用表吧?
不用每次都drop掉又重建吧。
在过程开始时加句
delete from OUT_GOODSEXTPUBPIC
不可以吗?