PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET SQL Server Locks/ProcessID - Is this a problem?

Reply

SQL Server Locks/ProcessID - Is this a problem?

 
Thread Tools Rate Thread
Old 05-04-2006, 10:24 PM   #1
Spam Catcher
Guest
 
Posts: n/a
Default SQL Server Locks/ProcessID - Is this a problem?


Hi all,

I have a simple application which polls a DB every couple of seconds to
retrieve some status information. The app also updates the database from
time to time. I would say 85% polling, 15% updates.

In SQL Server's Management Screen (Locks/ProcessID) I see ~3 SPIDs related
to my application. These seem to be granted locks.

Is this an issue?

A client of our believes that the app should have no locks whatsoever.

I'm just doing standard SELECT * FROM Users ORDER BY UserName via SQLHelper
(DABB). The table will have at most ~100 records (typically 10 - 15). I do
need to grab all the records at once.

Any suggestions, comments, or ideas?

Thanks.
  Reply With Quote
Old 07-04-2006, 04:38 PM   #2
Mary Chipman [MSFT]
Guest
 
Posts: n/a
Default Re: SQL Server Locks/ProcessID - Is this a problem?

On Wed, 05 Apr 2006 21:24:37 GMT, Spam Catcher
<spamhoneypot@rogers.com> wrote:

>Hi all,
>
>I have a simple application which polls a DB every couple of seconds to
>retrieve some status information. The app also updates the database from
>time to time. I would say 85% polling, 15% updates.
>
>In SQL Server's Management Screen (Locks/ProcessID) I see ~3 SPIDs related
>to my application. These seem to be granted locks.
>
>Is this an issue?
>
>A client of our believes that the app should have no locks whatsoever.
>
>I'm just doing standard SELECT * FROM Users ORDER BY UserName via SQLHelper
>(DABB). The table will have at most ~100 records (typically 10 - 15). I do
>need to grab all the records at once.
>
>Any suggestions, comments, or ideas?
>
>Thanks.

  Reply With Quote
Old 07-04-2006, 04:45 PM   #3
Mary Chipman [MSFT]
Guest
 
Posts: n/a
Default Re: SQL Server Locks/ProcessID - Is this a problem?

SQL Server issues shared locks if you are running under the default
isolation level of READ COMMITTED. These locks are granted-released in
sub-second time, and should not cause a problem with such a small
amount of data. If you want to avoid even those locks, run your
polling under the READ UNCOMMITTED isolation level, which does not
place any locks on the data and ignores the locks placed by other
processes. However, if you do that, you will get dirty reads, so your
polling app would react to data that never actually gets committed in
the database, which totally defeats its purpose.

--Mary

On Wed, 05 Apr 2006 21:24:37 GMT, Spam Catcher
<spamhoneypot@rogers.com> wrote:

>Hi all,
>
>I have a simple application which polls a DB every couple of seconds to
>retrieve some status information. The app also updates the database from
>time to time. I would say 85% polling, 15% updates.
>
>In SQL Server's Management Screen (Locks/ProcessID) I see ~3 SPIDs related
>to my application. These seem to be granted locks.
>
>Is this an issue?
>
>A client of our believes that the app should have no locks whatsoever.
>
>I'm just doing standard SELECT * FROM Users ORDER BY UserName via SQLHelper
>(DABB). The table will have at most ~100 records (typically 10 - 15). I do
>need to grab all the records at once.
>
>Any suggestions, comments, or ideas?
>
>Thanks.

  Reply With Quote
Old 07-04-2006, 07:12 PM   #4
Spam Catcher
Guest
 
Posts: n/a
Default Re: SQL Server Locks/ProcessID - Is this a problem?

"Mary Chipman [MSFT]" <mchip@online.microsoft.com> wrote in
news:1t1d32thmntb7897robcsbf0spbjm18cld@4ax.com:

> SQL Server issues shared locks if you are running under the default
> isolation level of READ COMMITTED. These locks are granted-released in
> sub-second time, and should not cause a problem with such a small
> amount of data.


Thanks for the information.

Do you know why these shared locks remain listed in Enterprise Manager?
After the app is closed, shouldn't these locks be released?

Or does SQL Server just keep them around since they're shared locks and not
exclusive locks?

Thanks.
  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off