<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>extent &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/extent/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Thu, 16 Nov 2017 07:12:38 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.6</generator>
	<item>
		<title>SQL Server: GAM and SGAM Pages to find the Extent Space Information</title>
		<link>https://www.dbrnd.com/2016/04/sql-server-gam-and-sgam-pages-to-find-the-extent-space-information/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 17 Apr 2016 21:16:21 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[extent]]></category>
		<category><![CDATA[GAM]]></category>
		<category><![CDATA[Global Allocation Map]]></category>
		<category><![CDATA[SGAM]]></category>
		<category><![CDATA[Shared Global Allocation Map]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=2325</guid>

					<description><![CDATA[In the previous article, I shared information about the SQL Server Extent which is storing eight data pages. The SQL Server manages two important pages to store information about occupied and free space of each extent. GAM: Stands for Global Allocation Map. SGAM: Stands for Shared Global Allocation Map. Global Allocation Map (GAM): GAM has [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-gam-and-sgam-pages-to-find-the-extent-space-information%2F&amp;linkname=SQL%20Server%3A%20GAM%20and%20SGAM%20Pages%20to%20find%20the%20Extent%20Space%20Information" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-gam-and-sgam-pages-to-find-the-extent-space-information%2F&amp;linkname=SQL%20Server%3A%20GAM%20and%20SGAM%20Pages%20to%20find%20the%20Extent%20Space%20Information" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-gam-and-sgam-pages-to-find-the-extent-space-information%2F&amp;linkname=SQL%20Server%3A%20GAM%20and%20SGAM%20Pages%20to%20find%20the%20Extent%20Space%20Information" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-gam-and-sgam-pages-to-find-the-extent-space-information%2F&amp;linkname=SQL%20Server%3A%20GAM%20and%20SGAM%20Pages%20to%20find%20the%20Extent%20Space%20Information" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-gam-and-sgam-pages-to-find-the-extent-space-information%2F&amp;linkname=SQL%20Server%3A%20GAM%20and%20SGAM%20Pages%20to%20find%20the%20Extent%20Space%20Information" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-gam-and-sgam-pages-to-find-the-extent-space-information%2F&amp;linkname=SQL%20Server%3A%20GAM%20and%20SGAM%20Pages%20to%20find%20the%20Extent%20Space%20Information" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-gam-and-sgam-pages-to-find-the-extent-space-information%2F&#038;title=SQL%20Server%3A%20GAM%20and%20SGAM%20Pages%20to%20find%20the%20Extent%20Space%20Information" data-a2a-url="https://www.dbrnd.com/2016/04/sql-server-gam-and-sgam-pages-to-find-the-extent-space-information/" data-a2a-title="SQL Server: GAM and SGAM Pages to find the Extent Space Information"></a></p><p>In the previous article, I shared information about the <a href="https://www.dbrnd.com/2016/04/sql-server-understanding-the-role-of-extent/" target="_blank"><strong>SQL Server Extent</strong></a> which is storing eight data pages.</p>
<p>The SQL Server manages two important pages to store information about occupied and free space of each extent.</p>
<p><em>GAM: Stands for Global Allocation Map.<br />
SGAM: Stands for Shared Global Allocation Map.</em></p>
<p><strong>Global Allocation Map (GAM):</strong></p>
<blockquote><p>GAM has a bit for every extent, and it records what extents have been allocated for any use.</p>
<p>It stores information about both Uniform and Mixed extents.</p></blockquote>
<blockquote><p>If the bit value is 0, extent is in use, and If the bit value is 1, extent is free.<br />
It can hold information about the total 64000 extents, and approximately size is 4000 MB.</p></blockquote>
<blockquote><p>When a new page needs to be allocated, SQL Server finds available extent into GAM pages. When an extent is de-allocated, the bit for this extent is reset in GAM and it makes an available for future allocations.</p></blockquote>
<p><strong>Shared Global Allocation Map (SGAM):</strong></p>
<blockquote><p>SGAM has a bit for every extent, and it records what extents are currently being used as mixed extent and have at least one unused page.</p></blockquote>
<blockquote><p>If the bit value is 0, either extent is not a mixed extent, or it is a mixed extent and all its pages being used.<br />
If the bit value is 1, it is a mixed extent and having an at least one unused page.</p></blockquote>
<blockquote><p>It can hold information about the total 64000 extents and approximately size is 4000 MB.</p>
<p>When almost all extents are full and SQL Server unable to find free extent information from the GAM page, it uses the SGAM page to find the information about the free extent.</p></blockquote>
<p><strong>DBCC PAGE to check Allocation Status:</strong></p><pre class="crayon-plain-tag">/*
FileID: 1
PageID: 296
*/
DBCC TRACEON(3604)
GO
DBCC PAGE('database_name',1,296,3)</pre><p>
<p><a href="https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerGAMPage.png" rel="attachment wp-att-2333"><img fetchpriority="high" decoding="async" class="alignnone wp-image-2333 size-full" title="SQL Server GAM Page" src="https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerGAMPage.png" alt="SQL Server GAM Page" width="728" height="71" srcset="https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerGAMPage.png 728w, https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerGAMPage-300x29.png 300w, https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerGAMPage-150x15.png 150w" sizes="(max-width: 728px) 100vw, 728px" /></a></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server: Understanding the role of Extent</title>
		<link>https://www.dbrnd.com/2016/04/sql-server-understanding-the-role-of-extent/</link>
					<comments>https://www.dbrnd.com/2016/04/sql-server-understanding-the-role-of-extent/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 16 Apr 2016 07:28:33 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[extent]]></category>
		<category><![CDATA[fragmented]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=2312</guid>

					<description><![CDATA[In the previous articles, I explained basic about the architecture of Data Files and Data Pages of the SQL Server. The SQL Server Extent is one type of storage unit, and it stores eight physical contiguous 8KB pages. Each extent size is 64KB and it can store 16 extents per megabyte. The eight data pages [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-understanding-the-role-of-extent%2F&amp;linkname=SQL%20Server%3A%20Understanding%20the%20role%20of%20Extent" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-understanding-the-role-of-extent%2F&amp;linkname=SQL%20Server%3A%20Understanding%20the%20role%20of%20Extent" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-understanding-the-role-of-extent%2F&amp;linkname=SQL%20Server%3A%20Understanding%20the%20role%20of%20Extent" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-understanding-the-role-of-extent%2F&amp;linkname=SQL%20Server%3A%20Understanding%20the%20role%20of%20Extent" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-understanding-the-role-of-extent%2F&amp;linkname=SQL%20Server%3A%20Understanding%20the%20role%20of%20Extent" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-understanding-the-role-of-extent%2F&amp;linkname=SQL%20Server%3A%20Understanding%20the%20role%20of%20Extent" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-understanding-the-role-of-extent%2F&#038;title=SQL%20Server%3A%20Understanding%20the%20role%20of%20Extent" data-a2a-url="https://www.dbrnd.com/2016/04/sql-server-understanding-the-role-of-extent/" data-a2a-title="SQL Server: Understanding the role of Extent"></a></p><p><em>In the previous articles, I explained basic about the architecture of <a href="https://www.dbrnd.com/2016/04/sql-server-the-internal-storage-architecture-of-the-database-files/" target="_blank"><strong>Data Files</strong></a> and <a href="https://www.dbrnd.com/2016/04/sql-server-the-internal-structure-of-the-data-page/" target="_blank"><strong>Data Pages</strong></a> of the SQL Server. </em></p>
<blockquote><p>The SQL Server Extent is one type of storage unit, and it stores eight physical contiguous 8KB pages.</p>
<p>Each extent size is 64KB and it can store 16 extents per megabyte.</p></blockquote>
<blockquote><p>The eight data pages are logically grouped into extents and extents is responsible to manage storage space for data pages.</p></blockquote>
<blockquote><p>As per my previous discussion, a single data page can never merge data from multiple tables.<br />
But SQL Server does not allocate whole extents to the particular table.</p></blockquote>
<p>There are two types of Extent, Uniform Extent and Mixed Extent.</p>
<blockquote><p><strong>Uniform Extent:</strong> This Extent basically for single user object and it stores all 8 data pages for a single user object. If our table has a large set of records, internally, it stores all 8 data pages into one Extent.</p></blockquote>
<blockquote><p><strong>Mixed Extent:</strong> This Extent owned by multiple user object and it stores 8 data pages may be for multiple user object. It can also combine different type of data pages into one extent.</p></blockquote>
<blockquote><p>When you first create a table SQL Server starts by allocating a data page to it from a Mixed Extent. Once the table has enough data to warrant a full extent, SQL Server will allocate a Uniform Extent to it.</p></blockquote>
<p><strong>Let me explain with the simple example:</strong></p>
<p><strong>First, create a table with sample records:</strong></p><pre class="crayon-plain-tag">CREATE TABLE tbl_TestPages(
   Name CHAR(8000)
)
GO

-- INSERT 50 Records
INSERT INTO tbl_TestPages VALUES('dbrnd.com')
GO 50</pre><p>
<p><strong>DBCC IND to check the information about allocated pages:</strong></p><pre class="crayon-plain-tag">DBCC IND('database_name','tbl_TestPages',1)</pre><p>
<p><strong>The Result:</strong></p>
<p><a href="https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerFragmentedPages.png" rel="attachment wp-att-2321"><img decoding="async" class="alignnone wp-image-2321 size-full" title="SQL Server Fragmented Pages" src="https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerFragmentedPages.png" alt="SQL Server Fragmented Pages" width="704" height="304" srcset="https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerFragmentedPages.png 704w, https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerFragmentedPages-300x130.png 300w, https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerFragmentedPages-150x65.png 150w" sizes="(max-width: 704px) 100vw, 704px" /></a></p>
<p>You can find first 8 pages don&#8217;t have sequential PagePID because the first time it stored in a Mixed Extent mode. The second 8 pages have a sequential PagePID because the same table requires more 8KB pages.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/04/sql-server-understanding-the-role-of-extent/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
