Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 681637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:30:20+00:00 2026-05-14T01:30:20+00:00

Is it a bad thing to have two xml columns in one table? +

  • 0

Is it a bad thing to have two xml columns in one table? + How much slower are these xml columns in terms of updating/inserting/reading data?

In profiler this kind of insert normally takes 0 ms, but sometimes it goes up to 160ms:

declare @p8 xml
set @p8=convert(xml,N'<interactions><interaction correct="false" score="0" 
id="0"    gapid="0" x="61" y="225"><feedback/><element id="0" position="0"  
elementtype="1"><asset/></element></interaction><interaction correct="false" 
score="0" id="1" gapid="1" x="64" y="250"><feedback/><element id="0" position="0" 
elementtype="1"><asset/></element></interaction><interaction correct="false"
score="0" id="2" gapid="2" x="131" y="250"><feedback/><element id="0" position="0" 
elementtype="1"><asset/></element></interaction></interactions>')

declare @p14 xml
set @p14=convert(xml,N'<contentinteractions/>')
exec sp_executesql N'INSERT INTO    
[dbo].[PackageSessionNodes]([dbo].[PackageSessionNodes].[PackageSessionId],
[dbo].[PackageSessionNodes].[TreeNodeId],[dbo].[PackageSessionNodes].[Duration],
[dbo].[PackageSessionNodes].[Score],[dbo].[PackageSessionNodes].[ScoreMax],
[dbo].[PackageSessionNodes].[Interactions],[dbo].[PackageSessionNodes].[BrainTeaser],
[dbo].[PackageSessionNodes].[DateCreated],
[dbo].[PackageSessionNodes].[CompletionStatus],
[dbo].[PackageSessionNodes].[ReducedScore],
[dbo].[PackageSessionNodes].[ReducedScoreMax],
[dbo].[PackageSessionNodes].[ContentInteractions])
VALUES     (@ins_dboPackageSessionNodesPackageSessionId,
@ins_dboPackageSessionNodesTreeNodeId,
@ins_dboPackageSessionNodesDuration,
@ins_dboPackageSessionNodesScore,
@ins_dboPackageSessionNodesScoreMax,
@ins_dboPackageSessionNodesInteractions,
@ins_dboPackageSessionNodesBrainTeaser,
@ins_dboPackageSessionNodesDateCreated,
@ins_dboPackageSessionNodesCompletionStatus,
@ins_dboPackageSessionNodesReducedScore,
@ins_dboPackageSessionNodesReducedScoreMax,
@ins_dboPackageSessionNodesContentInteractions)
;
SELECT SCOPE_IDENTITY() as new_id

This is the table:

CREATE TABLE [dbo].[PackageSessionNodes](
[PackageSessionNodeId] [int] IDENTITY(1,1) NOT NULL,
[PackageSessionId] [int] NOT NULL,
[TreeNodeId] [int] NOT NULL,
[Duration] [int] NULL,
[Score] [float] NOT NULL,
[ScoreMax] [float] NOT NULL,
[Interactions] [xml] NOT NULL,
[BrainTeaser] [bit] NOT NULL,
[DateCreated] [datetime] NULL,
[CompletionStatus] [int] NOT NULL,
[ReducedScore] [float] NOT NULL,
[ReducedScoreMax] [float] NOT NULL,
[ContentInteractions] [xml] NOT NULL,
 CONSTRAINT [PK_PackageSessionNodes] PRIMARY KEY CLUSTERED 
(
[PackageSessionNodeId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF,
 ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[PackageSessionNodes]  WITH CHECK ADD  CONSTRAINT   
[FK_PackageSessionNodes_PackageSessions] FOREIGN KEY([PackageSessionId])
REFERENCES [dbo].[PackageSessions] ([PackageSessionId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO

ALTER TABLE [dbo].[PackageSessionNodes] CHECK CONSTRAINT 
[FK_PackageSessionNodes_PackageSessions]
GO

ALTER TABLE [dbo].[PackageSessionNodes]  WITH CHECK ADD  CONSTRAINT  
[FK_PackageSessionNodes_TreeNodes] FOREIGN KEY([TreeNodeId])
REFERENCES [dbo].[TreeNodes] ([TreeNodeId])
GO

ALTER TABLE [dbo].[PackageSessionNodes] CHECK CONSTRAINT 
[FK_PackageSessionNodes_TreeNodes]
GO

ALTER TABLE [dbo].[PackageSessionNodes] ADD  CONSTRAINT 
[DF_PackageSessionNodes_Score] DEFAULT ((-1)) FOR [Score]
GO

ALTER TABLE [dbo].[PackageSessionNodes] ADD  CONSTRAINT 
[DF_PackageSessionNodes_ScoreMax]  DEFAULT ((-1)) FOR [ScoreMax]
GO

ALTER TABLE [dbo].[PackageSessionNodes] ADD  CONSTRAINT 
[DF_PackageSessionNodes_DateCreated]  DEFAULT (getdate()) FOR [DateCreated]
GO

ALTER TABLE [dbo].[PackageSessionNodes] ADD  CONSTRAINT 
[DF_PackageSessionNodes_ReducedScore]  DEFAULT ((-1)) FOR [ReducedScore]
GO

ALTER TABLE [dbo].[PackageSessionNodes] ADD  CONSTRAINT 
[DF_PackageSessionNodes_ReducedScoreMax]  DEFAULT ((-1)) FOR [ReducedScoreMax]
GO
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:30:20+00:00Added an answer on May 14, 2026 at 1:30 am

    There will be at least some speed impact, since when you put text into an xml column the system validates it to ensure it’s well-formed, and can collapse redundant tags and whitespace. But these operations are quite fast — there should not be significant extra overhead just to do these conversions.

    It’s more likely that locking, index issues, or resource problems on the server are responsible for the occasional slower insert.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read that using database keys in a URL is a bad thing
I have an xml document with a root element, two child elements, 'diagnostic' and
Are out parameters a bad thing in .NET? Any good articles/discussions on this topic?
Sorry for the bad title, but I couldn't think of a better one. I'm
Is it particularly bad to have a very, very large SQL query with lots
Why is it bad practice to declare variables on one line? e.g. private String
I have a two part question. The first I think I have an okay
I have a simple java maven project. One of my classes when executing needs
I use a database with multiple tables in my application. I have an XML
I am reading through a Learn C book right now and have come across

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.