简体   繁体   English

.Net连接池MySQL临时表

[英].Net Connection Pooling MySQL Temporary Table

We have a MySQL database which we use in our .NET MVC Web App. 我们有一个MySQL数据库,我们在.NET MVC Web App中使用它。 We implement connection pooling as it has some great performance benefits. 我们实现了连接池,因为它具有一些很好的性能优势。

We also have some fairly heavy processing done in a few key stored procedures. 我们还在一些关键的存储过程中完成了一些相当繁重的处理。

They create several temporary tables and user variables which remain valid for the life of a connection. 它们创建了几个临时表和用户变量,这些表在连接的生命周期内仍然有效。 However with pooling enabled these objects don't get reset / killed. 但是,启用池后,这些对象不会被重置/杀死。

Should I just be re-initializing user variables and dropping/recreating temporary tables in this scenario? 我应该在这种情况下重新初始化用户变量并删除/重新创建临时表吗?

The connections are guaranteed not to be accessed at the same time so I shouldn't have any concurrency issues when two SP's are executing/populating temporary tables etc. 保证不能同时访问连接,因此当两个SP正在执行/填充临时表等时,我不应该有任何并发​​问题。

So the answer was simply drop the temp table before recreating each time. 所以答案就是在每次重新创建之前删除临时表。 There are no concurrency issues as it only ever can run one command at a time. 没有并发问题,因为它一次只能运行一个命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM