473,800 Members | 2,529 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Excessive stored procedure [COMPILE] lock

Hello!

I am trying to investigate strange problem with particular stored
procedure. It runs OK for several days and suddenly we start getting
and lot
of locks. The reason being [COMPILE] lock placed on this procedure. As
a
result, we have 40-50 other connections waiting, then next connection
using
this procedure has [COMPILE] lock etc. Client is fully qualifying
stored
procedure by database/owner name and it doesn't start with sp_. I know

these are the reasons for [COMPILE] lock being placed. Is there
something
else that might trigger this lock? When troubleshooting this issue, I
noticed there was no plan for this procedure in syscacheobjects . The
stored
procedure is very simple (I know it could be rewritten/optimized but
our
developer wrote it):
CREATE PROCEDURE [dbo].[vsp_mail_select]

@user_id int,
@folder_id int,
@is_read bit = 1, --IF 1, pull everything, else just pull unread mail
@start_index int = null, --unused for now, we return everything
@total_count int = null output, -- count of all mail in specified
folder
@unread_count int = null output -- count of unread mail in specified
folder

AS
SET NOCOUNT ON

select m1.* from mail m1(nolock) where m1.user_id=@use r_id and
folder_id=@fold er_id and ((@is_read=0 and is_read=0) or (@is_read=1))
order
by date_sent desc
select @total_count = count(mail_id) from mail m1(nolock) where
m1.user_id=@use r_id and folder_id=@fold er_id and ((is_read=0 and
@is_read=0)
or (@is_read=1))
select @unread_count = count(mail_id) from mail m1(nolock) where
m1.user_id=@use r_id and folder_id=@fold er_id and is_read=0

GO

I was monitoring server for a couple of day before and I am not sure
why
this happens every 3-4 days only!

Any help on this matter would be greately appreciated!

Thanks,
Igor

Jul 23 '05 #1
1 2779
See:
http://support.microsoft.com/default...;en-us;q263889
http://support.microsoft.com/?kbid=836136
Maybe one of them (or the related articles) will help.

Razvan

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5369
by: metehan | last post by:
Hi all question regarding how transactions work in SQL Server... stored procedure below that generates unique IDs for messages we send to the backend It looks like sometimes, the number generated is identical for a messages that were sent simultaneously. Since this seems like a concurrency issue, am I correct in thinking that using SQL transactions within the stored procedure code will solve this problem?
12
10033
by: M Wells | last post by:
Hi All, I have a table that holds pregenerated member IDs. This table is used to assign an available member id to web site visitors who choose to register with the site So, conceptually the process has been, from the site (in ASP), to: - select the top record from the members table where the assigned flag
2
9013
by: A.V.C. | last post by:
Hello, Can we lock stored procedure until its execution is complete ? I dont want 2 clients to simultenously execute the stored procedure in Sql Server 2000. My front end is ASP.net 1.0 Thanks in advance. waiting for the reply.
1
1850
by: Alexander Korovyev | last post by:
hello, I have a bunch of stored procedures which are run for some background processing. In effect they are launched at random. At any given time point only one of the stored procedures is allowed to execute. If a stored procedure is launched while another one is still running the launched stored procedure must not wait for the running one to finish and return immediately. What are the possible ways to achieve this?
1
3691
by: DB_2 | last post by:
Hello, I created the following stored procedure. (Please ignore the logic in it; at this point it is not complete and I am trying to get the basic structure working first.) CREATE PROCEDURE upgrade_sal () LANGUAGE SQL BEGIN DECLARE eldest INT;
2
4718
by: nbohana | last post by:
I am trying to code an compile a stored procedure without success. So I generated one using Microsoft Visule C# .Net. and it follows. One of the problems is that it will not compile. Some of the message won't to put ';' all over the place, I some need help!!! These are some of the compile messages. ; expected Cannot use more than one type in a for, using, fixed, or declaration statement = (cannot specify constructor arguments in...
3
3174
by: Racerx | last post by:
Hi All: I use db2 v8 fp 14 on Aix. I am facing problems with a stored procedure that is causing a lot of locks and also goes in the lock wait state ending up hanging the application. Tried using the UR isolation mode but it did not help. Can some one please suggest me how to debug this problem and any
5
6464
by: william.david.anderson | last post by:
Hi there, I have a newbie question regarding stored procedures and locking. I'm trying to use a stored procedure to perform a 'select for update' and return a cursor. Below is a stripped down version of the procedure: CREATE PROCEDURE SELBTFLFORUPDATE() LANGUAGE SQL
0
1820
by: gregoryday | last post by:
I am having a problem with creating a stored procedure. The premise underwhich we are operating is the following: We are working with two tables. The first table simply stores an integer value representing the last used value. The second table lists ranges of integers which have already been allocated in a legacy system. This table has two columns representing the various starting and ending values for these ranges. We wish to retrieve...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10504
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10274
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10251
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10033
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.