SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Concurrency read by .net report application


Concurrency read by .net report application

Author
Message
Birby1974
Birby1974
SSC Rookie
SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)

Group: General Forum Members
Points: 49 Visits: 109
Hi all folks!

In my production environment, I have this working stored procedure:


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO



ALTER PROCEDURE [dbo].[spDistintaDistriNoDef]
-- Add the parameters for the stored procedure here
@bollaData smalldatetime,
@bollaTipo varchar(2),
@confCod smallint,
@listGiri varchar(MAX),
@listClienti varchar(MAX),
@listProd varchar(MAX)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'tmpRiepilogoGiro') AND type in (N'U'))
BEGIN
DROP TABLE dbo.tmpRiepilogoGiro
END


-- Insert statements for procedure here
SELECT
disProdotti.bollaData
, disProdotti.bollaTipo
, disProdotti.cod
, disProdotti.numero
, disProdotti.varProd
, disProdotti.nome
, disProdotti.formPacco1
, disProdotti.prezzoStampato
, 0 AS alfaOrder
, disBolle.quanDist AS copie
, dbo.fxComputePacchiInteri(disBolle.quanDist, disProdotti.formPacco1) AS pacchiInteri
, dbo.fxComputeSciolti(disBolle.quanDist, disProdotti.formPacco1) AS sciolti
, disClienti.cod AS CodCliente
, disClienti.nome AS NomeCliente
, disClienti.indir
, disClienti.local
, disClieGiri.GiroCod
, disClieGiri.GiroPos

INTO
tmpRiepilogoGiro

FROM
disProdotti INNER JOIN
disBolle ON disProdotti.id = disBolle.prodId INNER JOIN
disClienti ON disBolle.clieId = disClienti.id INNER JOIN
disClieGiri ON disClienti.cod = disClieGiri.clieCod

WHERE
(disClieGiri.confCod = @confCod) AND
(disProdotti.bollaData = @bollaData) AND
(disProdotti.bollaTipo = @bollaTipo) AND
(disProdotti.cod IN (SELECT cod FROM dbo.SplitCustomers(@listProd))) AND
(disClieGiri.GiroCod IN (SELECT cod FROM dbo.SplitCustomers(@listGiri))) AND
(disClienti.cod IN (SELECT cod FROM dbo.SplitCustomers(@listClienti)))

ORDER BY
disClieGiri.GiroCod
, disClieGiri.GiroPos
, disProdotti.nome
END



I have a VB6 application that set the parameters and execute the stored procedure; after this task the same application invoke an external .NET report viewer application that render the report.

Now the problem: my customer starts with 2 workstation for printing (some years ago) and now this workstations are 5.
Every operator produce a new report every 3 minutes.
Performance are poor and sometimes, one operator see the result of another operator.

How could I address this problem?

Any suggestion would be greatly appreciated, thanks.
gbritton1
gbritton1
UDP Broadcaster
UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)

Group: General Forum Members
Points: 1467 Visits: 879
1. What does the execution plan look like? Do you see scans instead of seeks? Does the plan suggest indices? These could be performance factors.

2. the Order by clause is meaningless in a SELECT...INTO. You can remove it.

3. What should stop one operator from seeing another's results? It's not clear from the query.
Lowell
Lowell
SSC Guru
SSC Guru (75K reputation)SSC Guru (75K reputation)SSC Guru (75K reputation)SSC Guru (75K reputation)SSC Guru (75K reputation)SSC Guru (75K reputation)SSC Guru (75K reputation)SSC Guru (75K reputation)

Group: General Forum Members
Points: 75289 Visits: 40985
by simply changing to using a true temp table, isntead of a permenant table which happens to start with tmp, you could fix your concurrency issue.
#temp tables are unique to the session calling it,a nd are destroyed at the end of your procedure,s o there's no need to explicitly check for and drop.

it looks to me like the procedure "refreshes" the data in your table...all it does is drop teh table, recreate it, with data
why not leave the table as is, and simply delete and insert instead?

then you would not have a schema lock on the table for the drop and recreate.

Lowell
--help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!
Birby1974
Birby1974
SSC Rookie
SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)

Group: General Forum Members
Points: 49 Visits: 109
Lowell, thanks for your suggestions, I'm going to apply them to my test environment and I'll report later if these fixes will solve my concurrency problem.

@gbritton:
Thanks for your suggestions.

Let me clarify that performance issue is not related to the stored procedure itself (that runs well); is the .NET report application that runs slowly when multiple users try to produce different report almost simultaneously.

Birby
Birby1974
Birby1974
SSC Rookie
SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)

Group: General Forum Members
Points: 49 Visits: 109
Hi all, I apologize for the delay of my feedback.
I used the solution suggested by Lowell, and I did some changes to my client (VB6 and C#) applications.
So, I solved my problem.

Thanks!
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search