Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 inserting xml data into temp table running slow

Author  Topic 

stonebreaker
Yak Posting Veteran

92 Posts

Posted - 2010-01-19 : 10:25:31
I am running the following:

declare @XML as XML
set @XML = <xml data>

select x.item.query(<data>) as FormName,
x.item.query(<data>) as FormDescription,
.
.
.
.
.
.
x.item.query(<data>) as FieldStatusCode
INTO #TempSmartFormDefinition
FROM @xml.nodes('SmartFormDefinitions/SmartFormDefinition/Section/Field') as X(Item)

There are 91 rows of xml data. It takes about 2 min 30 sec to run this insert statement. When I run the select without the insert, it takes 6 seconds.

I'm not sure where to start looking for the bottleneck - any suggestions?

thanks,

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2010-01-19 : 12:27:30
have you tried creating the temp table first and doing an INSERT INTO and see if there is a difference?

<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page

stonebreaker
Yak Posting Veteran

92 Posts

Posted - 2010-01-19 : 13:27:26
When I ran the query on a different server, it ran in 5 seconds.

Stonebreaker
The greatest obstacle to discovery is not ignorance - it is the illusion of knowledge.
-Daniel Boorstin
Go to Top of Page

stonebreaker
Yak Posting Veteran

92 Posts

Posted - 2010-01-19 : 14:22:36
Also, the query runs fine on the original server if I do not insert the select into a temp table.

Stonebreaker
The greatest obstacle to discovery is not ignorance - it is the illusion of knowledge.
-Daniel Boorstin
Go to Top of Page
   

- Advertisement -