<?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>Logical reads &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/logical-reads/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>Mon, 03 Jul 2017 13:50:53 +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: Performance Test &#8211; Problem of mismatched Column Data Type</title>
		<link>https://www.dbrnd.com/2017/07/sql-server-performance-test-problem-of-mismatched-column-data-type/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 16 Jul 2017 16:16:08 +0000</pubDate>
				<category><![CDATA[Database Designing]]></category>
		<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[Logical reads]]></category>
		<category><![CDATA[Physical Reads]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Error]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tuning]]></category>
		<category><![CDATA[SQL Server Programming]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[Statistics]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=5623</guid>

					<description><![CDATA[In this post, I am sharing performance test of the problem of mismatched column data type in SQL Server. The Database Designer is also defining a wrong mismatched column data type by giving different data types to the same column for many tables. For example, empid column -> assigned INT in tbl_emp table and -> [&#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%2F2017%2F07%2Fsql-server-performance-test-problem-of-mismatched-column-data-type%2F&amp;linkname=SQL%20Server%3A%20Performance%20Test%20%E2%80%93%20Problem%20of%20mismatched%20Column%20Data%20Type" 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%2F2017%2F07%2Fsql-server-performance-test-problem-of-mismatched-column-data-type%2F&amp;linkname=SQL%20Server%3A%20Performance%20Test%20%E2%80%93%20Problem%20of%20mismatched%20Column%20Data%20Type" 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%2F2017%2F07%2Fsql-server-performance-test-problem-of-mismatched-column-data-type%2F&amp;linkname=SQL%20Server%3A%20Performance%20Test%20%E2%80%93%20Problem%20of%20mismatched%20Column%20Data%20Type" 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%2F2017%2F07%2Fsql-server-performance-test-problem-of-mismatched-column-data-type%2F&amp;linkname=SQL%20Server%3A%20Performance%20Test%20%E2%80%93%20Problem%20of%20mismatched%20Column%20Data%20Type" 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%2F2017%2F07%2Fsql-server-performance-test-problem-of-mismatched-column-data-type%2F&amp;linkname=SQL%20Server%3A%20Performance%20Test%20%E2%80%93%20Problem%20of%20mismatched%20Column%20Data%20Type" 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%2F2017%2F07%2Fsql-server-performance-test-problem-of-mismatched-column-data-type%2F&amp;linkname=SQL%20Server%3A%20Performance%20Test%20%E2%80%93%20Problem%20of%20mismatched%20Column%20Data%20Type" 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%2F2017%2F07%2Fsql-server-performance-test-problem-of-mismatched-column-data-type%2F&#038;title=SQL%20Server%3A%20Performance%20Test%20%E2%80%93%20Problem%20of%20mismatched%20Column%20Data%20Type" data-a2a-url="https://www.dbrnd.com/2017/07/sql-server-performance-test-problem-of-mismatched-column-data-type/" data-a2a-title="SQL Server: Performance Test – Problem of mismatched Column Data Type"></a></p><p>In this post, I am sharing performance test of the problem of mismatched column data type in SQL Server. </p>
<p>The Database Designer is also defining a wrong mismatched column data type by giving different data types to the same column for many tables. </p>
<blockquote><p>For example, empid column -> assigned INT in tbl_emp table and -> assigned BIGINT in tbl_dept table. Because of this kind of problem, your query will execute slowly, and it requires implicit data conversion for each record. </p></blockquote>
<blockquote><p>Another example is, your column data type is VARCHAR, and you are checking N&#8217;DATA in WHERE clause which is NVARCHAR, so this is also required implicit data conversion. </p></blockquote>
<p><strong>Please check below full demonstration and, test it yourself:</strong></p>
<p><strong>Create a sample table, where [id] column type is varchar:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_DiffDataTypes 
(	id varchar(25)
	,name VARCHAR(25)
	,constraint pk_tbl_DiffDataTypes_id primary key (id)
)
GO</pre> </p>
<p><strong>Insert few dummy records:</strong></p>
<pre class="crayon-plain-tag">DECLARE @i INT,@max INT
SET @i =1 
SET @max =99999
WHILE @i&lt;=@max
BEGIN
   INSERT INTO tbl_DiffDataTypes VALUES(@i,'dbrnd.com')
   SET @i=@i+1
END</pre> </p>
<p><strong>Please enable STATISTICS:</strong></p>
<pre class="crayon-plain-tag">SET STATISTICS IO ON
SET STATISTICS TIME ON</pre> </p>
<p><strong>Test WHERE filter with VARCHAR value: (Only 3 logical reads)</strong></p>
<pre class="crayon-plain-tag">SELECT * FROM tbl_DiffDataTypes WHERE id = '1'</pre> </p>
<p><strong>Result of Statistics:</strong></p>
<pre class="crayon-plain-tag">Table 'tbl_DiffDataTypes'. Scan count 0, logical reads 3, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.</pre> </p>
<p><strong>Test WHERE filter with NVARCHAR value: (62 logical reads)</strong></p>
<pre class="crayon-plain-tag">SELECT * FROM tbl_DiffDataTypes WHERE id = N'1'</pre> </p>
<p><strong>Result of Statistics:</strong></p>
<pre class="crayon-plain-tag">Table 'tbl_DiffDataTypes'. Scan count 1, logical reads 62, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.</pre> </p>
<p><strong>Test WHERE filter with INTEGER value: (621 logical reads)</strong></p>
<pre class="crayon-plain-tag">SELECT * FROM tbl_DiffDataTypes WHERE id = 1</pre> </p>
<p><strong>Result of Statistics:</strong></p>
<pre class="crayon-plain-tag">Table 'tbl_DiffDataTypes'. Scan count 1, logical reads 621, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.</pre> </p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
