DataDoer
DataDoer

Reputation: 209

SQL Locking - Timeout issue

I have a SQL job which kind of process a queue of requests. It updates Table1. It is long process that takes like 15 minutes.

Meanwhile my application tries to read records from Table1 and displays them in a grid. The corresponding get proc has set tran isolation level read uncommited. When the SQL job is running, my application always time outs while populating the grid. If the SQL job is not running it works fine.

My proc has appropriate isolation level, so I'm not getting why it still time out. Thoughts?

Here is how my get proc looks like:

CREATE PROCEDURE dbo.MyGetProc(...)

AS BEGIN SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SET NOCOUNT ON;

SELECT
    ...
FROM
    (
        SELECT
            ...
        FROM 
            dbo.Table1
            LEFT JOIN dbo.OtherTable1
        WHERE ...
        GROUP BY
         ...
    ) X
    INNER JOIN dbo.OtherTable2
    LEFT JOIN dbo.OtherTable3
    LEFT JOIN dbo.OtherTable4
    LEFT JOIN dbo.OtherTable5
    LEFT JOIN dbo.OtherTable6
    LEFT JOIN dbo.OtherTable6
ORDER BY
    ...

END

Upvotes: 0

Views: 36

Answers (1)

ShaQue
ShaQue

Reputation: 366

use

Select * from table1 with (nolock)

which reads commited data.

Upvotes: 1

Related Questions