数据库将如何同时由多个用户处理同一存储过程 [英] How will database handle the same stored procedure by multiple users at the same time

查看:269
本文介绍了数据库将如何同时由多个用户处理同一存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

数据库如何同时处理多个用户调用的同一存储过程

How will database handle the same stored procedure call by multiple users at the same time

推荐答案

这应该没有问题,因为每个人都有自己的会话.
问题可能出在表的锁定上.
There should not be a problem as each person has their own session.
The problem may come in locking of the tables.


数据库旨在处理来自多个用户的并行请求,并且通常只要一个用户的操作不存在,就不会有问题"在两个请求仍在进行时,更改另一个用户正在访问的数据.

但是在许多情况下不可避免地会发生冲突/冲突,良好的数据库设计部分是要确保在发生冲突时进行干净的处理,以便两个用户都可以知道他们的请求成功还是失败,并且数据库保持一致状态. br/>
可以将影响多个记录(在同一表或不同表中)的操作包装在事务"中,以便整个操作作为一个单元站立或下降-无法部分成功.

存储过程非常适合封装动作(尤其是复杂的序列),因此可以有用地利用事务.
Databases are designed to handle parallel requests from multiple users and there generally isn''t a problem so long as the actions of one user don''t alter the data being accessed by another user while both requests are still in progress.

But conflicts / collisions do inevitably occur in many situations and good database design is partly about ensuring that when they occur, they are handled cleanly so that both users can tell whether their request succeeded or failed and the database is left in a consistent state.

Actions that affect multiple records (in the same table or in different tables) can be wrapped in a ''transaction'' so that the whole action stands or falls as one unit - it cannot partially succeed.

Stored procedures are good for encapsulating actions (especially more complex sequences) so may usefully make use of transactions.


这篇关于数据库将如何同时由多个用户处理同一存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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