如何使用不同的连接进行并行SQL执行 [英] How do I make parallel SQL execution with different connections

查看:67
本文介绍了如何使用不同的连接进行并行SQL执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

how do i make parallel sql execution with different connections





我用SQL存储过程创建一个进程,多个用户将同时运行该进程。但是当2个或更多用户一起完成这个过程时它会被卡住。



任何帮助并行执行如何使用不同的2个连接。



我尝试过:



我用SQL存储过程创建一个进程,多个用户将运行同时进行。但是当两个或更多用户一起完成这个过程时它会被卡住。



I create a process with SQL Stored Procedure, Multiple users will run the process simultaneously. But it gets stuck when 2 or more user do the process together.

Any help how parallel execution work with different-2 connections.

What I have tried:

I create a process with SQL Stored Procedure, Multiple users will run the process simultaneously. But it gets stuck when 2 or more user do the process together.

推荐答案

我认为这个问题不是由同时调用存储过程本身引起的(SQL服务器将在不同的用户会话中处理它们)但是当同时访问/修改相同的表数据时,该过程可能导致死锁。您必须确保该过程不会同时为2个不同的用户执行相同的操作。可能是您可以使用一个小表来标记正在进行的操作,以便该过程的任何正在运行的实例能够同步它的操作。
I think the problem won't be caused by simultaneously calls of the stored procedure itself (SQL server will process them in different user sessions) but what the procedure does may lead to dead locks when accessing/modifying the same table data at the same time. You'll have to ensure, that the procedure doesn't do the same actions at the same time for 2 different users. May be you can use a small table to flag the operations in progress so that any running instance of that procedure is able to synchonize it's actions.


这篇关于如何使用不同的连接进行并行SQL执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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