{"id":41897,"date":"2025-12-11T21:38:55","date_gmt":"2025-12-11T20:38:55","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/?p=41897"},"modified":"2025-12-15T09:31:42","modified_gmt":"2025-12-15T08:31:42","slug":"sql-server-xml-performance-explained","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/","title":{"rendered":"Understanding XML performance pitfalls in SQL Server"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"h-context\">Context<\/h2>\n\n\n\n<p>Working with XML in SQL Server can feel like taming a wild beast. It\u2019s undeniably flexible and great for storing complex hierarchical data, but when it comes to querying efficiently, many developers hit a wall. That\u2019s where things get interesting.<\/p>\n\n\n\n<p>In this post, we\u2019ll dive into a real-world scenario with half a million rows, put two XML query methods head-to-head <code>.exist()<\/code> vs <code>.value()<\/code>, and uncover how SQL Server handles them under the scenes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-practical-example\">Practical example<\/h2>\n\n\n\n<p>To demonstrate this, we\u2019ll use SQL Server 2022 Developer Edition and create a table based on the open-source <a href=\"https:\/\/www.brentozar.com\/archive\/2021\/03\/download-the-current-stack-overflow-database-for-free-2021-02\/\">StackOverflow2010 database<\/a>, derived from the Posts table, but storing part of the original data in XML format. We will also add a few indexes to simulate an environment with a minimum level of optimization.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE TABLE dbo.PostsXmlPerf\n(\n    PostId        INT           NOT NULL PRIMARY KEY,\n    PostTypeId    INT           NOT NULL,\n    CreationDate  DATETIME      NOT NULL,\n    Score         INT           NOT NULL,\n    Body          NVARCHAR(MAX) NOT NULL,\n    MetadataXml   XML           NOT NULL\n);\n\nINSERT INTO dbo.PostsXmlPerf (PostId, PostTypeId, CreationDate, Score, Body, MetadataXml)\nSELECT TOP (500000)\n       p.Id,\n       p.PostTypeId,\n       p.CreationDate,\n       p.Score,\n       p.Body,\n       (\n           SELECT  \n               p.OwnerUserId     AS &#091;@OwnerUserId],\n               p.LastEditorUserId AS &#091;@LastEditorUserId],\n               p.AnswerCount     AS &#091;@AnswerCount],\n               p.CommentCount    AS &#091;@CommentCount],\n               p.FavoriteCount   AS &#091;@FavoriteCount],\n               p.ViewCount       AS &#091;@ViewCount],\n               (\n                   SELECT TOP (5)\n                          c.Id           AS &#091;Comment\/@Id],\n                          c.Score        AS &#091;Comment\/@Score],\n                          c.CreationDate AS &#091;Comment\/@CreationDate]\n                   FROM dbo.Comments c\n                   WHERE c.PostId = p.Id\n                   FOR XML PATH(''), TYPE\n               )\n           FOR XML PATH('PostMeta'), TYPE\n       )\nFROM dbo.Posts p\nORDER BY p.Id;\n\nCREATE nonclustered INDEX IX_PostsXmlPerf_CreationDate\nON dbo.PostsXmlPerf (CreationDate);\n\nCREATE nonclustered INDEX IX_PostsXmlPerf_PostTypeId\nON dbo.PostsXmlPerf (PostTypeId);<\/code><\/pre>\n\n\n\n<p>Next, let\u2019s create two queries designed to interrogate the column that contains XML data, in order to extract information based on a condition applied to a value stored within that XML.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SET STATISTICS IO ON;\nSET STATISTICS TIME ON;\n\nDBCC FREEPROCCACHE;\n\nSELECT PostId, Score\nFROM dbo.PostsXmlPerf\nWHERE MetadataXml.exist('\/PostMeta&#091;@OwnerUserId=\"8\"]') = 1;<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"406\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-22-1024x406.png\" alt=\"\" class=\"wp-image-41915\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-22-1024x406.png 1024w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-22-300x119.png 300w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-22-768x305.png 768w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-22.png 1457w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>DBCC FREEPROCCACHE;\n\nSELECT PostId, Score\nFROM dbo.PostsXmlPerf\nWHERE MetadataXml.value('(\/PostMeta\/@OwnerUserId)&#091;1]', 'INT') = 8<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"284\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-23-1024x284.png\" alt=\"\" class=\"wp-image-41916\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-23-1024x284.png 1024w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-23-300x83.png 300w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-23-768x213.png 768w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-23.png 1450w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Comparing logical and physical reads, we notice something interesting:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><\/td><td>Logical Reads<\/td><td>CPU Time<\/td><\/tr><tr><td>.exist()<\/td><td>125&#8217;912<\/td><td>00:00:05.954<\/td><\/tr><tr><td>.value()<\/td><td>125&#8217;912<\/td><td>00:00:03.125<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>At first glance, the number of pages read is identical, but .exist() is clearly taking more time. Why? Execution plans reveal that .exist() sneaks in a Merge Join, adding overhead.<br>Additionally, on both execution plans we can see a small yellow bang icon. On the first plan, it\u2019s just a memory grant warning, but the second one is more interesting:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"483\" height=\"179\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-19.png\" alt=\"\" class=\"wp-image-41910\" style=\"width:450px;height:auto\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-19.png 483w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-19-300x111.png 300w\" sizes=\"auto, (max-width: 483px) 100vw, 483px\" \/><\/figure>\n<\/div>\n\n\n<p>Alright, a bit strange ; let\u2019s move forward with some tuning and maybe this warning will disappear.<br>To help with querying, it can be useful to create a more targeted index for XML queries.<br>Let\u2019s create an index on the column that contains XML. However, as you might expect, it\u2019s not as straightforward as indexing a regular column. For an XML column, you first need to create a primary XML index, which physically indexes the overall structure of the column (similar to a clustered index), and then a secondary XML index, which builds on the primary index and is optimized for a specific type of query (value, path, or property) &#8211; to know more about XML indexes : <a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/t-sql\/statements\/create-xml-index-transact-sql?view=sql-server-ver17\">Microsoft Learn<\/a>, <a href=\"http:\/\/mssqltips.com\/tutorial\/sql-server-xml-i\">MssqlTips<\/a>. <br>So, let&#8217;s create these indexes !<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE PRIMARY XML INDEX IX_XML_Primary_MetadataXml\nON dbo.PostsXmlPerf (MetadataXml);\n\nCREATE XML INDEX IX_XML_Value_MetadataXml\nON dbo.PostsXmlPerf (MetadataXml)\nUSING XML INDEX IX_XML_Primary_MetadataXml FOR Value;<\/code><\/pre>\n\n\n\n<p>Let\u2019s rerun the performance tests with our two queries above, making sure to flush the buffer cache between each execution.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"310\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-24-1024x310.png\" alt=\"\" class=\"wp-image-41917\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-24-1024x310.png 1024w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-24-300x91.png 300w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-24-768x232.png 768w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-24.png 1379w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"296\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-25-1024x296.png\" alt=\"\" class=\"wp-image-41918\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-25-1024x296.png 1024w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-25-300x87.png 300w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-25-768x222.png 768w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-25.png 1458w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>\ufeff<\/td><td>Logical Reads<\/td><td>CPU Time<\/td><\/tr><tr><td>.exist()<\/td><td>4<\/td><td>00:00:00.031<\/td><\/tr><tr><td>.value()<\/td><td>125&#8217;912<\/td><td>00:00:03.937<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>The inevitable happened: the implicit conversion makes it impossible to use the secondary XML index due to a data type mismatch, preventing an actual seek on it. We do see a seek in the second execution plan, but it occurs for every row in the table (500&#8217;000 executions) and is essentially just accessing the underlying physical structure stored in the clustered index. In reality, this &#8216;seek&#8217; is SQL Server scanning the XML to retrieve the exact value of the requested field (in this case, <em>OwnerUserId<\/em>).<br>This conversion issue occurs because the <a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/t-sql\/xml\/exist-method-xml-data-type?view=sql-server-ver17\">function .exist()<\/a> returns a BIT, while the <a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/t-sql\/xml\/value-method-xml-data-type?view=sql-server-ver17\">function .value()<\/a> returns a SQL type.<br>This difference in return type can lead to significant performance problems when tuning queries that involve XML. <br>As explained by <a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/t-sql\/xml\/value-method-xml-data-type?view=sql-server-ver17\">Microsoft<\/a>: <em>&#8220;For performance reasons, instead of using the&nbsp;<code>value()<\/code>&nbsp;method in a predicate to compare with a relational value, use&nbsp;<code>exist()<\/code>&nbsp;with&nbsp;<code>sql:column()<\/code>&#8220;<\/em> <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-key-take-aways\">Key take-aways<\/h2>\n\n\n\n<p>Working with XML in SQL Server can be powerful, but it can quickly become tricky to manage. <code>.exist()<\/code> and <code>.value()<\/code> might seem similar, but execution differences and type conversions can have a huge performance impact. Proper XML indexing is essential, and knowing your returned data types can save you from hours of head-scratching. Most importantly, before deciding to store data as XML, consider whether it\u2019s truly necessary ; relational databases are not natively optimized for XML and can introduce complexity and performance challenges.<\/p>\n\n\n\n<p>Sometimes, a simpler and highly effective approach is to extract frequently queried XML fields at the application level and store them in separate columns. This makes them much easier to index and query, reducing overhead while keeping your data accessible.<\/p>\n\n\n\n<p>If your application relies heavily on semi-structured data or large volumes of XML\/JSON, it\u2019s worth considering alternative engines. For instance, <strong>MongoDB<\/strong> provides native document storage and fast queries on JSON\/BSON, while <strong>PostgreSQL<\/strong> offers XML and JSONB support with powerful querying functions. Choosing the right tool for the job can simplify your architecture and significantly improve performance.<\/p>\n\n\n\n<p>And to dive even deeper into the topic, with a forthcoming article focused this time on XML storage, keep an eye on the <strong>dbi services<\/strong> blogs !<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A deep dive into how SQL Server processes XML, the performance impact of XQuery methods, and why proper indexing matters.<\/p>\n","protected":false},"author":157,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[368,99],"tags":[67,51,41],"type_dbi":[],"class_list":["post-41897","post","type-post","status-publish","format-standard","hentry","category-development-performance","category-sql-server","tag-performance","tag-sql-server","tag-xml"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Understanding XML performance pitfalls in SQL Server - dbi Blog<\/title>\n<meta name=\"description\" content=\"SQL Server XML: compare .exist() vs .value(), explore indexing strategies, and tips for efficient XML handling and storage choices.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Understanding XML performance pitfalls in SQL Server\" \/>\n<meta property=\"og:description\" content=\"SQL Server XML: compare .exist() vs .value(), explore indexing strategies, and tips for efficient XML handling and storage choices.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2025-12-11T20:38:55+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-12-15T08:31:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-22.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1457\" \/>\n\t<meta property=\"og:image:height\" content=\"578\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Louis Tochon\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Louis Tochon\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/\"},\"author\":{\"name\":\"Louis Tochon\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/e4195b0cb120295b3407a502c23e75b6\"},\"headline\":\"Understanding XML performance pitfalls in SQL Server\",\"datePublished\":\"2025-12-11T20:38:55+00:00\",\"dateModified\":\"2025-12-15T08:31:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/\"},\"wordCount\":755,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-22-1024x406.png\",\"keywords\":[\"Performance\",\"SQL Server\",\"XML\"],\"articleSection\":[\"Development &amp; Performance\",\"SQL Server\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/\",\"name\":\"Understanding XML performance pitfalls in SQL Server - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-22-1024x406.png\",\"datePublished\":\"2025-12-11T20:38:55+00:00\",\"dateModified\":\"2025-12-15T08:31:42+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/e4195b0cb120295b3407a502c23e75b6\"},\"description\":\"SQL Server XML: compare .exist() vs .value(), explore indexing strategies, and tips for efficient XML handling and storage choices.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/#primaryimage\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-22.png\",\"contentUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-22.png\",\"width\":1457,\"height\":578},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Understanding XML performance pitfalls in SQL Server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/e4195b0cb120295b3407a502c23e75b6\",\"name\":\"Louis Tochon\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/ce0ee48c64e763e6c4076e21c80729d15bc4493288aeb8695125c69082100e10?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ce0ee48c64e763e6c4076e21c80729d15bc4493288aeb8695125c69082100e10?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ce0ee48c64e763e6c4076e21c80729d15bc4493288aeb8695125c69082100e10?s=96&d=mm&r=g\",\"caption\":\"Louis Tochon\"},\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/louistochon\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Understanding XML performance pitfalls in SQL Server - dbi Blog","description":"SQL Server XML: compare .exist() vs .value(), explore indexing strategies, and tips for efficient XML handling and storage choices.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/","og_locale":"en_US","og_type":"article","og_title":"Understanding XML performance pitfalls in SQL Server","og_description":"SQL Server XML: compare .exist() vs .value(), explore indexing strategies, and tips for efficient XML handling and storage choices.","og_url":"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/","og_site_name":"dbi Blog","article_published_time":"2025-12-11T20:38:55+00:00","article_modified_time":"2025-12-15T08:31:42+00:00","og_image":[{"width":1457,"height":578,"url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-22.png","type":"image\/png"}],"author":"Louis Tochon","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Louis Tochon","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/"},"author":{"name":"Louis Tochon","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/e4195b0cb120295b3407a502c23e75b6"},"headline":"Understanding XML performance pitfalls in SQL Server","datePublished":"2025-12-11T20:38:55+00:00","dateModified":"2025-12-15T08:31:42+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/"},"wordCount":755,"commentCount":0,"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-22-1024x406.png","keywords":["Performance","SQL Server","XML"],"articleSection":["Development &amp; Performance","SQL Server"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/","url":"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/","name":"Understanding XML performance pitfalls in SQL Server - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-22-1024x406.png","datePublished":"2025-12-11T20:38:55+00:00","dateModified":"2025-12-15T08:31:42+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/e4195b0cb120295b3407a502c23e75b6"},"description":"SQL Server XML: compare .exist() vs .value(), explore indexing strategies, and tips for efficient XML handling and storage choices.","breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/#primaryimage","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-22.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/12\/image-22.png","width":1457,"height":578},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-xml-performance-explained\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Understanding XML performance pitfalls in SQL Server"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/e4195b0cb120295b3407a502c23e75b6","name":"Louis Tochon","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ce0ee48c64e763e6c4076e21c80729d15bc4493288aeb8695125c69082100e10?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ce0ee48c64e763e6c4076e21c80729d15bc4493288aeb8695125c69082100e10?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ce0ee48c64e763e6c4076e21c80729d15bc4493288aeb8695125c69082100e10?s=96&d=mm&r=g","caption":"Louis Tochon"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/louistochon\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/41897","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/157"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=41897"}],"version-history":[{"count":26,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/41897\/revisions"}],"predecessor-version":[{"id":42039,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/41897\/revisions\/42039"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=41897"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=41897"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=41897"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=41897"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}