<?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>improve performance of database queries in asp.net Archives - Pritam&#039;s Blog</title>
	<atom:link href="https://www.pritambaldota.com/tag/improve-performance-of-database-queries-in-asp-net/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.pritambaldota.com/tag/improve-performance-of-database-queries-in-asp-net/</link>
	<description>cloud technology, enterprise architecture</description>
	<lastBuildDate>Thu, 09 Jan 2020 07:21:53 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8</generator>
	<item>
		<title>Optimizing SQL Server Database Design Tips &#038; Tricks</title>
		<link>https://www.pritambaldota.com/database-design-tips-tricks-part-1/</link>
					<comments>https://www.pritambaldota.com/database-design-tips-tricks-part-1/#respond</comments>
		
		<dc:creator><![CDATA[Pritam Baldota]]></dc:creator>
		<pubDate>Mon, 08 Jun 2009 02:47:39 +0000</pubDate>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[asp.net database performance]]></category>
		<category><![CDATA[database tunning]]></category>
		<category><![CDATA[improve performance of database queries in asp.net]]></category>
		<category><![CDATA[sql server tunning]]></category>
		<guid isPermaLink="false">http://www.pritambaldota.com/?p=13</guid>

					<description><![CDATA[<p>Database design is most crucial part in application development. Database can be anything SQL Server, MySQL, Oracle, etc. I will consider SQL SERVER as a&#8230;</p>
<p>The post <a href="https://www.pritambaldota.com/database-design-tips-tricks-part-1/">Optimizing SQL Server Database Design Tips &#038; Tricks</a> appeared first on <a href="https://www.pritambaldota.com">Pritam&#039;s Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Database design is most crucial part in application development. Database can be anything SQL Server, MySQL, Oracle, etc. I will consider SQL SERVER as a part of discussion.</p>
<p>Tunning the database depends upon various factors like whether one datatype is better depends on the context of it&#8217;s usage. Following are most common datatypes used in database.</p>
<p><strong><span style="text-decoration: underline;"><span class="Apple-style-span" style="font-size: small;">Numbers Datatype (For storing Primary Keys, Foreign Keys, Status etc)</span></span></strong><span class="Apple-style-span" style="font-size: small;">Â </span></p>
<p>An int requires 4 times the storage of a tinyint. More storage means more data and</p>
<p>index pages to read / write, more I/O and thus potentially more seek time. It also means more memory consumption.</p>
<p>For eg. Desigining User Role and Users Table. Generally application will not have more than 5-10 user roles like Admin, Manager, Employee, etc. Most of developers design the table like -Â </p>
<p><strong>Table &#8211; UserRole</strong></p>
<p><strong>RoleId</strong> â€“ Integer (whole number) data from â€“2^31 (â€“2,147,483,648) through 2^31â€“1 (2,147,483,647). It takes 4 Bytes to store.</p>
<p><strong>RoleName</strong> â€“ Varchar (50)</p>
<p>Which is not suiting to our requirements. Instead of int we can use tinyint &#8211; Integer data from 0 to 255. Storage size is 1 byte.Â </p>
<p>&nbsp;</p>
<p><strong><span style="text-decoration: underline;"><span class="Apple-style-span" style="font-size: small;">DateTime Datatype (For storing dates)</span></span></strong></p>
<p>Most of the times database tables required date to be stored to maintain record creation date.Â </p>
<p><strong>DateTime</strong> data type are stored internally two 4-byte integers. The first 4 bytes store the number of days before or after the base date: January 1, 1900. The base date is the system reference date. The other 4 bytes store the time of day represented as the number of milliseconds after midnight.</p>
<p>The <strong>smalldatetime</strong> data type stores dates and times of day with less precision than datetime. The Database Engine stores smalldatetime values as two 2-byte integers. The first 2 bytes store the number of days after January 1, 1900. The other 2 bytes store the number of minutes since midnight.</p>
<p>So, instead of using datetime as datatype smalldatetime is more efficient in general development.</p>
<p>&nbsp;</p>
<p><strong>STRING DATATYPE (Storing text data)</strong></p>
<p>All string data stored inside varchar, text, ntext, nvarchar, etc.Â </p>
<p>For eg. FirstName data field developers used varchar or nvarchar with default size i.e. 50. We should know the scope of the filed in terms of maximum characters. Generally first name, last name etc.. won&#8217;t take more than 20 â€“ 25 characters. So instead of 50 if we use 20 characters we can save half the storage, index size which will increase performance of queries.Â </p>
<p>Â These are the basics which needs to keep in mind while developing applications.Â </p>
<p>Happy Coding &#8230; <img src="https://s.w.org/images/core/emoji/15.1.0/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>The post <a href="https://www.pritambaldota.com/database-design-tips-tricks-part-1/">Optimizing SQL Server Database Design Tips &#038; Tricks</a> appeared first on <a href="https://www.pritambaldota.com">Pritam&#039;s Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.pritambaldota.com/database-design-tips-tricks-part-1/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
