Re: SQl Data Provider Performance Issues
- From: "Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 6 Aug 2007 21:36:08 -0400
Greg,
It seems like something else is definitely going on here. I can't see the code you are using, so I can't tell what is going on on the .NET side. However, from what you have shown of the execution tree, it seems like you haven't optimized the ValidValues_HLAHighRes table for this query. It's doing an index scan, which is not really what you want. You should probably index it so that an index seek will be performed. If you have a large number of records in the ValidValues_HLAHighRes table, then that could be impacting performance.
Of course, there is some overhead in populating a data set, but from what you are mentioning, it doesn't seem like it should be that much. Assuming a reasonable number of columns in the table, a few hundred rows really shouldn't take that long.
--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
"Greg" <gmichaels@xxxxxxxxxxxxx> wrote in message news:1186446086.255319.90070@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I am trying to fill strongly typed datasets with data from a SQLServer
DB. The data is used as a datsource for drop down lists. The data
adapters are configured to perform only selects, no inserts, updates,
or deletes. When I call the Fill method to load the dataset, CPU Usage
goes to 100%. These simple queries take forever to complete. We are
only dealing with a few hundred rows. My windows form takes minutes to
load because of the poor performance. The select statements require 2
inner joins to aquire the required data columns. Similar fills using
selects with a single inner join perforn OK. I tried running the SQl
Profiler to analyze the problem. When I run the query from SQL Query
Analyzer, SQL Profiler shows a duration of 30. When run from withing
the C# .net application duration jumps to 9000 or 300 times slower.
Reads stay the same. SQL execution plan is the same when using Query
analyzer versus the application. It appears the SQL Data Provider is
the source of the poor performance. Here is the SQL Select that
performs poorly:
SELECT H.HLAHighResID, H.HighResName, H.HLALowResID, L.LowResName
FROM ValidValues_HLAHighRes H
INNER JOIN ValidValues_HLACategories C ON H.HLACategoryID =
C.HLACategoryID
INNER JOIN ValidValues_HLALowRes L ON H.HLALowResID = L.HLALowResID
WHERE (C.CategoryName = 'A')
Execution Tree
--------------
Nested Loops(Inner Join, OUTER REFERENCES:([H].[HLALowResID]))
|--Nested Loops(Inner Join, WHERE:([H].[HLACategoryID]=[C].
[HLACategoryID]))
| |--Index Seek(OBJECT:([test].[dbo].[ValidValues_HLACategories].
[IX_ValidValues_HLACategories_1] AS [C]), SEEK:([C].
[CategoryName]='A') ORDERED FORWARD)
| |--Clustered Index Scan(OBJECT:([test].[dbo].
[ValidValues_HLAHighRes].[PK_ValidValues_HLAHighRes] AS [H]))
|--Clustered Index Seek(OBJECT:([test].[dbo].[ValidValues_HLALowRes].
[PK_ValidValues_HLALowRes] AS [L]), SEEK:([L].[HLALowResID]=[H].
[HLALowResID]) ORDERED FORWARD)
Here is the SQL Select that performs OK even though duration doubles:
SELECT L.HLALowResID, L.LowResName
FROM ValidValues_HLALowRes L
INNER JOIN ValidValues_HLACategories C ON L.HLACategoryID =
C.HLACategoryID
WHERE (C.CategoryName = 'A') ORDER BY L.LowResName
Execution Tree
--------------
Sort(ORDER BY:([L].[LowResName] ASC))
|--Nested Loops(Inner Join, WHERE:([C].[HLACategoryID]=[L].
[HLACategoryID]))
|--Index Seek(OBJECT:([test].[dbo].[ValidValues_HLACategories].
[IX_ValidValues_HLACategories_1] AS [C]), SEEK:([C].
[CategoryName]='A') ORDERED FORWARD)
|--Clustered Index Scan(OBJECT:([test].[dbo].
[ValidValues_HLALowRes].[PK_ValidValues_HLALowRes] AS [L]))
Thes are quite similar excpet for an extra INNER JOIN. What can the
souce of this poor perfomance be? Why does CPU get pegged at 100% when
I run these selects from the application? I thought trhe SQL Data
Provider was the preferred choice when accessing a SQL Server DB.
Should I try an OLE Data Adapter?
.
- Follow-Ups:
- Re: SQl Data Provider Performance Issues
- From: Greg
- Re: SQl Data Provider Performance Issues
- References:
- SQl Data Provider Performance Issues
- From: Greg
- SQl Data Provider Performance Issues
- Prev by Date: Re: Change the color of text at a specific location on each text line
- Next by Date: Re: Console app
- Previous by thread: Re: SQl Data Provider Performance Issues
- Next by thread: Re: SQl Data Provider Performance Issues
- Index(es):
Relevant Pages
|
Loading