当大量用户在数据库()中需要同一个表(同时访问表)时,这是危险的吗? [英] Is it dangerous when plenty of users need one and the same table (simultaneous access for a table) in a Database ()?

查看:145
本文介绍了当大量用户在数据库()中需要同一个表(同时访问表)时,这是危险的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。

我使用服务器的代码,通过将一些个人数据放入数据库表来为每个用户服务。有很多用户,例如他们中的两个想在表格中放入一些数据。在这种情况下,sql server将如何执行?是否有任何机制可以满足此类用户的行为(同时访问表)?

服务器的功能是使用C#编写的,并且每次访问时都使用SqlConnection.ConnectionString。 class =h2_lin>解决方案

如果您使用的是SQL Server(或MySQL),那么您应该没问题 - 前提是您完成了所有明智的事情!基于服务器的数据库系统旨在应对这种活动。



您必须注意的事项是您编写代码的方式:如何处理行ID值例如?如果你让SQL处理它你就没事了。如果您在代码创建行之前尝试预取ID,则会遇到困难。很多困难...



因此系统可以应对,缺点将出现在您的代码和数据库设计中! :笑:

Hello to all.
I use the code of a server which serves each user by putting some personal data into a DB table. There are plenty of users and two of them for instance would like to put some data in the table in a DB. How will sql server perform in this case? Are there any mechanisms that are ready for such users' behavior (simultaneous access to a table)?
The functionality of the server is written with C# and uses SqlConnection.ConnectionString for each attempt of access.

解决方案

Provided you are using SQL Server (or MySQL) you should be fine - provided you have done all the "sensible" things! Server based database systems are designed to cope with that kind on activity.

The things you have to watch for is how you wrote your code: how do you handle row ID values for example? If you let SQL take care of it you are fine. If you try to "prefetch" an ID before your code has created the row you will have difficulties. Lots of difficulties...

So the system can cope, the weakness will be in your code and DB design! :laugh:


这篇关于当大量用户在数据库()中需要同一个表(同时访问表)时,这是危险的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆