什么原因导致mysql中的kill查询

时间:2012-01-25 16:00:29

标签: c# .net mysql

我有一个.net C#应用程序,它使用.net连接器为mysql连接和更新远程服务器上的数据。我注意到有时会有一个kill查询取消一些查询。那我怎么能克服这个问题呢?我已经检查过,我在任何地方都没有在我的代码中发出kill

以下是日志文件的示例:

100717 15:26:03   979 Connect   root@60.50.6.130 on mpcms6
          979 Query SET autocommit=0
          979 Query SHOW VARIABLES
          979 Query SHOW COLLATION
          979 Query SET character_set_results=NULL
          979 Init DB   mpcms6
          979 Query SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ
          979 Query BEGIN
          979 Query Update tblID Set tblID.lastValue = lastValue + 1 Where tblID.tableName='tblReceipt'
100717 15:26:33   980 Connect   root@60.50.6.130 on mpcms6
          980 Query SET autocommit=0
          980 Query SHOW VARIABLES
          980 Query SHOW COLLATION
100717 15:26:34   980 Query SET character_set_results=NULL
          980 Init DB   mpcms6
          980 Query KILL QUERY 979
          980 Quit  
100717 15:26:54   979 Query Insert into tblReceipt Set receiptID=2607, outletID=6, employeeID=86, customerName='Cash', customerPhone='', totalCostAmount=6.5, totalSellingAmount=40, totalProfitAmount=33.5, changeAmount=0, profit='y', receiptDate = '2010:07:17', receiptTime = '15:26:04'
          979 Query Update tblID Set tblID.lastValue = lastValue + 1 Where tblID.tableName='tblReceiptDetails'
100717 15:27:24   981 Connect   root@60.50.6.130 on mpcms6
          981 Query SET autocommit=0
          981 Query SHOW VARIABLES
          981 Query SHOW COLLATION
          981 Query SET character_set_results=NULL
          981 Init DB   mpcms6
          981 Query KILL QUERY 979

2 个答案:

答案 0 :(得分:3)

看起来像是超时。两次杀戮都是在查询开始后约30秒。您的连接器是否允许您调整查询超时?

[编辑;回答评论]

我相信你想要的是SqlCommand.CommandTimeout,默认是30秒。请参阅MSDN documentation here

答案 1 :(得分:2)

由于你正在执行的更新似乎很简单(没有击中很多行)

我怀疑表tblID上存在锁定,因此客户端会因超时而停止运行。