{"id":526,"date":"2011-11-08T14:49:00","date_gmt":"2011-11-08T14:49:00","guid":{"rendered":"\/blogs\/paul\/post\/Survey-wasted-space-from-cluster-keys.aspx"},"modified":"2011-11-08T14:49:00","modified_gmt":"2011-11-08T14:49:00","slug":"survey-wasted-space-from-cluster-keys-code-to-run","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-wasted-space-from-cluster-keys-code-to-run\/","title":{"rendered":"Survey: wasted space from cluster keys (code to run)"},"content":{"rendered":"<p>\n<font face=\"verdana,geneva\" size=\"2\">Continuing with my &quot;index health&quot; series, I&#39;ve got another piece of code for you to run.<\/font>\n<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">This time I&#39;m interested in the number of columns in your clustered indexes and the consequent amount of nonclustered index space used by the clustered index keys.<\/font>\n<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">Again, you&#39;re going to be really interested to see the results on your servers. When I editorialize the results I&#39;ll provide another query for you to run which will make the data actionable on your server.<\/font>\n<\/p>\n<p>\n<font size=\"2\">Here are some results from a random customer server (yes, we already knew about these &#8211; long story :-):<\/font>\n<\/p>\n<blockquote>\n<p>\n\t<font face=\"courier new,courier\" size=\"2\">NCIndexes ClusterKeys KeyWidth TableRows&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; KeySpaceInBytes<br \/>\n\t&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n\t7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 129902437&nbsp;&n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sp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 160696&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3213920<\/font>\n\t<\/p>\n<\/blockquote>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">Feel free to send the results in any format you want &#8211; Excel spreadsheet works best though. Try not to add any columns to the result set &#8211; complicates the aggregation process.<\/font>\n<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">The more results the better &#8211; thanks!<\/font>\n<\/p>\n<p>\n<font face=\"verdana,geneva\" size=\"2\">Here&#39;s the code:<\/font>\n<\/p>\n<blockquote>\n<p>\n\t<font face=\"courier new,courier\" size=\"2\">IF EXISTS (SELECT * FROM tempdb.sys.objects WHERE [name] = &#39;SQLskillsIKSpace&#39;)<br \/>\n\t&nbsp;&nbsp;&nbsp; DROP TABLE tempdb.dbo.SQLskillsIKSpace;<br \/>\n\tGO<br \/>\n\tCREATE TABLE tempdb.dbo.SQLskillsIKSpace (<br \/>\n\t&nbsp;&nbsp;&nbsp; DatabaseID SMALLINT,<br \/>\n\t&nbsp;&nbsp;&nbsp; ObjectID INT,<br \/>\n\t&nbsp;&nbsp;&nbsp; IndexCount SMALLINT,<br \/>\n\t&nbsp;&nbsp;&nbsp; TableRows&nbsp; BIGINT,<br \/>\n\t&nbsp;&nbsp;&nbsp; KeyCount&nbsp;&nbsp; SMALLINT,<br \/>\n\t&nbsp;&nbsp;&nbsp; KeyWidth&nbsp;&nbsp; SMALLINT);<br \/>\n\tGO <\/font>\n\t<\/p>\n<p>\n\t<font face=\"courier new,courier\" size=\"2\">EXEC sp_MSforeachdb&nbsp;<br \/>\n\t&nbsp;&nbsp;&nbsp; N&#39;IF EXISTS (SELECT 1 FROM (SELECT DISTINCT [name] <br \/>\n\t&nbsp;&nbsp;&nbsp; FROM sys.databases WHERE [state_desc] = &#39;&#39;ONLINE&#39;&#39;<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND [database_id] &gt; 4<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND [name] != &#39;&#39;pubs&#39;&#39;<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND [name] != &#39;&#39;Northwind&#39;&#39;<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND [name] != &#39;&#39;distribution&#39;&#39;<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND [name] NOT LIKE &#39;&#39;ReportServer%&#39;&#39;<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND [name] NOT LIKE &#39;&#39;Adventure%&#39;&#39;) AS names WHERE [name] = &#39;&#39;?&#39;&#39;)<br \/>\n\tBEGIN<br \/>\n\tUSE [?]<\/font>\n\t<\/p>\n<p>\n\t<font face=\"courier new,courier\" size=\"2\">INSERT INTO tempdb.dbo.SQLskillsIKSpace<br \/>\n\tSELECT DB_ID (&#39;&#39;?&#39;&#39;), o.[object_id], 0, 0, 0, 0<br \/>\n\tFROM sys.objects o<br \/>\n\tWHERE o.[type_desc] IN (&#39;&#39;USER_TABLE&#39;&#39;, &#39;&#39;VIEW&#39;&#39;)<br \/>\n\t&nbsp;&nbsp;&nbsp; AND o.[is_ms_shipped] = 0<br \/>\n\t&nbsp;&nbsp;&nbsp; AND EXISTS (<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT *<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FROM sys.indexes<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHERE [index_id] = 1<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND [object_id] = o.[object_id]);<\/font>\n\t<\/p>\n<p>\n\t<font face=\"courier new,courier\" size=\"2\">UPDATE tempdb.dbo.SQLskillsIKSpace<br \/>\n\tSET [TableRows] = (<br \/>\n\t&nbsp;&nbsp;&nbsp; SELECT SUM ([rows]) <br \/>\n\t&nbsp;&nbsp;&nbsp; FROM sys.partitions p<br \/>\n\t&nbsp;&nbsp;&nbsp; WHERE p.[object_id] = [ObjectID]<br \/>\n\t&nbsp;&nbsp;&nbsp; AND p.[index_id] = 1)<br \/>\n\tWHERE [DatabaseID] = DB_ID (&#39;&#39;?&#39;&#39;);<br \/>\n\t&nbsp;<br \/>\n\tUPDATE tempdb.dbo.SQLskillsIKSpace<br \/>\n\tSET [IndexCount] = (<br \/>\n\t&nbsp;&nbsp;&nbsp; SELECT COUNT (*) <br \/>\n\t&nbsp;&nbsp;&nbsp; FROM sys.indexes i<br \/>\n\t&nbsp;&nbsp;&nbsp; WHERE i.[object_id] = [ObjectID]<br \/>\n\t&nbsp;&nbsp;&nbsp; AND i.[is_hypothetical] = 0<br \/>\n\t&nbsp;&nbsp;&nbsp; AND i.[is_disabled] = 0<br \/>\n\t&nbsp;&nbsp;&nbsp; AND i.[index_id] != 1)<br \/>\n\tWHERE [DatabaseID] = DB_ID (&#39;&#39;?&#39;&#39;);<\/font>\n\t<\/p>\n<p>\n\t<font face=\"courier new,courier\" size=\"2\">UPDATE tempdb.dbo.SQLskillsIKSpace<br \/>\n\tSET [KeyCount] = (<br \/>\n\t&nbsp;&nbsp;&nbsp; SELECT COUNT (*) <br \/>\n\t&nbsp;&nbsp;&nbsp; FROM sys.index_columns ic<br \/>\n\t&nbsp;&nbsp;&nbsp; WHERE ic.[object_id] = [ObjectID]<br \/>\n\t&nbsp;&nbsp;&nbsp; AND ic.[index_id] = 1)<br \/>\n\tWHERE [DatabaseID] = DB_ID (&#39;&#39;?&#39;&#39;);<\/font>\n\t<\/p>\n<p>\n\t<font face=\"courier new,courier\" size=\"2\">UPDATE tempdb.dbo.SQLskillsIKSpace<br \/>\n\tSET [KeyWidth] = (<br \/>\n\t&nbsp;&nbsp;&nbsp; SELECT SUM (c.[max_length])<br \/>\n\t&nbsp;&nbsp;&nbsp; FROM sys.columns c<br \/>\n\t&nbsp;&nbsp;&nbsp; JOIN sys.index_columns ic<br \/>\n\t&nbsp;&nbsp;&nbsp; ON c.[object_id] = ic.[object_id]<br \/>\n\t&nbsp;&nbsp;&nbsp; AND c.[object_id] = [ObjectID]<br \/>\n\t&nbsp;&nbsp;&nbsp; AND ic.[column_id] = c.[column_id]<br \/>\n\t&nbsp;&nbsp;&nbsp; AND ic.[index_id] = 1)<br \/>\n\tWHERE [DatabaseID] = DB_ID (&#39;&#39;?&#39;&#39;);<\/font>\n\t<\/p>\n<p>\n\t<font face=\"courier new,courier\" size=\"2\">DELETE tempdb.dbo.SQLskillsIKSpace<br \/>\n\tWHERE<br \/>\n\t&nbsp;&nbsp;&nbsp; ([KeyCount] = 1 AND [KeyWidth] &lt; 9)<br \/>\n\t&nbsp;&nbsp;&nbsp; OR [IndexCount] = 0 OR [TableRows] = 0;<\/font>\n\t<\/p>\n<p>\n\t<font face=\"courier new,courier\" size=\"2\">END&#39;;<br \/>\n\tGO <\/font>\n\t<\/p>\n<p>\n\t<font face=\"courier new,courier\" size=\"2\">SELECT<br \/>\n\t&nbsp;&nbsp;&nbsp; [IndexCount] AS [NCIndexes],<br \/>\n\t&nbsp;&nbsp;&nbsp; [KeyCount] AS [ClusterKeys],<br \/>\n\t&nbsp;&nbsp;&nbsp; [KeyWidth],<br \/>\n\t&nbsp;&nbsp;&nbsp; [TableRows],<br \/>\n\t&nbsp;&nbsp;&nbsp; [IndexCount] * [TableRows] * [KeyWidth] AS [KeySpaceInBytes]<br \/>\n\tFROM tempdb.dbo.SQLskillsIKSpace<br \/>\n\tORDER BY [KeySpaceInBytes] DESC;<\/font>\n\t<\/p>\n<p>\n\t<font face=\"courier new,courier\" size=\"2\">DROP TABLE tempdb.dbo.SQLskillsIKSpace;<br \/>\n\tGO<\/font>\n\t<\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Continuing with my &quot;index health&quot; series, I&#39;ve got another piece of code for you to run. This time I&#39;m interested in the number of columns in your clustered indexes and the consequent amount of nonclustered index space used by the clustered index keys. Again, you&#39;re going to be really interested to see the results on [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47,66,91],"tags":[],"class_list":["post-526","post","type-post","status-publish","format-standard","hentry","category-indexes-from-every-angle","category-performance-tuning","category-surveys"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Survey: wasted space from cluster keys (code to run) - Paul S. Randal<\/title>\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.sqlskills.com\/blogs\/paul\/survey-wasted-space-from-cluster-keys-code-to-run\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Survey: wasted space from cluster keys (code to run) - Paul S. Randal\" \/>\n<meta property=\"og:description\" content=\"Continuing with my &quot;index health&quot; series, I&#039;ve got another piece of code for you to run. This time I&#039;m interested in the number of columns in your clustered indexes and the consequent amount of nonclustered index space used by the clustered index keys. Again, you&#039;re going to be really interested to see the results on [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-wasted-space-from-cluster-keys-code-to-run\/\" \/>\n<meta property=\"og:site_name\" content=\"Paul S. Randal\" \/>\n<meta property=\"article:published_time\" content=\"2011-11-08T14:49:00+00:00\" \/>\n<meta name=\"author\" content=\"Paul Randal\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Paul Randal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-wasted-space-from-cluster-keys-code-to-run\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-wasted-space-from-cluster-keys-code-to-run\/\",\"name\":\"Survey: wasted space from cluster keys (code to run) - Paul S. Randal\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\"},\"datePublished\":\"2011-11-08T14:49:00+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-wasted-space-from-cluster-keys-code-to-run\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-wasted-space-from-cluster-keys-code-to-run\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-wasted-space-from-cluster-keys-code-to-run\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Survey: wasted space from cluster keys (code to run)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\",\"name\":\"Paul S. Randal\",\"description\":\"In Recovery...\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\",\"name\":\"Paul Randal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g\",\"caption\":\"Paul Randal\"},\"sameAs\":[\"http:\/\/3.209.169.194\/blogs\/paul\"],\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/author\/paul\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Survey: wasted space from cluster keys (code to run) - Paul S. Randal","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.sqlskills.com\/blogs\/paul\/survey-wasted-space-from-cluster-keys-code-to-run\/","og_locale":"en_US","og_type":"article","og_title":"Survey: wasted space from cluster keys (code to run) - Paul S. Randal","og_description":"Continuing with my &quot;index health&quot; series, I&#39;ve got another piece of code for you to run. This time I&#39;m interested in the number of columns in your clustered indexes and the consequent amount of nonclustered index space used by the clustered index keys. Again, you&#39;re going to be really interested to see the results on [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-wasted-space-from-cluster-keys-code-to-run\/","og_site_name":"Paul S. Randal","article_published_time":"2011-11-08T14:49:00+00:00","author":"Paul Randal","twitter_misc":{"Written by":"Paul Randal","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-wasted-space-from-cluster-keys-code-to-run\/","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-wasted-space-from-cluster-keys-code-to-run\/","name":"Survey: wasted space from cluster keys (code to run) - Paul S. Randal","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website"},"datePublished":"2011-11-08T14:49:00+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-wasted-space-from-cluster-keys-code-to-run\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/paul\/survey-wasted-space-from-cluster-keys-code-to-run\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-wasted-space-from-cluster-keys-code-to-run\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/paul\/"},{"@type":"ListItem","position":2,"name":"Survey: wasted space from cluster keys (code to run)"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/","name":"Paul S. Randal","description":"In Recovery...","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/paul\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce","name":"Paul Randal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g","caption":"Paul Randal"},"sameAs":["http:\/\/3.209.169.194\/blogs\/paul"],"url":"https:\/\/www.sqlskills.com\/blogs\/paul\/author\/paul\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/526","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/comments?post=526"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/526\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/media?parent=526"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/categories?post=526"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/tags?post=526"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}