473,395 Members | 1,468 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Help with blocking on querying two joined tables

I get a 90-120 second blocking when send 15 or so simultaneous queries
to SQL Server 2000 that query a view made up of two joined tables.
After each query is blocking for the same amount of time they all
return. Further identical queries of this type work in 3-4 seconds
(caching?) until hours later where it happens again. If I query the
tables directly (without the view) I still get the same blocking. If I
remove the join (it is a simple inner join on two columns) I do not get
the blocking.

Any ideas?

Dec 8 '05 #1
3 1734
lo***********@yahoo.com (lo***********@yahoo.com) writes:
I get a 90-120 second blocking when send 15 or so simultaneous queries
to SQL Server 2000 that query a view made up of two joined tables.
After each query is blocking for the same amount of time they all
return. Further identical queries of this type work in 3-4 seconds
(caching?) until hours later where it happens again. If I query the
tables directly (without the view) I still get the same blocking. If I
remove the join (it is a simple inner join on two columns) I do not get
the blocking.


Wait here, if the processes only queries the view, there can't be any
blocking. It's another issue, of course, if there is a process that
performs an update these tables.

How do you conclude that actually have blocking? Did you run sp_who,
and saw that these processes had a non-zero value in the Blk column?

Or did you just think that the queries took a long time to run?

Caching could indeed be part of it. SQL Server keeps a lot of the data
in the cache, since reading from main memory is a lot faster than reading
from disk. If these tables are queried frequenly they should stay in cache.
But there are a few things that may force them out of the cache:
1) Another query runs and drags some big table into memory.
2) Some performs an operations that flushes the caches, for instance
DBCC DROPCLEANBUFFERS, or restart of SQL Server.

Since the queries takes 3-4 seconds to run from cache, maybe there is
idea to review indexing to speed them up.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Dec 8 '05 #2
I believe it is blocking because I can send 12 or so via JDBC and they
all sit there waiting and then all return within milliseconds of each
other. It is not like one takes a long time and the others are real
fast. They all take 120 seconds or they all take 90. I did not run
sp_who because I was running then from a web client via JDBC. The same
behavior occurs whether I query the view or I query the tables directly
with the join. I can query once that returns quickly and then query
all 12 or so and they return in 3-4 seconds, which makes me think it is
either a caching issue or something to do with running 12 simultaneous
queries on the same table. The caching is problematic because I would
suspect one table to take a while and the rest to happen quickly unless
there is some delay I am not aware of. I will say that these tables
are replicated which I suspected make be an issue but I have other
tables that are just as large (15 yrs worth of data) and are replicated
and they have no problems. The ONLY difference is the join.

I guess I can look into how I can increase the cache size and see if
that helps.
Thanks for the help.

Dec 8 '05 #3
lo***********@yahoo.com (lo***********@yahoo.com) writes:
I believe it is blocking because I can send 12 or so via JDBC and they
all sit there waiting and then all return within milliseconds of each
other. It is not like one takes a long time and the others are real
fast.
Well, if all 12 processes access the same data, and that data is not in
the cache, all 12 will have to wait until that memory has been read.
I did not run sp_who because I was running then from a web client via
JDBC.
I don't see how that prevents you from using sp_who to investigate
blocking. For a more completely view of the situation, you can use
aba_lockinfo, which you get from my web site:
http://www.sommarskog.se/sqlutil/aba_lockinfo.html.
The same behavior occurs whether I query the view or I query the tables
directly with the join. I can query once that returns quickly and then
query all 12 or so and they return in 3-4 seconds, which makes me think
it is either a caching issue or something to do with running 12
simultaneous queries on the same table. The caching is problematic
because I would suspect one table to take a while and the rest to happen
quickly unless there is some delay I am not aware of. I will say that
these tables are replicated which I suspected make be an issue but I
have other tables that are just as large (15 yrs worth of data) and are
replicated and they have no problems. The ONLY difference is the join.
It's not that a table is in the cache either as a whole or not at all.
What SQL Server caches is pages. Thus, if you have a table with 15 years
of data, supposedly most references are to recent data, and thus only
some pages are in the cache. Now, if your query accesses the entire
table for some reason - for instance because of a poor query plan - there
could be a lot that needs to enter the memory.

Anyway, it could help, if you posted:

o CREATE TABLE statements for the tables, with size indications.
o CREATE INDEX statments for the tabels.
o The very query itself.
I guess I can look into how I can increase the cache size and see if
that helps.


By default, SQL Server grabs as much memory there is available. Unless
you can constrained how much memory SQL Server can use, the only way
to increase the cache is to buy more memory.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Dec 9 '05 #4

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

Similar topics

0
by: abcd | last post by:
kutthaense Secretary Djetvedehald H. Rumsfeld legai predicted eventual vicmadhlary in Iraq mariyu Afghmadhlaistmadhla, kaani jetvedehly after "a ljetvedehg, hard slog," mariyu vede legai pressed...
3
by: Prem | last post by:
Hi, I am having many problems with inner join. my first problem is : 1) I want to know the precedance while evaluating query with multiple joins. eg. select Employees.FirstName,...
20
by: Jack Schitt | last post by:
I thought I was starting to get a handle on Access, until I tried doing something useful...now I'm stuck. I have a DB with two tables - to keep it simple I'll say that one is an Employee File...
1
by: Phil W | last post by:
Hello, I have set up my database in access using many to many relationships (it's the good ol' books and authors one again). I've actually extended it to include other people who contribute in...
3
by: Logan McKinley | last post by:
I have a C# program that uses blocking sockets and want to allow the user to stop the server. The problem I am having is the socket blocks on...
0
by: Mauricio | last post by:
Hello, Currently we have an ASP.NET 2003 app running, on one function the app calls to a stored procedure to SQLServerONE, that stored procedure creates some TEMP tables with the results of a...
1
by: loosecannon_1 | last post by:
Hello everyone, I am hoping someone can help me with this problem. I will say up front that I am not a SQL Server DBA, I am a developer. I have an application that sends about 25 simultaneous...
2
by: jjm0926 | last post by:
Hello everyone. I am brand new to Access and am in need of some help. I have a database with three main tables--customers, project, and then a joined table called project_customers. In the...
7
by: 663scott | last post by:
Hi I am pretty new to ACCESS. I have created some small databases previously. I need to run a simple query searching for a USERNAME which will gather information from five to ten tables containing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...
0
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...

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.