<?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; écriture</title>
	<atom:link href="https://blog.developpez.com/sqlpro/ptag/ecriture/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>Estimation des IO (ES) en lecture et écriture table par table d&#8217;une base SQL</title>
		<link>https://blog.developpez.com/sqlpro/p13175/ms-sql-server/estimation-des-io-es-en-lecture-et-ecriture-table-par-table-dune-base-sql</link>
		<comments>https://blog.developpez.com/sqlpro/p13175/ms-sql-server/estimation-des-io-es-en-lecture-et-ecriture-table-par-table-dune-base-sql#comments</comments>
		<pubDate>Wed, 21 Feb 2018 18:07:18 +0000</pubDate>
		<dc:creator><![CDATA[SQLpro]]></dc:creator>
				<category><![CDATA[MS SQL Server]]></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[accès]]></category>
		<category><![CDATA[écriture]]></category>
		<category><![CDATA[ES]]></category>
		<category><![CDATA[IO]]></category>
		<category><![CDATA[lecture]]></category>
		<category><![CDATA[métrique]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[SQL server]]></category>
		<category><![CDATA[Statistiques]]></category>
		<category><![CDATA[table]]></category>

		<guid isPermaLink="false">http://blog.developpez.com/sqlpro/?p=791</guid>
		<description><![CDATA[Les deux requêtes que je vous présente permettent d&#8217;estimer le nombres de pages lues et écrites table par table tenant compte de tous les index des tables. Attention : il ne s&#8217;agit pas d&#8217;une mesure exacte. Une telle mesure est impossible mais bien d&#8217;une estimation pour connaître les tables les plus écrites et celles les [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Les deux requêtes que je vous présente permettent d&rsquo;estimer le nombres de pages lues et écrites table par table tenant compte de tous les index des tables. Attention : il ne s&rsquo;agit pas d&rsquo;une mesure exacte. Une telle mesure est impossible mais bien d&rsquo;une estimation pour connaître les tables les plus écrites et celles les plus lues de manières relatives les unes aux autres.<br />
<span id="more-791"></span><br />
Elle se base sur le nombre d&rsquo;opération unitaire d&rsquo;accès effectué sur chaque table et index. En gros, il y a trois types d&rsquo;accès :<br />
1) un accès par balayage de la table ou de l&rsquo;index (scan) appelé &laquo;&nbsp;analyse&nbsp;&raquo; dans les plans de requête en français;<br />
2) un accès pour recherche dichotomique dans l&rsquo;index (seek) appelé &laquo;&nbsp;recherche&nbsp;&raquo; dans les plans de requête en français;<br />
3) un accès multi recherche dans l&rsquo;index (lookup) appelé &laquo;&nbsp;recherche de clés&nbsp;&raquo; dans les plans de requête en français;</p>
<p>Nous avons compter qu&rsquo;un SCAN balayait toutes les pages de l&rsquo;index ou de la table, ce qui est faux dans certains cas particulier (par exemple recherche TOP n)<br />
Nous avons compter qu&rsquo;un SEEK parcourait un nombre de page équivalent à la profondeur de l&rsquo;arbre ce qui n&rsquo;est pas vrai pour les recherches de type &laquo;&nbsp;range&nbsp;&raquo; (par exemple lors d&rsquo;un BETWEEN)<br />
Nous avons compter qu&rsquo;un LOOKUP était l&rsquo;équivalent de 10 seeks. Mais cela peut être plus ou moins et dans certains cas, ce n&rsquo;est même pas réellement l&rsquo;équivalent d&rsquo;un seek.</p>
<p>Ces approximations nous permettent quand même une bonne évaluation de la surface d&rsquo;attaque des données des tables en production, dans un but comparatif, voir les tables les plus accédées en lecture ou en écriture.</p>
<p><strong>La requête pour les lectures :</strong></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: #993333; font-weight: bold;">WITH</span> <br />
idx_details <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> ius<span style="color: #66cc66;">.</span>object_id<span style="color: #66cc66;">,</span> ius<span style="color: #66cc66;">.</span>index_id<span style="color: #66cc66;">,</span> user_seeks<span style="color: #66cc66;">,</span> user_lookups<span style="color: #66cc66;">,</span> user_scans<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">COALESCE</span><span style="color: #66cc66;">&#40;</span>INDEXPROPERTY<span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">.</span>object_id<span style="color: #66cc66;">,</span> i<span style="color: #66cc66;">.</span>name<span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'IndexDepth '</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">AS</span> index_depth<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #993333; font-weight: bold;">SUM</span><span style="color: #66cc66;">&#40;</span>used_page_count<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> pages<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">FROM</span> &nbsp; sys<span style="color: #66cc66;">.</span>dm_db_partition_stats <span style="color: #993333; font-weight: bold;">AS</span> s<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">WHERE</span> &nbsp;s<span style="color: #66cc66;">.</span>object_id <span style="color: #66cc66;">=</span> ius<span style="color: #66cc66;">.</span>object_id <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">AND</span> &nbsp;s<span style="color: #66cc66;">.</span>index_id &nbsp;<span style="color: #66cc66;">=</span> ius<span style="color: #66cc66;">.</span>index_id<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> page_count<br />
<span style="color: #993333; font-weight: bold;">FROM</span> &nbsp; sys<span style="color: #66cc66;">.</span>dm_db_index_usage_stats <span style="color: #993333; font-weight: bold;">AS</span> ius<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; <span style="color: #993333; font-weight: bold;">ON</span> &nbsp;ius<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; <span style="color: #993333; font-weight: bold;">AND</span> ius<span style="color: #66cc66;">.</span>index_id &nbsp;<span style="color: #66cc66;">=</span> i<span style="color: #66cc66;">.</span>index_id<br />
<span style="color: #993333; font-weight: bold;">WHERE</span> &nbsp;database_id <span style="color: #66cc66;">=</span> DB_ID<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
<span style="color: #993333; font-weight: bold;">AND</span> &nbsp; &nbsp;ius<span style="color: #66cc66;">.</span>index_id &nbsp;<span style="color: #cc66cc;">0</span> <span style="color: #993333; font-weight: bold;">OR</span> user_lookups <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333; font-weight: bold;">OR</span> user_scans <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> &nbsp;<br />
<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><br />
TOPT <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> 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> <br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">SUM</span><span style="color: #66cc66;">&#40;</span>user_seeks <span style="color: #66cc66;">+</span> <span style="color: #cc66cc;">10</span> <span style="color: #66cc66;">*</span> user_lookups <span style="color: #66cc66;">*</span> index_depth<span style="color: #66cc66;">&#41;</span> <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>user_scans <span style="color: #66cc66;">*</span> page_count<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> IO_READS_ESTIMATE<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #cc66cc;">100.0</span> <span style="color: #66cc66;">*</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SUM</span><span style="color: #66cc66;">&#40;</span>user_seeks <span style="color: #66cc66;">+</span> <span style="color: #cc66cc;">10</span> <span style="color: #66cc66;">*</span> user_lookups <span style="color: #66cc66;">*</span> index_depth<span style="color: #66cc66;">&#41;</span> <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>user_scans <span style="color: #66cc66;">*</span> page_count<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <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><span style="color: #993333; font-weight: bold;">NULLIF</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SUM</span><span style="color: #66cc66;">&#40;</span>user_seeks <span style="color: #66cc66;">+</span> <span style="color: #cc66cc;">10</span> <span style="color: #66cc66;">*</span> user_lookups <span style="color: #66cc66;">*</span> index_depth<span style="color: #66cc66;">&#41;</span> <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>user_scans <span style="color: #66cc66;">*</span> page_count<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">OVER</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> &nbsp;<span style="color: #993333; font-weight: bold;">AS</span> PERCENT_READS_ESTIMATE<br />
<span style="color: #993333; font-weight: bold;">FROM</span> &nbsp; idx_details <span style="color: #993333; font-weight: bold;">AS</span> 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> id<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> s<span style="color: #66cc66;">.</span>schema_id <span style="color: #66cc66;">=</span> o<span style="color: #66cc66;">.</span>schema_id<br />
<span style="color: #993333; font-weight: bold;">GROUP</span> &nbsp;<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<br />
<span style="color: #993333; font-weight: bold;">HAVING</span> <span style="color: #993333; font-weight: bold;">SUM</span><span style="color: #66cc66;">&#40;</span>user_seeks <span style="color: #66cc66;">+</span> <span style="color: #cc66cc;">10</span> <span style="color: #66cc66;">*</span> user_lookups <span style="color: #66cc66;">*</span> index_depth<span style="color: #66cc66;">&#41;</span> <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>user_scans <span style="color: #66cc66;">*</span> page_count<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">0</span><br />
<span style="color: #66cc66;">&#41;</span><br />
<span style="color: #993333; font-weight: bold;">SELECT</span> TABLE_SCHEMA<span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">TABLE_NAME</span><span style="color: #66cc66;">,</span> IO_READS_ESTIMATE<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">CAST</span><span style="color: #66cc66;">&#40;</span>PERCENT_READS_ESTIMATE <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #993333; font-weight: bold;">DECIMAL</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> PERCENT_READS_ESTIMATE<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">CAST</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SUM</span><span style="color: #66cc66;">&#40;</span>PERCENT_READS_ESTIMATE<span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">OVER</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> PERCENT_READS_ESTIMATE <span style="color: #993333; font-weight: bold;">DESC</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #993333; font-weight: bold;">DECIMAL</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">AS</span> CUMUL_PERCENT<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">CAST</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> sqlserver_start_time <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">FROM</span> &nbsp; sys<span style="color: #66cc66;">.</span>dm_os_sys_info<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> datetime2<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> SINCE<br />
<span style="color: #993333; font-weight: bold;">FROM</span> &nbsp; TOPT<br />
<span style="color: #993333; font-weight: bold;">ORDER</span> &nbsp;<span style="color: #993333; font-weight: bold;">BY</span> IO_READS_ESTIMATE <span style="color: #993333; font-weight: bold;">DESC</span>;</div></div>
<p><strong>La requête pour les écritures :</strong></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: #993333; font-weight: bold;">WITH</span> <br />
idx_details <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> ius<span style="color: #66cc66;">.</span>object_id<span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">SUM</span><span style="color: #66cc66;">&#40;</span>user_updates <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> user_updates<br />
<span style="color: #993333; font-weight: bold;">FROM</span> &nbsp; sys<span style="color: #66cc66;">.</span>dm_db_index_usage_stats <span style="color: #993333; font-weight: bold;">AS</span> ius<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; <span style="color: #993333; font-weight: bold;">ON</span> ius<span style="color: #66cc66;">.</span>object_id <span style="color: #66cc66;">=</span> i<span style="color: #66cc66;">.</span>object_id <span style="color: #993333; font-weight: bold;">AND</span> ius<span style="color: #66cc66;">.</span>index_id <span style="color: #66cc66;">=</span> i<span style="color: #66cc66;">.</span>index_id<br />
<span style="color: #993333; font-weight: bold;">WHERE</span> &nbsp;database_id <span style="color: #66cc66;">=</span> DB_ID<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
<span style="color: #993333; font-weight: bold;">AND</span> &nbsp; &nbsp;ius<span style="color: #66cc66;">.</span>index_id &nbsp;<span style="color: #cc66cc;">0</span> <br />
<span style="color: #993333; font-weight: bold;">GROUP</span> &nbsp;<span style="color: #993333; font-weight: bold;">BY</span> ius<span style="color: #66cc66;">.</span>object_id<br />
<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><br />
TOPT <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> 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> <br />
&nbsp; &nbsp; &nbsp; &nbsp;user_updates <span style="color: #993333; font-weight: bold;">AS</span> IO_WRITES_ESTIMATE<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #cc66cc;">100.0</span> <span style="color: #66cc66;">*</span> user_updates <span style="color: #66cc66;">/</span> <span style="color: #993333; font-weight: bold;">SUM</span><span style="color: #66cc66;">&#40;</span>user_updates<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">OVER</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">AS</span> PERCENT_WRITES_ESTIMATE<br />
<span style="color: #993333; font-weight: bold;">FROM</span> &nbsp; idx_details <span style="color: #993333; font-weight: bold;">AS</span> 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> id<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> s<span style="color: #66cc66;">.</span>schema_id <span style="color: #66cc66;">=</span> o<span style="color: #66cc66;">.</span>schema_id<br />
<span style="color: #993333; font-weight: bold;">GROUP</span> &nbsp;<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;">,</span> user_updates<br />
<span style="color: #66cc66;">&#41;</span><br />
<span style="color: #993333; font-weight: bold;">SELECT</span> TABLE_SCHEMA<span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">TABLE_NAME</span><span style="color: #66cc66;">,</span> IO_WRITES_ESTIMATE<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">CAST</span><span style="color: #66cc66;">&#40;</span>PERCENT_WRITES_ESTIMATE <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #993333; font-weight: bold;">DECIMAL</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">AS</span> PERCENT_WRITES_ESTIMATE<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">CAST</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SUM</span><span style="color: #66cc66;">&#40;</span>PERCENT_WRITES_ESTIMATE<span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">OVER</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> PERCENT_WRITES_ESTIMATE <span style="color: #993333; font-weight: bold;">DESC</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #993333; font-weight: bold;">DECIMAL</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">AS</span> CUMUL_PERCENT<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">CAST</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> sqlserver_start_time <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">FROM</span> &nbsp; sys<span style="color: #66cc66;">.</span>dm_os_sys_info<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> datetime2<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> SINCE<br />
<span style="color: #993333; font-weight: bold;">FROM</span> &nbsp; TOPT<br />
<span style="color: #993333; font-weight: bold;">ORDER</span> &nbsp;<span style="color: #993333; font-weight: bold;">BY</span> PERCENT_WRITES_ESTIMATE <span style="color: #993333; font-weight: bold;">DESC</span>;</div></div>
<p><em>Un exemple de résultat pour la lecture :</em></p>
<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">TABLE_SCHEMA &nbsp; TABLE_NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IO_READS_ESTIMATE &nbsp; &nbsp;PERCENT_READS_ESTIMATE &nbsp;CUMUL_PERCENT &nbsp; SINCE<br />
-------------- --------------------------- -------------------- ----------------------- --------------- ---------------------------<br />
S_GEO &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;COMMUNE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 748792 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 55.59 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 55.59 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2018-01-16 16:17:28<br />
S_RTE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TRONCON_ROUTE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 520044 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 38.61 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 94.19 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2018-01-16 16:17:28<br />
S_ADR &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CODE_INSEE_CODE_POSTAL &nbsp; &nbsp; &nbsp;42147 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3.13 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;97.32 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2018-01-16 16:17:28<br />
S_GEO &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DEPARTEMENT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 36057 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2.68 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100.00 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2018-01-16 16:17:28</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>
	</channel>
</rss>
