473,387 Members | 1,611 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,387 software developers and data experts.

100% CPU Usage (Part 2)

Hi all

Please read my previous post here if this interests you:

http://groups.google.co.uk/group/com...u+usage&hl=en&

I have (or rather a colleague has) found the situation that appears to
be causing this problem but I am still no further to finding a
solution.

It appears that if we execute a query against one particular table in
the database and that query requests data that is not indexed, or a
column in the where clause is not indexed then this is when problems
occur.

The table cannot be copied using DTS reporting the error:

"Error occurred copying row 3 - unspecified error".

However, we can query using:

"SELECT TOP n FROM <Table>"

where n so far has been between 3 and 100000.

However we cannot do SELECT * FROM <Table>.

All we can guess at for now is that the problem occurs when a query is
performed to try and fetch data that is not indexed, using an index in
the where clause.

i.e. SELECT <Non-indexed column> FROM <Table> WHERE <Indexed Column> =
n

Could it be possible that we have one 'rogue' row in the table somehow
that is causing the problem?

The only thing to dispel this is that we can do the following:

SELECT * FROM <Table> WHERE ID < 1

which returns 1 row with ID = -1.

We cannot do:

SELECT * FROM <Table> WHERE ID < 200 even though we know that the only
record matching this criteria is the record with ID = -1.

Therefore the exact same data should be returned yet one query fails
and one works.

The actual problem that we see is that memory usage climbs
dramatically, then once all memory is used, the CPU usage climbs to
100% and stays there until we have to restart SQL Server.

Any suggestions on this would be hugely appreciated.

Thanks,

Paul

Feb 9 '06 #1
4 2967
Have you done a DBCC CHECKDB to rule out corruption?
SELECT * FROM <Table> WHERE ID < 1

which returns 1 row with ID = -1.

We cannot do:

SELECT * FROM <Table> WHERE ID < 200 even though we know that the only
record matching this criteria is the record with ID = -1.

Therefore the exact same data should be returned yet one query fails
and one works.

Do get an error message or does the 'failed' query not complete with 100%
CPU? Do you get the same execution plan with both queries?

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Paul" <pa***********@hotmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com... Hi all

Please read my previous post here if this interests you:

http://groups.google.co.uk/group/com...u+usage&hl=en&

I have (or rather a colleague has) found the situation that appears to
be causing this problem but I am still no further to finding a
solution.

It appears that if we execute a query against one particular table in
the database and that query requests data that is not indexed, or a
column in the where clause is not indexed then this is when problems
occur.

The table cannot be copied using DTS reporting the error:

"Error occurred copying row 3 - unspecified error".

However, we can query using:

"SELECT TOP n FROM <Table>"

where n so far has been between 3 and 100000.

However we cannot do SELECT * FROM <Table>.

All we can guess at for now is that the problem occurs when a query is
performed to try and fetch data that is not indexed, using an index in
the where clause.

i.e. SELECT <Non-indexed column> FROM <Table> WHERE <Indexed Column> =
n

Could it be possible that we have one 'rogue' row in the table somehow
that is causing the problem?

The only thing to dispel this is that we can do the following:

SELECT * FROM <Table> WHERE ID < 1

which returns 1 row with ID = -1.

We cannot do:

SELECT * FROM <Table> WHERE ID < 200 even though we know that the only
record matching this criteria is the record with ID = -1.

Therefore the exact same data should be returned yet one query fails
and one works.

The actual problem that we see is that memory usage climbs
dramatically, then once all memory is used, the CPU usage climbs to
100% and stays there until we have to restart SQL Server.

Any suggestions on this would be hugely appreciated.

Thanks,

Paul

Feb 9 '06 #2


It turns out that we have a table that is over 1GB in size. We only had
the server configured to allow SQL Server to use 800MB.

Therefore, when we were querying using a query resulting in a full
table scan there was not enough memory to perform the query. Instead of
returning an error it basically just stopped (or maybe it was doing the
query but it would take years!).

Anyway, thanks to all those that posted!

Paul

Feb 9 '06 #3
Paul (pa***********@hotmail.com) writes:
It turns out that we have a table that is over 1GB in size. We only had
the server configured to allow SQL Server to use 800MB.

Therefore, when we were querying using a query resulting in a full
table scan there was not enough memory to perform the query. Instead of
returning an error it basically just stopped (or maybe it was doing the
query but it would take years!).


There is no reason why SQL Server would failed to return all rows from
a table that is larger than the available memory. However, it should
not comes as any surprise that returning so many rows will take a
very long time, and will saturate both server and client.

Or are you saying that you get a problem if you do:

SELECT * FROM tbl WHERE nonindexedcol = oddvalue

While it will take some load as the table is scanned, and both brought
into cache and out again, it should not send SQL Server into complete
nirvana.
--
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
Feb 9 '06 #4

"Paul" <pa***********@hotmail.com> wrote in message
news:11********************@o13g2000cwo.googlegrou ps.com...


It turns out that we have a table that is over 1GB in size. We only had
the server configured to allow SQL Server to use 800MB.

This may hurt performance but should not break things.

We routinely use tables multiple gigabytes in size.

But we did hit a bug (I forget details) in a query we were doing on a SQL
2000 SP3 DB.

SP4 fixed it.

Therefore, when we were querying using a query resulting in a full
table scan there was not enough memory to perform the query. Instead of
returning an error it basically just stopped (or maybe it was doing the
query but it would take years!).

Anyway, thanks to all those that posted!

Paul

Feb 10 '06 #5

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

Similar topics

2
by: vishal | last post by:
Hi I a am executing a stored procedure from C code using SQLExecute . It takes some time to Execute the procedure. However when I see the processor usage during that time it shows 100% cpu usage....
8
by: Greg Merideth | last post by:
I've written a basic windows service to provide some helper xml functions for my web methods and even thou the service is only about 1k lines long with 1 timer, its mem usage is 10m and its vm mem...
2
by: wushupork | last post by:
I have written a screensaver application in C# .NET and have noticed that whenever the animation loop is running - CPU usage always spikes up close to 100%. My application uses a paint thread which...
4
by: hmedinapy | last post by:
has anyone had a issue like this... My application (VB .net) starts using about 20% from cpu, and slowly increase the cpu usage to 100%. I need to know any factor that hs influence on cpu...
2
by: Sidharth | last post by:
Hello, We are experiencing some issues with the aspnet_wp process on our live servers. The problems are intermittent and we cannot reproduce it on our dev and test servers. Currently around...
11
by: David Schwartz | last post by:
When I run my VB.NET Windows Forms application, the CPU usage jumps up to 100%. If I drop-down a menu, the usage goes down to a more reasonable number, like 0-2%. The same is true when a MsgBox...
22
by: Paul | last post by:
Hi I am having a real issue with CPU usage by SQL Server, and it is not related to a poor query. I have a clients database that I am currently investigating some issues with. After I perform...
5
by: fniles | last post by:
I am having problem with thread. I have a Session class with public string variable (called Message) that I set from my Main program. In the session class it checks for the value of Message...
1
by: showson1 | last post by:
Hi all! I have some files that are basically a TIF with an ASCII header. I wrote an app that reads in the file, pulls some values from the header and writes out everything after the header as a...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.