本文介绍了优化循环并提高性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个具有1 crore data
的数据集,而我是looping through it
,并使用数据集的值更新了计数2.5 crore.
的基表
where子句是主键中使用的字段
但是我仍然没有获得性能,只有1 lac
记录正在更新in 1 hr
.
我如何优化并加快在oracle中执行查询的时间.我正在vb.net中使用命令对象,连接对象
请帮忙.
以下函数执行了1亿次更新查询的时间.
I have dataset with 1 crore data
and i am looping through it
and using values of dataset for updating the base table of count 2.5 crore.
The fields which is used in where clause is primary key
But still i am not getting performance only 1 lac
records getting updated in 1 hr
.
How do i optimize and speed up time to execute query in oracle. I am using command object, Coneection object in vb.net
Please help.
following function executed 1 crore time to update query.
public cmd_obj as new oledb.oledbcommand
Strquery="update Table1 set field1='Value from dataset' where field2='value from dataset'" ' where field2 is primary key in base table
Public Function Executenonquery(ByVal Strquery As String) As Int32
Dim intUpdated As Int32 = 0
Try
If VerifyOracleLogin() = True Then ' check oracle connection
cmd_obj.Connection = dbconn
cmd_obj.CommandText = Strquery 'strquery has update query
intUpdated = cmd_obj.ExecuteNonQuery()
return intUpdated
End If
Catch ex As Exception
WriteToErrorLog("Query Execution Error : " & Strquery, ex.Message)
Return -1
End Try
End Function
推荐答案
这篇关于优化循环并提高性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!