<?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>Le blog de SQLpro &#187; partition</title>
	<atom:link href="https://blog.developpez.com/sqlpro/ptag/partition/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.developpez.com/sqlpro</link>
	<description>Le SQL pour SQL Server, PostGreSQL et tous les autres SGBDR</description>
	<lastBuildDate>Thu, 15 Oct 2020 12:59:17 +0000</lastBuildDate>
	<language>fr-FR</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.42</generator>
	<item>
		<title>Métrique de volumétrie du stockage par table, index et partition</title>
		<link>https://blog.developpez.com/sqlpro/p13171/ms-sql-server/metrique-de-volumetrie-du-stockage-par-table-index-et-partition</link>
		<comments>https://blog.developpez.com/sqlpro/p13171/ms-sql-server/metrique-de-volumetrie-du-stockage-par-table-index-et-partition#comments</comments>
		<pubDate>Wed, 07 Feb 2018 09:19:04 +0000</pubDate>
		<dc:creator><![CDATA[SQLpro]]></dc:creator>
				<category><![CDATA[MS SQL Server]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server 2012]]></category>
		<category><![CDATA[SQL Server 2014]]></category>
		<category><![CDATA[SQL Server 2016]]></category>
		<category><![CDATA[SQL Server 2017]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[métrique]]></category>
		<category><![CDATA[partition]]></category>
		<category><![CDATA[SQL server]]></category>
		<category><![CDATA[stockage]]></category>

		<guid isPermaLink="false">http://blog.developpez.com/sqlpro/?p=789</guid>
		<description><![CDATA[Voici une petite requête complémentaire pour mesurer les volumes stockées par partition, index et tables d&#8217;une base : SELECT s.name AS TABLE_SCHEMA, o.name AS TABLE_NAME, i.name AS INDEX_NAME, &#160; &#160; &#160; &#160;fs.name AS FILEGROUP_NAME, f.name AS FILE_NAME, f.physical_name, p.partition_number, &#160; &#160; &#160; &#160;p.ROWS, p.data_compression_desc, au.total_pages * 8 AS SIZE_TOTAL_KO, &#160; &#160; &#160; &#160;SUM&#40;au.total_pages * 8&#41; [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Voici une petite requête complémentaire pour mesurer les volumes stockées par partition, index et tables d&rsquo;une base :<br />
<span id="more-789"></span></p>
<div class="codecolorer-container sql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold;">SELECT</span> s<span style="color: #66cc66;">.</span>name <span style="color: #993333; font-weight: bold;">AS</span> TABLE_SCHEMA<span style="color: #66cc66;">,</span> o<span style="color: #66cc66;">.</span>name <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #993333; font-weight: bold;">TABLE_NAME</span><span style="color: #66cc66;">,</span> i<span style="color: #66cc66;">.</span>name <span style="color: #993333; font-weight: bold;">AS</span> INDEX_NAME<span style="color: #66cc66;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp;fs<span style="color: #66cc66;">.</span>name <span style="color: #993333; font-weight: bold;">AS</span> FILEGROUP_NAME<span style="color: #66cc66;">,</span> f<span style="color: #66cc66;">.</span>name <span style="color: #993333; font-weight: bold;">AS</span> FILE_NAME<span style="color: #66cc66;">,</span> f<span style="color: #66cc66;">.</span>physical_name<span style="color: #66cc66;">,</span> p<span style="color: #66cc66;">.</span>partition_number<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;p<span style="color: #66cc66;">.</span><span style="color: #993333; font-weight: bold;">ROWS</span><span style="color: #66cc66;">,</span> p<span style="color: #66cc66;">.</span>data_compression_desc<span style="color: #66cc66;">,</span> au<span style="color: #66cc66;">.</span>total_pages <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">8</span> <span style="color: #993333; font-weight: bold;">AS</span> SIZE_TOTAL_KO<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">SUM</span><span style="color: #66cc66;">&#40;</span>au<span style="color: #66cc66;">.</span>total_pages <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">OVER</span><span style="color: #66cc66;">&#40;</span>PARTITION <span style="color: #993333; font-weight: bold;">BY</span> i<span style="color: #66cc66;">.</span>name<span style="color: #66cc66;">,</span> s<span style="color: #66cc66;">.</span>name<span style="color: #66cc66;">,</span> o<span style="color: #66cc66;">.</span>name<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> SIZE_TOTAL_INDEX_KO<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">SUM</span><span style="color: #66cc66;">&#40;</span>au<span style="color: #66cc66;">.</span>total_pages <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">OVER</span><span style="color: #66cc66;">&#40;</span>PARTITION <span style="color: #993333; font-weight: bold;">BY</span> s<span style="color: #66cc66;">.</span>name<span style="color: #66cc66;">,</span> o<span style="color: #66cc66;">.</span>name<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> SIZE_TOTAL_TABLE_KO<br />
<span style="color: #993333; font-weight: bold;">FROM</span> &nbsp; sys<span style="color: #66cc66;">.</span>partitions <span style="color: #993333; font-weight: bold;">AS</span> p<br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">JOIN</span> sys<span style="color: #66cc66;">.</span>allocation_units <span style="color: #993333; font-weight: bold;">AS</span> au<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ON</span> p<span style="color: #66cc66;">.</span>hobt_id <span style="color: #66cc66;">=</span> au<span style="color: #66cc66;">.</span>container_id<br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">JOIN</span> sys<span style="color: #66cc66;">.</span>filegroups <span style="color: #993333; font-weight: bold;">AS</span> fs<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ON</span> au<span style="color: #66cc66;">.</span>data_space_id <span style="color: #66cc66;">=</span> fs<span style="color: #66cc66;">.</span>data_space_id<br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">JOIN</span> sys<span style="color: #66cc66;">.</span>database_files <span style="color: #993333; font-weight: bold;">AS</span> f<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ON</span> fs<span style="color: #66cc66;">.</span>data_space_id <span style="color: #66cc66;">=</span> f<span style="color: #66cc66;">.</span>file_id<br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">JOIN</span> sys<span style="color: #66cc66;">.</span>objects <span style="color: #993333; font-weight: bold;">AS</span> o<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ON</span> p<span style="color: #66cc66;">.</span>object_id <span style="color: #66cc66;">=</span> o<span style="color: #66cc66;">.</span>object_id<br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">JOIN</span> sys<span style="color: #66cc66;">.</span>schemas <span style="color: #993333; font-weight: bold;">AS</span> s <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ON</span> o<span style="color: #66cc66;">.</span>schema_id <span style="color: #66cc66;">=</span> s<span style="color: #66cc66;">.</span>schema_id<br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">JOIN</span> sys<span style="color: #66cc66;">.</span>indexes <span style="color: #993333; font-weight: bold;">AS</span> i<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ON</span> p<span style="color: #66cc66;">.</span>object_id <span style="color: #66cc66;">=</span> i<span style="color: #66cc66;">.</span>object_id <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">AND</span> p<span style="color: #66cc66;">.</span>index_id <span style="color: #66cc66;">=</span> i<span style="color: #66cc66;">.</span>index_id;</div></div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Frédéric Brouard, alias SQLpro, ARCHITECTE DE DONNÉES<br />
Expert &nbsp;S.G.B.D &nbsp;relationnelles &nbsp; et &nbsp; langage &nbsp;S.Q.L<br />
Moste &nbsp;Valuable &nbsp;Professionnal &nbsp;Microsoft &nbsp;SQL Server<br />
Société SQLspot &nbsp;: &nbsp;modélisation, conseil, formation,<br />
optimisation, &nbsp;audit, &nbsp;tuning, &nbsp;administration &nbsp;SGBDR<br />
Enseignant: CNAM PACA, ISEN Toulon, CESI Aix en Prov.</div></div>
<p>L&rsquo;entreprise <a href="http://www.sqlspot.com">SQL Spot</a><br />
<strong>Le site web sur le </strong><a href="http://sqlpro.developpez.com/">SQL et les SGBDR</a></p>
<p><img src="http://blog.developpez.com/media/Microsoft_MVP_logo_vertical Brouard 400.jpg" width="400" height="135" alt="MVP Microsoft SQL
Server" /></p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Partitionnement : savoir ou sont stockées mes lignes</title>
		<link>https://blog.developpez.com/sqlpro/p12883/ms-sql-server/sql-server-2005/partitionnement-savoir-ou-sont-stockees-mes-lignes</link>
		<comments>https://blog.developpez.com/sqlpro/p12883/ms-sql-server/sql-server-2005/partitionnement-savoir-ou-sont-stockees-mes-lignes#comments</comments>
		<pubDate>Tue, 30 Jun 2015 16:32:28 +0000</pubDate>
		<dc:creator><![CDATA[SQLpro]]></dc:creator>
				<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server 2012]]></category>
		<category><![CDATA[SQL Server 2014]]></category>
		<category><![CDATA[partition]]></category>
		<category><![CDATA[partitionnement]]></category>
		<category><![CDATA[SQL server]]></category>

		<guid isPermaLink="false">http://blog.developpez.com/sqlpro/?p=569</guid>
		<description><![CDATA[Voici une requête permettant de savoir pour chaque ligne d&#8217;une table partitionnée ou elle se situe. La requête suppose que : &#8211; la table partitionnée est de nom &#171;&#160;S_CHB.T_FACTURE_FAC&#160;&#187; &#8211; la colonne de partitionnement est FAC_DATE &#8211; la fonction de partitionnement est PF_DATE_FACTURE WITH T AS &#40; SELECT *, $PARTITION.PF_DATE_FACTURE&#40;FAC_DATE&#41; AS &#34;PARTITION&#34; FROM &#160; S_CHB.T_FACTURE_FAC [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Voici une requête permettant de savoir pour chaque ligne d&rsquo;une table partitionnée ou elle se situe.<br />
<span id="more-569"></span></p>
<p>La requête suppose que :<br />
&#8211; la table partitionnée est de nom &laquo;&nbsp;S_CHB.T_FACTURE_FAC&nbsp;&raquo;<br />
&#8211; la colonne de partitionnement est FAC_DATE<br />
&#8211; la fonction de partitionnement est PF_DATE_FACTURE</p>
<div class="codecolorer-container sql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold;">WITH</span> T <span style="color: #993333; font-weight: bold;">AS</span><br />
<span style="color: #66cc66;">&#40;</span><br />
<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*,</span> $PARTITION<span style="color: #66cc66;">.</span>PF_DATE_FACTURE<span style="color: #66cc66;">&#40;</span>FAC_DATE<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;PARTITION&quot;</span><br />
<span style="color: #993333; font-weight: bold;">FROM</span> &nbsp; S_CHB<span style="color: #66cc66;">.</span>T_FACTURE_FAC <span style="color: #993333; font-weight: bold;">AS</span> f<br />
<span style="color: #66cc66;">&#41;</span><br />
<span style="color: #993333; font-weight: bold;">SELECT</span> T<span style="color: #66cc66;">.*,</span> fs<span style="color: #66cc66;">.</span>name <span style="color: #993333; font-weight: bold;">AS</span> FILEGROUP_NAME<span style="color: #66cc66;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f<span style="color: #66cc66;">.</span>name <span style="color: #993333; font-weight: bold;">AS</span> FILE_NAME<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f<span style="color: #66cc66;">.</span>physical_name<br />
<span style="color: #993333; font-weight: bold;">FROM</span> &nbsp; T<br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">JOIN</span> sys<span style="color: #66cc66;">.</span>partitions <span style="color: #993333; font-weight: bold;">AS</span> p<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ON</span> &nbsp; p<span style="color: #66cc66;">.</span>object_id <span style="color: #66cc66;">=</span> OBJECT_ID<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'S_CHB.T_FACTURE_FAC'</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">AND</span> &nbsp;T<span style="color: #66cc66;">.</span><span style="color: #ff0000;">&quot;PARTITION&quot;</span> <span style="color: #66cc66;">=</span> p<span style="color: #66cc66;">.</span>partition_number <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">AND</span> &nbsp;index_id <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">JOIN</span> sys<span style="color: #66cc66;">.</span>allocation_units <span style="color: #993333; font-weight: bold;">AS</span> au<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ON</span> p<span style="color: #66cc66;">.</span>hobt_id <span style="color: #66cc66;">=</span> au<span style="color: #66cc66;">.</span>container_id<br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">JOIN</span> sys<span style="color: #66cc66;">.</span>filegroups <span style="color: #993333; font-weight: bold;">AS</span> fs<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ON</span> au<span style="color: #66cc66;">.</span>data_space_id <span style="color: #66cc66;">=</span> fs<span style="color: #66cc66;">.</span>data_space_id<br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">JOIN</span> sys<span style="color: #66cc66;">.</span>database_files <span style="color: #993333; font-weight: bold;">AS</span> f<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ON</span> fs<span style="color: #66cc66;">.</span>data_space_id <span style="color: #66cc66;">=</span> f<span style="color: #66cc66;">.</span>file_id;</div></div>
<p>La mise en place du partitionnement pour cette table a été la suivante :</p>
<div class="codecolorer-container sql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">-- création de la fonction de partitionnement :</span><br />
<span style="color: #993333; font-weight: bold;">CREATE</span> PARTITION <span style="color: #993333; font-weight: bold;">FUNCTION</span> PF_DATE_FACTURE <span style="color: #66cc66;">&#40;</span>datetime<span style="color: #66cc66;">&#41;</span><br />
<span style="color: #993333; font-weight: bold;">AS</span> RANGE <span style="color: #993333; font-weight: bold;">RIGHT</span><br />
<span style="color: #993333; font-weight: bold;">FOR</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'20070101'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'20080101'</span><span style="color: #66cc66;">&#41;</span>; <br />
<br />
<span style="color: #808080; font-style: italic;">-- création des espace de stockage pour les différentes partitions</span><br />
<span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">DATABASE</span> <span style="color: #66cc66;">&#91;</span>DB_GRAND_HOTEL<span style="color: #66cc66;">&#93;</span><br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">ADD</span> FILEGROUP FG_PART_OLD;<br />
<br />
<span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">DATABASE</span> <span style="color: #66cc66;">&#91;</span>DB_GRAND_HOTEL<span style="color: #66cc66;">&#93;</span><br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">ADD</span> FILEGROUP FG_PART_2007;<br />
<br />
<span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">DATABASE</span> <span style="color: #66cc66;">&#91;</span>DB_GRAND_HOTEL<span style="color: #66cc66;">&#93;</span><br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">ADD</span> FILEGROUP FG_PART_2008;<br />
<br />
<span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">DATABASE</span> <span style="color: #66cc66;">&#91;</span>DB_GRAND_HOTEL<span style="color: #66cc66;">&#93;</span><br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">ADD</span> FILE<br />
&nbsp; &nbsp;<span style="color: #66cc66;">&#40;</span>NAME <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'F_PART_OLD'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; FILENAME <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'C:<span style="color: #000099; font-weight: bold;">\t</span>emp<span style="color: #000099; font-weight: bold;">\F</span>_PART_OLD.ndf'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">SIZE</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">250</span> MB<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; FILEGROWTH <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">50</span> MB<br />
&nbsp; &nbsp;<span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">TO</span> FILEGROUP FG_PART_OLD;<br />
<span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">DATABASE</span> <span style="color: #66cc66;">&#91;</span>DB_GRAND_HOTEL<span style="color: #66cc66;">&#93;</span><br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">ADD</span> FILE<br />
&nbsp; &nbsp;<span style="color: #66cc66;">&#40;</span>NAME <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'F_PART_2007'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; FILENAME <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'C:<span style="color: #000099; font-weight: bold;">\t</span>emp<span style="color: #000099; font-weight: bold;">\F</span>_PART_2007.ndf'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">SIZE</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">250</span> MB<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; FILEGROWTH <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">50</span> MB<br />
&nbsp; &nbsp;<span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">TO</span> FILEGROUP FG_PART_2007;<br />
<br />
<span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">DATABASE</span> <span style="color: #66cc66;">&#91;</span>DB_GRAND_HOTEL<span style="color: #66cc66;">&#93;</span><br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">ADD</span> FILE<br />
&nbsp; &nbsp;<span style="color: #66cc66;">&#40;</span>NAME <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'F_PART_2008'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; FILENAME <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'C:<span style="color: #000099; font-weight: bold;">\t</span>emp<span style="color: #000099; font-weight: bold;">\F</span>_PART_2008.ndf'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">SIZE</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">250</span> MB<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; FILEGROWTH <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">50</span> MB<br />
&nbsp; &nbsp;<span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">TO</span> FILEGROUP FG_PART_2008;<br />
<br />
<span style="color: #808080; font-style: italic;">-- création du schéma de ventilation des partitions</span><br />
<span style="color: #993333; font-weight: bold;">CREATE</span> PARTITION SCHEME PS_DATE_FACTURE<br />
<span style="color: #993333; font-weight: bold;">AS</span> PARTITION PF_DATE_FACTURE<br />
<span style="color: #993333; font-weight: bold;">TO</span> <span style="color: #66cc66;">&#40;</span>FG_PART_OLD<span style="color: #66cc66;">,</span> FG_PART_2007<span style="color: #66cc66;">,</span> FG_PART_2008<span style="color: #66cc66;">&#41;</span>;</div></div>
<p>Création de la table partitionnée :</p>
<div class="codecolorer-container sql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> S_CHB<span style="color: #66cc66;">.</span>T_FACTURE_FAC<br />
<span style="color: #66cc66;">&#40;</span><br />
&nbsp; &nbsp; FAC_ID <span style="color: #993333; font-weight: bold;">INT</span> <span style="color: #993333; font-weight: bold;">IDENTITY</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; PMT_ID <span style="color: #993333; font-weight: bold;">INT</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; PRS_ID <span style="color: #993333; font-weight: bold;">INT</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; FAC_DATE DATETIME <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; FAC_REMISE_GLOBALE <span style="color: #993333; font-weight: bold;">FLOAT</span> <span style="color: #993333; font-weight: bold;">NULL</span><br />
<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">ON</span> PS_DATE_FACTURE<span style="color: #66cc66;">&#40;</span>FAC_DATE<span style="color: #66cc66;">&#41;</span><br />
<span style="color: #993333; font-weight: bold;">GO</span><br />
<br />
<span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> S_CHB<span style="color: #66cc66;">.</span>T_FACTURE_FAC<br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">ADD</span> <span style="color: #993333; font-weight: bold;">CONSTRAINT</span> PK_FAC <br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span> NONCLUSTERED <span style="color: #66cc66;">&#40;</span>FAC_ID<span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">ON</span> GF_INDX;<br />
<span style="color: #993333; font-weight: bold;">GO</span></div></div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Frédéric Brouard, alias SQLpro, ARCHITECTE DE DONNÉES<br />
Expert &nbsp;S.G.B.D &nbsp;relationnelles &nbsp; et &nbsp; langage &nbsp;S.Q.L<br />
Moste &nbsp;Valuable &nbsp;Professionnal &nbsp;Microsoft &nbsp;SQL Server<br />
Société SQLspot &nbsp;: &nbsp;modélisation, conseil, formation,<br />
optimisation, &nbsp;audit, &nbsp;tuning, &nbsp;administration &nbsp;SGBDR<br />
Enseignant: CNAM PACA, ISEN Toulon, CESI Aix en Prov.</div></div>
<p>L&rsquo;entreprise <a href="http://www.sqlspot.com">SQL Spot</a><br />
<strong>Le site web sur le </strong><a href="http://sqlpro.developpez.com/">SQL et les SGBDR</a></p>
<p><img src="http://blog.developpez.com/media/Microsoft_MVP_logo_vertical Brouard 400.jpg" width="400" height="135" alt="MVP Microsoft SQL
Server" /></p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Point d&#8217;entrée du stockage physique des objets dans SQL Server</title>
		<link>https://blog.developpez.com/sqlpro/p12173/ms-sql-server/point-dentree-du-stockage-physique-des-objets-dans-sql-server</link>
		<comments>https://blog.developpez.com/sqlpro/p12173/ms-sql-server/point-dentree-du-stockage-physique-des-objets-dans-sql-server#comments</comments>
		<pubDate>Mon, 12 Aug 2013 10:27:40 +0000</pubDate>
		<dc:creator><![CDATA[SQLpro]]></dc:creator>
				<category><![CDATA[MS SQL Server]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server 2012]]></category>
		<category><![CDATA[alocation]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[partition]]></category>
		<category><![CDATA[table]]></category>

		<guid isPermaLink="false">http://blog.developpez.com/sqlpro/?p=313</guid>
		<description><![CDATA[La requête suivante permet de connaître le point d&#8217;entrée de tout objets stockant des données dans MS SQL Server. Cette requête utilise une vue interne de nom sys.system_internals_allocation_units. Le résultat de cette vue propose pour chaque objet (table/index/partition) la première page stockant des données de cet objet, la page racine de l&#8217;index (pour une table [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>La requête suivante permet de connaître le point d&rsquo;entrée de tout objets stockant des données dans MS SQL Server.<br />
<span id="more-313"></span><br />
Cette requête utilise une vue interne de nom sys.system_internals_allocation_units.<br />
Le résultat de cette vue propose pour chaque objet (table/index/partition) la première page stockant des données de cet objet, la page racine de l&rsquo;index (pour une table en HEAP, ces deux pages sont identiques) et la première page IAM (Index Allocation Map) indiquant les extensions utilisés par cet objet dans les 64 000 premières extensions du fichier (soit 4 Go).</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">SELECT s.name AS TABLE_SCHEMA, o.name AS TABLE_NAME, <br />
&nbsp; &nbsp; &nbsp; &nbsp;i.name AS INDEX_NAME,<br />
&nbsp; &nbsp; &nbsp; &nbsp;o.object_id, i.index_id,<br />
&nbsp; &nbsp; &nbsp; &nbsp;p.partition_number,<br />
&nbsp; &nbsp; &nbsp; &nbsp;iau.allocation_unit_id,<br />
&nbsp; &nbsp; &nbsp; &nbsp;i.type_desc AS TYPE_INDEX,<br />
&nbsp; &nbsp; &nbsp; &nbsp;iau.type_desc AS TYPE_ALLOCATION,<br />
&nbsp; &nbsp; &nbsp; &nbsp;CAST(CAST(SUBSTRING (iau.first_page, 6, 1) +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SUBSTRING (iau.first_page, 5, 1) AS INT) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AS VARCHAR(6)) + ':' + <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CAST(CAST(SUBSTRING (iau.first_page, 4, 1) +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SUBSTRING (iau.first_page, 3, 1) +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SUBSTRING (iau.first_page, 2, 1) +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SUBSTRING (iau.first_page, 1, 1) AS INT) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AS VARCHAR (20)) AS PAGE_1,<br />
&nbsp; &nbsp; &nbsp; &nbsp;CAST(CAST(SUBSTRING (iau.root_page, 6, 1) +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SUBSTRING (iau.root_page, 5, 1) AS INT) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AS VARCHAR(6)) + ':' + <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CAST(CAST(SUBSTRING (iau.root_page, 4, 1) +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SUBSTRING (iau.root_page, 3, 1) +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SUBSTRING (iau.root_page, 2, 1) +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SUBSTRING (iau.root_page, 1, 1) AS INT) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AS VARCHAR (20)) &nbsp;AS PAGE_RACINE,<br />
&nbsp; &nbsp; &nbsp; &nbsp;CAST(CAST(SUBSTRING (iau.first_iam_page, 6, 1) +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SUBSTRING (iau.first_iam_page, 5, 1) AS INT) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AS VARCHAR(6)) + ':' + <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CAST(CAST(SUBSTRING (iau.first_iam_page, 4, 1) +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SUBSTRING (iau.first_iam_page, 3, 1) +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SUBSTRING (iau.first_iam_page, 2, 1) +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SUBSTRING (iau.first_iam_page, 1, 1) AS INT) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AS VARCHAR (20)) AS PAGE_IAM_1<br />
FROM &nbsp; sys.objects AS o<br />
&nbsp; &nbsp; &nbsp; &nbsp;INNER JOIN sys.schemas AS s<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ON o.schema_id = s.schema_id<br />
&nbsp; &nbsp; &nbsp; &nbsp;INNER JOIN sys.indexes AS i<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ON o.object_id = i.object_id &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp;INNER JOIN sys.partitions AS p<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ON i.object_id = p.object_id<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;AND i.index_id = p.index_id &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp;INNER JOIN sys.system_internals_allocation_units AS iau<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ON p.partition_id = iau.container_id;</div></div>
<p><strong>Résultat :</strong></p>
<div id="attachment_315" style="width: 1430px" class="wp-caption alignnone"><a href="http://blog.developpez.com/sqlpro/files/2013/08/IAM_root_SQL_server.png"><img src="http://blog.developpez.com/sqlpro/files/2013/08/IAM_root_SQL_server.png" alt="Résultat présentant les pages racine, d&#039;entrée et IAM (Index Allocation Map) des tables et index de SQL Server" width="1420" height="348" class="size-full wp-image-315" /></a><p class="wp-caption-text">Résultat présentant les pages racine, d&rsquo;entrée et IAM (Index Allocation Map) des tables et index de SQL Server</p></div>
<p><strong>Le site web sur le </strong><a href="http://sqlpro.developpez.com/">SQL et les SGBDR</a><br />
<img src="http://blog.developpez.com/media/Microsoft_MVP_logo_vertical Brouard 400.jpg" width="400" height="135" alt="MVP Microsoft SQL Server" /></p>
<pre>

<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Frédéric Brouard, alias SQLpro, ARCHITECTE DE DONNÉES<br />
Expert &nbsp;S.G.B.D &nbsp;relationnelles &nbsp; et &nbsp; langage &nbsp;S.Q.L<br />
Moste &nbsp;Valuable &nbsp;Professionnal &nbsp;Microsoft &nbsp;SQL Server<br />
Société SQLspot &nbsp;: &nbsp;modélisation, conseil, formation,<br />
optimisation, &nbsp;audit, &nbsp;tuning, &nbsp;administration &nbsp;SGBDR<br />
Enseignant: CNAM PACA, ISEN Toulon, CESI Aix en Prov.</div></div>

</pre>
<p>L&rsquo;ntreprise <a href="http://www.sqlspot.com">SQL Spot</a></p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
