{"id":1748,"date":"2019-04-19T11:13:03","date_gmt":"2019-04-19T04:13:03","guid":{"rendered":"http:\/\/www.sqlservertutorial.net\/?page_id=1748"},"modified":"2024-03-14T15:17:04","modified_gmt":"2024-03-14T08:17:04","slug":"sql-server-clustered-indexes","status":"publish","type":"page","link":"https:\/\/www.sqlservertutorial.net\/sql-server-indexes\/sql-server-clustered-indexes\/","title":{"rendered":"SQL Server Clustered Indexes"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you will learn about the SQL Server clustered index and how to define a clustered index for a table.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='introduction-to-sql-server-clustered-indexes'>Introduction to SQL Server clustered indexes <a href=\"#introduction-to-sql-server-clustered-indexes\" class=\"anchor\" id=\"introduction-to-sql-server-clustered-indexes\" title=\"Anchor for Introduction to SQL Server clustered indexes\">#<\/a><\/h2>\n\n\n\n<p>The following statement <a href=\"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-create-table\/\">creates a new table<\/a> named <code>production.parts<\/code> that consists of two columns <code>part_id<\/code> and <code>part_name<\/code>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> production.parts(\n    part_id   <span class=\"hljs-built_in\">INT<\/span> <span class=\"hljs-keyword\">NOT<\/span> <span class=\"hljs-literal\">NULL<\/span>, \n    part_name <span class=\"hljs-built_in\">VARCHAR<\/span>(<span class=\"hljs-number\">100<\/span>)\n);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>And this statement <a href=\"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-insert\/\">inserts some rows<\/a> into the <code>production.parts<\/code> table:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">INSERT<\/span> <span class=\"hljs-keyword\">INTO<\/span> \n    production.parts(part_id, part_name)\n<span class=\"hljs-keyword\">VALUES<\/span>\n    (<span class=\"hljs-number\">1<\/span>,<span class=\"hljs-string\">'Frame'<\/span>),\n    (<span class=\"hljs-number\">2<\/span>,<span class=\"hljs-string\">'Head Tube'<\/span>),\n    (<span class=\"hljs-number\">3<\/span>,<span class=\"hljs-string\">'Handlebar Grip'<\/span>),\n    (<span class=\"hljs-number\">4<\/span>,<span class=\"hljs-string\">'Shock Absorber'<\/span>),\n    (<span class=\"hljs-number\">5<\/span>,<span class=\"hljs-string\">'Fork'<\/span>);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The <code>production.parts<\/code> table does not have a <a href=\"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-primary-key\/\">primary key<\/a>. Therefore SQL Server stores its rows in an unordered structure called a <strong>heap<\/strong>.<\/p>\n\n\n\n<p>When you query data from the <code>production.parts<\/code> table, the query optimizer needs to scan the whole table to search.<\/p>\n\n\n\n<p>For example, the following <code>SELECT<\/code> statement finds the part with id 5:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> \n    part_id, \n    part_name\n<span class=\"hljs-keyword\">FROM<\/span> \n    production.parts\n<span class=\"hljs-keyword\">WHERE<\/span> \n    part_id = <span class=\"hljs-number\">5<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>If you display the estimated execution plan in SQL Server Management Studio, you&#8217;ll see how SQL Server came up with the following query plan:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"587\" height=\"125\" src=\"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-Clustered-Index-Table-Scan-1.png\" alt=\"\" class=\"wp-image-1754\" srcset=\"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-Clustered-Index-Table-Scan-1.png 587w, https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-Clustered-Index-Table-Scan-1-300x64.png 300w\" sizes=\"auto, (max-width: 587px) 100vw, 587px\" \/><\/figure>\n\n\n\n<p>Note that to display the estimated execution plan in SQL Server Management Studio, you click the <strong>Display Estimated Execution Plan<\/strong> button or select the query and press the keyboard shortcut <code>Ctrl+L<\/code>:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"436\" height=\"77\" src=\"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-Display-Estimated-Execution-Plan.png\" alt=\"SQL Server Display Estimated Execution Plan\" class=\"wp-image-1756\" srcset=\"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-Display-Estimated-Execution-Plan.png 436w, https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-Display-Estimated-Execution-Plan-300x53.png 300w\" sizes=\"auto, (max-width: 436px) 100vw, 436px\" \/><\/figure>\n\n\n\n<p>Because the <code>production.parts<\/code> table has only five rows, the query executes very fast. However, if the table contains a large number of rows, it&#8217;ll take a lot of time and resources to search for data.<\/p>\n\n\n\n<p>To resolve this issue, SQL Server provides a dedicated structure to speed up the retrieval of rows from a table called index.<\/p>\n\n\n\n<p>SQL Server has two types of indexes: clustered index and non-clustered index. We will focus on the clustered index in this tutorial.<\/p>\n\n\n\n<p>A clustered index stores data rows in a sorted structure based on its key values. Each table has only one clustered index because data rows can be only sorted in one order. A table that has a clustered index is called a clustered table.<\/p>\n\n\n\n<p>The following picture illustrates the structure of a clustered index:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"834\" height=\"457\" src=\"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-Clustered-B-Tree.png\" alt=\"\" class=\"wp-image-1749\" srcset=\"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-Clustered-B-Tree.png 834w, https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-Clustered-B-Tree-300x164.png 300w, https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-Clustered-B-Tree-768x421.png 768w\" sizes=\"auto, (max-width: 834px) 100vw, 834px\" \/><\/figure>\n\n\n\n<p>A clustered index organizes data using a special structured so-called <a href=\"https:\/\/en.wikipedia.org\/wiki\/B-tree\" target=\"_blank\" rel=\"noopener noreferrer\">B-tree<\/a> (or balanced tree) which enables searches, inserts, updates, and deletes in logarithmic amortized time.<\/p>\n\n\n\n<p>In this structure, the top node of the B-tree is called the <strong>root node<\/strong>. The nodes at the bottom level are called the <strong>leaf nodes<\/strong>. Any index levels between the root and the leaf nodes are known as intermediate levels.<\/p>\n\n\n\n<p>In the B-Tree, the root node and intermediate-level nodes contain index pages that hold index rows. The leaf nodes contain the data pages of the underlying table. The pages in each level of the index are linked using another structure called a doubly-linked list.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='sql-server-clustered-index-and-primary-key-constraint'>SQL Server Clustered Index and Primary Key Constraint <a href=\"#sql-server-clustered-index-and-primary-key-constraint\" class=\"anchor\" id=\"sql-server-clustered-index-and-primary-key-constraint\" title=\"Anchor for SQL Server Clustered Index and Primary Key Constraint\">#<\/a><\/h2>\n\n\n\n<p>When you create a table with a <a href=\"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-primary-key\/\">primary key<\/a>, SQL Server automatically creates a corresponding clustered index that includes primary key columns.<\/p>\n\n\n\n<p>This statement <a href=\"https:\/\/www.sqlservertutorial.net\/sql-server-basics\/sql-server-create-table\/\">creates a new table<\/a> named <code>production.part_prices<\/code> with a primary key that includes two columns: <code>part_id<\/code> and <code>valid_from<\/code>.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> production.part_prices(\n    part_id <span class=\"hljs-built_in\">int<\/span>,\n    valid_from <span class=\"hljs-built_in\">date<\/span>,\n    price <span class=\"hljs-built_in\">decimal<\/span>(<span class=\"hljs-number\">18<\/span>,<span class=\"hljs-number\">4<\/span>) <span class=\"hljs-keyword\">not<\/span> <span class=\"hljs-literal\">null<\/span>,\n    PRIMARY <span class=\"hljs-keyword\">KEY<\/span>(part_id, valid_from) \n);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"394\" height=\"202\" src=\"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-Clustered-Index-and-Primary-Key.png\" alt=\"\" class=\"wp-image-1752\" srcset=\"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-Clustered-Index-and-Primary-Key.png 394w, https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-Clustered-Index-and-Primary-Key-300x154.png 300w\" sizes=\"auto, (max-width: 394px) 100vw, 394px\" \/><\/figure>\n\n\n\n<p>If you add a primary key constraint to an existing table that already has a clustered index, SQL Server will enforce the primary key using a non-clustered index:<\/p>\n\n\n\n<p>This statement defines a primary key for the <code>production.parts<\/code> table:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">ALTER<\/span> <span class=\"hljs-keyword\">TABLE<\/span> production.parts\n<span class=\"hljs-keyword\">ADD<\/span> PRIMARY <span class=\"hljs-keyword\">KEY<\/span>(part_id);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>SQL Server created a non-clustered index for the primary key.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"394\" height=\"202\" src=\"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-Clustered-Index-and-Primary-Key.png\" alt=\"\" class=\"wp-image-1752\" srcset=\"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-Clustered-Index-and-Primary-Key.png 394w, https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-Clustered-Index-and-Primary-Key-300x154.png 300w\" sizes=\"auto, (max-width: 394px) 100vw, 394px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id='using-sql-server-create-clustered-index-statement-to-create-a-clustered-index'>Using SQL Server CREATE CLUSTERED INDEX statement to create a clustered index. <a href=\"#using-sql-server-create-clustered-index-statement-to-create-a-clustered-index\" class=\"anchor\" id=\"using-sql-server-create-clustered-index-statement-to-create-a-clustered-index\" title=\"Anchor for Using SQL Server CREATE CLUSTERED INDEX statement to create a clustered index.\">#<\/a><\/h2>\n\n\n\n<p>When a table does not have a primary key, which is very rare, you can use the <code>CREATE CLUSTERED INDEX<\/code> statement to add a clustered index to it.<\/p>\n\n\n\n<p>The following statement creates a clustered index for the <code>production.parts<\/code> table:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">CREATE<\/span> CLUSTERED <span class=\"hljs-keyword\">INDEX<\/span> ix_parts_id\n<span class=\"hljs-keyword\">ON<\/span> production.parts (part_id);  <\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>If you open the <strong>Indexes<\/strong> node under the table name, you will see the new index name <code>ix_parts_id<\/code> with type <code>Clustered<\/code>.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"290\" height=\"183\" src=\"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-Clustered-Index-example.png\" alt=\"\" class=\"wp-image-1753\"\/><\/figure>\n\n\n\n<p>When executing the following statement, the SQL Server traverses the index (Clustered Index Seek) to locate the rows, which is faster than scanning the whole table.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> \n    part_id, \n    part_name\n<span class=\"hljs-keyword\">FROM<\/span> \n    production.parts\n<span class=\"hljs-keyword\">WHERE<\/span> \n    part_id = <span class=\"hljs-number\">5<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"549\" height=\"115\" src=\"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-Clustered-Index-Clustered-Index-Seek.png\" alt=\"\" class=\"wp-image-1751\" srcset=\"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-Clustered-Index-Clustered-Index-Seek.png 549w, https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-Clustered-Index-Clustered-Index-Seek-300x63.png 300w\" sizes=\"auto, (max-width: 549px) 100vw, 549px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id='sql-server-create-clustered-index-syntax'>SQL Server CREATE CLUSTERED INDEX syntax <a href=\"#sql-server-create-clustered-index-syntax\" class=\"anchor\" id=\"sql-server-create-clustered-index-syntax\" title=\"Anchor for SQL Server &lt;code&gt;CREATE CLUSTERED INDEX&lt;\/code&gt; syntax\">#<\/a><\/h2>\n\n\n\n<p>The syntax for creating a clustered index is as follows:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">CREATE<\/span> CLUSTERED <span class=\"hljs-keyword\">INDEX<\/span> index_name\n<span class=\"hljs-keyword\">ON<\/span> schema_name.table_name (column_list);  <\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this syntax:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, specify the name of the clustered index after the <code>CREATE CLUSTERED INDEX<\/code> clause.<\/li>\n\n\n\n<li>Second, specify the schema and table name on which you want to create the index.<\/li>\n\n\n\n<li>Third, list one or more columns included in the index.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id='summary'>Summary <a href=\"#summary\" class=\"anchor\" id=\"summary\" title=\"Anchor for Summary\">#<\/a><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A clustered index physically organizes the data in a table according to the index key.<\/li>\n\n\n\n<li>When creating a table with a primary key, SQL Server automatically creates a clustered index based on the primary key columns.<\/li>\n\n\n\n<li>A table has only one clustered index.<\/li>\n\n\n\n<li>Use the CREATE CLUSTERED INDEX statement to create a new clustered index for a table.<\/li>\n<\/ul>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"1748\"\n\t\t\t\tdata-post-url=\"https:\/\/www.sqlservertutorial.net\/sql-server-indexes\/sql-server-clustered-indexes\/\"\n\t\t\t\tdata-post-title=\"SQL Server Clustered Indexes\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"1748\"\n\t\t\t\tdata-post-url=\"https:\/\/www.sqlservertutorial.net\/sql-server-indexes\/sql-server-clustered-indexes\/\"\n\t\t\t\tdata-post-title=\"SQL Server Clustered Indexes\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial introduces you to the SQL Server clustered index and shows you how to define a clustered index for a table.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1746,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1748","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>SQL Server Clustered Indexes<\/title>\n<meta name=\"description\" content=\"This tutorial introduces you to the SQL Server clustered index and shows you how to define a clustered index for a table.\" \/>\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.sqlservertutorial.net\/sql-server-indexes\/sql-server-clustered-indexes\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL Server Clustered Indexes\" \/>\n<meta property=\"og:description\" content=\"This tutorial introduces you to the SQL Server clustered index and shows you how to define a clustered index for a table.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlservertutorial.net\/sql-server-indexes\/sql-server-clustered-indexes\/\" \/>\n<meta property=\"og:site_name\" content=\"SQL Server Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-14T08:17:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-Clustered-Index-Table-Scan-1.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-indexes\\\/sql-server-clustered-indexes\\\/\",\"url\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-indexes\\\/sql-server-clustered-indexes\\\/\",\"name\":\"SQL Server Clustered Indexes\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-indexes\\\/sql-server-clustered-indexes\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-indexes\\\/sql-server-clustered-indexes\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/wp-content\\\/uploads\\\/SQL-Server-Clustered-Index-Table-Scan-1.png\",\"datePublished\":\"2019-04-19T04:13:03+00:00\",\"dateModified\":\"2024-03-14T08:17:04+00:00\",\"description\":\"This tutorial introduces you to the SQL Server clustered index and shows you how to define a clustered index for a table.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-indexes\\\/sql-server-clustered-indexes\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-indexes\\\/sql-server-clustered-indexes\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-indexes\\\/sql-server-clustered-indexes\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/wp-content\\\/uploads\\\/SQL-Server-Clustered-Index-Table-Scan-1.png\",\"contentUrl\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/wp-content\\\/uploads\\\/SQL-Server-Clustered-Index-Table-Scan-1.png\",\"width\":587,\"height\":125},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-indexes\\\/sql-server-clustered-indexes\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL Server Indexes\",\"item\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/sql-server-indexes\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"SQL Server Clustered Indexes\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/#website\",\"url\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/\",\"name\":\"SQL Server Tutorial\",\"description\":\"The Practical SQL Server Tutorial\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.sqlservertutorial.net\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SQL Server Clustered Indexes","description":"This tutorial introduces you to the SQL Server clustered index and shows you how to define a clustered index for a table.","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.sqlservertutorial.net\/sql-server-indexes\/sql-server-clustered-indexes\/","og_locale":"en_US","og_type":"article","og_title":"SQL Server Clustered Indexes","og_description":"This tutorial introduces you to the SQL Server clustered index and shows you how to define a clustered index for a table.","og_url":"https:\/\/www.sqlservertutorial.net\/sql-server-indexes\/sql-server-clustered-indexes\/","og_site_name":"SQL Server Tutorial","article_modified_time":"2024-03-14T08:17:04+00:00","og_image":[{"url":"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-Clustered-Index-Table-Scan-1.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlservertutorial.net\/sql-server-indexes\/sql-server-clustered-indexes\/","url":"https:\/\/www.sqlservertutorial.net\/sql-server-indexes\/sql-server-clustered-indexes\/","name":"SQL Server Clustered Indexes","isPartOf":{"@id":"https:\/\/www.sqlservertutorial.net\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.sqlservertutorial.net\/sql-server-indexes\/sql-server-clustered-indexes\/#primaryimage"},"image":{"@id":"https:\/\/www.sqlservertutorial.net\/sql-server-indexes\/sql-server-clustered-indexes\/#primaryimage"},"thumbnailUrl":"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-Clustered-Index-Table-Scan-1.png","datePublished":"2019-04-19T04:13:03+00:00","dateModified":"2024-03-14T08:17:04+00:00","description":"This tutorial introduces you to the SQL Server clustered index and shows you how to define a clustered index for a table.","breadcrumb":{"@id":"https:\/\/www.sqlservertutorial.net\/sql-server-indexes\/sql-server-clustered-indexes\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlservertutorial.net\/sql-server-indexes\/sql-server-clustered-indexes\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlservertutorial.net\/sql-server-indexes\/sql-server-clustered-indexes\/#primaryimage","url":"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-Clustered-Index-Table-Scan-1.png","contentUrl":"https:\/\/www.sqlservertutorial.net\/wp-content\/uploads\/SQL-Server-Clustered-Index-Table-Scan-1.png","width":587,"height":125},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlservertutorial.net\/sql-server-indexes\/sql-server-clustered-indexes\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlservertutorial.net\/"},{"@type":"ListItem","position":2,"name":"SQL Server Indexes","item":"https:\/\/www.sqlservertutorial.net\/sql-server-indexes\/"},{"@type":"ListItem","position":3,"name":"SQL Server Clustered Indexes"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlservertutorial.net\/#website","url":"https:\/\/www.sqlservertutorial.net\/","name":"SQL Server Tutorial","description":"The Practical SQL Server Tutorial","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlservertutorial.net\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/pages\/1748","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/comments?post=1748"}],"version-history":[{"count":4,"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/pages\/1748\/revisions"}],"predecessor-version":[{"id":3574,"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/pages\/1748\/revisions\/3574"}],"up":[{"embeddable":true,"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/pages\/1746"}],"wp:attachment":[{"href":"https:\/\/www.sqlservertutorial.net\/wp-json\/wp\/v2\/media?parent=1748"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}