<?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>Storage &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/storage/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, 20 Nov 2017 06:00:40 +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>PostgreSQL: What is TOAST (The Oversized-Attribute Storage Technique)</title>
		<link>https://www.dbrnd.com/2016/10/postgresql-what-is-toast-the-oversized-attribute-storage-technique-exceed-8-kb-data-page-size-extended-storage/</link>
					<comments>https://www.dbrnd.com/2016/10/postgresql-what-is-toast-the-oversized-attribute-storage-technique-exceed-8-kb-data-page-size-extended-storage/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 07 Oct 2016 16:16:03 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[8KB Data Page]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[encrypted storage]]></category>
		<category><![CDATA[overflow size]]></category>
		<category><![CDATA[Oversized-Attribute Storage Technique]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[Postgres Query]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[PostgreSQL Administrator]]></category>
		<category><![CDATA[PostgreSQL Error]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[Storage]]></category>
		<category><![CDATA[TOAST]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3648</guid>

					<description><![CDATA[Like SQL Server, PostgreSQL data page size is also 8KB. This post is very similar to a few of the SQL Server published articles. SQL Server: The Internal Structure of the Data Page SQL Server: What happened, when Row Overflow and Data Exceeding 8KB? PostgreSQL uses 8kb fixed size data page to store tuples of [&#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%2F10%2Fpostgresql-what-is-toast-the-oversized-attribute-storage-technique-exceed-8-kb-data-page-size-extended-storage%2F&amp;linkname=PostgreSQL%3A%20What%20is%20TOAST%20%28The%20Oversized-Attribute%20Storage%20Technique%29" 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%2F10%2Fpostgresql-what-is-toast-the-oversized-attribute-storage-technique-exceed-8-kb-data-page-size-extended-storage%2F&amp;linkname=PostgreSQL%3A%20What%20is%20TOAST%20%28The%20Oversized-Attribute%20Storage%20Technique%29" 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%2F10%2Fpostgresql-what-is-toast-the-oversized-attribute-storage-technique-exceed-8-kb-data-page-size-extended-storage%2F&amp;linkname=PostgreSQL%3A%20What%20is%20TOAST%20%28The%20Oversized-Attribute%20Storage%20Technique%29" 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%2F10%2Fpostgresql-what-is-toast-the-oversized-attribute-storage-technique-exceed-8-kb-data-page-size-extended-storage%2F&amp;linkname=PostgreSQL%3A%20What%20is%20TOAST%20%28The%20Oversized-Attribute%20Storage%20Technique%29" 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%2F10%2Fpostgresql-what-is-toast-the-oversized-attribute-storage-technique-exceed-8-kb-data-page-size-extended-storage%2F&amp;linkname=PostgreSQL%3A%20What%20is%20TOAST%20%28The%20Oversized-Attribute%20Storage%20Technique%29" 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%2F10%2Fpostgresql-what-is-toast-the-oversized-attribute-storage-technique-exceed-8-kb-data-page-size-extended-storage%2F&amp;linkname=PostgreSQL%3A%20What%20is%20TOAST%20%28The%20Oversized-Attribute%20Storage%20Technique%29" 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%2F10%2Fpostgresql-what-is-toast-the-oversized-attribute-storage-technique-exceed-8-kb-data-page-size-extended-storage%2F&#038;title=PostgreSQL%3A%20What%20is%20TOAST%20%28The%20Oversized-Attribute%20Storage%20Technique%29" data-a2a-url="https://www.dbrnd.com/2016/10/postgresql-what-is-toast-the-oversized-attribute-storage-technique-exceed-8-kb-data-page-size-extended-storage/" data-a2a-title="PostgreSQL: What is TOAST (The Oversized-Attribute Storage Technique)"></a></p><p>Like SQL Server, PostgreSQL data page size is also 8KB. </p>
<p>This post is very similar to a few of the SQL Server published articles.</p>
<blockquote class="wp-embedded-content" data-secret="rGrP0nx5zq"><p><a href="https://www.dbrnd.com/2016/04/sql-server-the-internal-structure-of-the-data-page/">SQL Server: The Internal Structure of the Data Page</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/04/sql-server-the-internal-structure-of-the-data-page/embed/#?secret=rGrP0nx5zq" data-secret="rGrP0nx5zq" width="600" height="338" title="&#8220;SQL Server: The Internal Structure of the Data Page&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote class="wp-embedded-content" data-secret="Tib7ndboIQ"><p><a href="https://www.dbrnd.com/2016/04/sql-server-what-happened-when-row-overflow-and-data-exceeding-8kb/">SQL Server: What happened, when Row Overflow and Data Exceeding 8KB?</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/04/sql-server-what-happened-when-row-overflow-and-data-exceeding-8kb/embed/#?secret=Tib7ndboIQ" data-secret="Tib7ndboIQ" width="600" height="338" title="&#8220;SQL Server: What happened, when Row Overflow and Data Exceeding 8KB?&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote><p>PostgreSQL uses 8kb fixed size data page to store tuples of Table.</p></blockquote>
<blockquote><p>It does not allow tuples to span in multiple pages because not possible to store large field value directly into the 8kb page.<br />
This is one type of limitation of PostgreSQL. </p></blockquote>
<p><strong>What is TOAST (The Oversized-Attribute Storage Technique)?</strong></p>
<blockquote><p>The TOAST is one type of Technique to store and manage oversized or overflow data pages.</p></blockquote>
<blockquote><p>This is a background process of PostgreSQL, and It also compresses the value and broken into multiple physical pages.</p></blockquote>
<blockquote><p>If row size is exceeding in the main table, It creates new a TOAST table to manage and store oversized rows. </p></blockquote>
<blockquote><p>The mechanism is accomplished by splitting up the large column entry into 2KB bytes and storing them as chunks in the TOAST tables.<br />
It then stores the length and a pointer to the TOAST entry back where the column stored. </p></blockquote>
<blockquote><p>Because of how the pointer system implemented, most TOAST table column types limited to a max size of 1GB.</p></blockquote>
<blockquote><p>The advantage of TOAST table is, whenever data require fetching from TOAST table, only It needs to refer TOAST table otherwise, It does not call unnecessary. </p></blockquote>
<p><strong>How to find whether a TOAST table is associated with your main tables?</strong></p>
<blockquote><p>You can easily select reltoastrelid from pg_class. Like any other table ObjectID is also assigned to TOAST Table.</p></blockquote>
<p><strong>You can execute below script:</strong></p>
<pre class="crayon-plain-tag">SELECT relname,reltoastrelid 
FROM pg_class 
WHERE relname='Table_Name';</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/10/postgresql-what-is-toast-the-oversized-attribute-storage-technique-exceed-8-kb-data-page-size-extended-storage/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>SQL Server: Internal Storage and Memory Architecture Interview Questions and Answers (Day-1)</title>
		<link>https://www.dbrnd.com/2016/05/sql-server-internal-storage-and-memory-architecture-interview-questions-and-answers-day-1/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Wed, 25 May 2016 18:22:10 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[page]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></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[Storage]]></category>
		<category><![CDATA[transaction]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=2881</guid>

					<description><![CDATA[Tell me something about the SQL Server Pages. In SQL Server, the page size is 8 KB. This means SQL Server databases have 128 pages per megabyte. Each page begins with a 96-byte header that is used to store system information about the page. This information includes the page number, page type, the amount of [&#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%2F05%2Fsql-server-internal-storage-and-memory-architecture-interview-questions-and-answers-day-1%2F&amp;linkname=SQL%20Server%3A%20Internal%20Storage%20and%20Memory%20Architecture%20Interview%20Questions%20and%20Answers%20%28Day-1%29" 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%2F05%2Fsql-server-internal-storage-and-memory-architecture-interview-questions-and-answers-day-1%2F&amp;linkname=SQL%20Server%3A%20Internal%20Storage%20and%20Memory%20Architecture%20Interview%20Questions%20and%20Answers%20%28Day-1%29" 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%2F05%2Fsql-server-internal-storage-and-memory-architecture-interview-questions-and-answers-day-1%2F&amp;linkname=SQL%20Server%3A%20Internal%20Storage%20and%20Memory%20Architecture%20Interview%20Questions%20and%20Answers%20%28Day-1%29" 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%2F05%2Fsql-server-internal-storage-and-memory-architecture-interview-questions-and-answers-day-1%2F&amp;linkname=SQL%20Server%3A%20Internal%20Storage%20and%20Memory%20Architecture%20Interview%20Questions%20and%20Answers%20%28Day-1%29" 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%2F05%2Fsql-server-internal-storage-and-memory-architecture-interview-questions-and-answers-day-1%2F&amp;linkname=SQL%20Server%3A%20Internal%20Storage%20and%20Memory%20Architecture%20Interview%20Questions%20and%20Answers%20%28Day-1%29" 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%2F05%2Fsql-server-internal-storage-and-memory-architecture-interview-questions-and-answers-day-1%2F&amp;linkname=SQL%20Server%3A%20Internal%20Storage%20and%20Memory%20Architecture%20Interview%20Questions%20and%20Answers%20%28Day-1%29" 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%2F05%2Fsql-server-internal-storage-and-memory-architecture-interview-questions-and-answers-day-1%2F&#038;title=SQL%20Server%3A%20Internal%20Storage%20and%20Memory%20Architecture%20Interview%20Questions%20and%20Answers%20%28Day-1%29" data-a2a-url="https://www.dbrnd.com/2016/05/sql-server-internal-storage-and-memory-architecture-interview-questions-and-answers-day-1/" data-a2a-title="SQL Server: Internal Storage and Memory Architecture Interview Questions and Answers (Day-1)"></a></p><p><strong><a href="https://www.dbrnd.com/2016/04/sql-server-the-internal-structure-of-the-data-page/" target="_blank">Tell me something about the SQL Server Pages.</a></strong></p>
<blockquote><p>In SQL Server, the page size is 8 KB. This means SQL Server databases have 128 pages per megabyte. Each page begins with a 96-byte header that is used to store system information about the page. This information includes the page number, page type, the amount of free space on the page, and the allocation unit ID of the object that owns the page.</p></blockquote>
<p><strong>What is a row offset of pages?</strong></p>
<blockquote><p>For each data row there is a 2-byte entry, saving the offset.</p>
<p>A row offset table starts at the end of the page, and each row offset table contains one entry for each row on the page.</p></blockquote>
<p><strong><a href="https://www.dbrnd.com/2016/04/sql-server-what-happened-when-row-overflow-and-data-exceeding-8kb/" target="_blank">What is the ROW_OVERFLOW_DATA allocation unit?</a></strong></p>
<blockquote><p>When the total row size of all fixed and variable columns in a table exceeds the 8,060 byte limitation, SQL Server dynamically moves one or more variable length columns to pages in the ROW_OVERFLOW_DATA allocation unit, starting with the column with the largest width.</p></blockquote>
<p><strong>What is a IN_ROW_DATA allocation unit?</strong></p>
<blockquote><p>It is an allocation unit for data page and index page.</p></blockquote>
<p><strong>What is a LOB_DATA allocation unit?</strong></p>
<blockquote><p>It is an allocation unit for text, ntext, image, xml, varchar (max), nvarchar (max), varbinary (max) data types.</p></blockquote>
<p><strong>Why 24-byte pointer is require with the ROW_OVERFLOW_DATA allocation unit?</strong></p>
<blockquote><p>When a combination of varchar, nvarchar, varbinary, sql_variant, or CLR user-defined type columns exceeds this 8KB limit, the Database Engine moves the record column with the largest width to another page in the ROW_OVERFLOW_DATA allocation unit, while maintaining a 24-byte pointer on the original page.</p></blockquote>
<p><strong>What is the size of the data page header?</strong></p>
<blockquote><p>The size of the data page header is 96-byte.</p></blockquote>
<p><strong>What are the different types of pages and what do they store?</strong></p>
<ul>
<li>Page types include</li>
<li>Data page</li>
<li>Index page</li>
<li>Text/Image page</li>
<li>Page Free Space</li>
<li>Global Allocation Map (GAM) &#8211; extent allocation information</li>
<li>Shared Global Allocation Map (SGAM) &#8211; mixed extent with at least one unused page information</li>
<li>Bulk Changed Map &#8211; extents that got changed by a bulk logged operation</li>
<li>Differential Changed Map &#8211; extents that got changed since last BACKUP DATABASE statement</li>
<li>Index allocation map</li>
</ul>
<p><strong><a href="https://www.dbrnd.com/2016/04/sql-server-understanding-the-role-of-extent/" target="_blank">What is an Extent?</a></strong></p>
<blockquote><p>Extents are the basic unit in which space is managed. An extent is eight physically contiguous pages, or 64 KB. This means SQL Server databases have 16 extents per megabyte.</p></blockquote>
<p><strong>What are the different types of Extents?</strong></p>
<ul>
<li>Uniform extents are owned by a single object; all eight pages in the extent can only be used by the owning object.</li>
<li>Mixed extents are shared by up to eight objects. Each of the eight pages in the extent can be owned by a different object.</li>
</ul>
<p><strong>What are the different types of database files in SQL Server?</strong></p>
<ul>
<li>Primary data files: The primary data file is the starting point of the database and points to the other files in the database. Every database has one primary data file. The recommended file name extension for primary data files is .mdf.</li>
<li>Secondary data files: Secondary data files make up all the data files, other than the primary data file. Some databases may not have any secondary data files, while others have several secondary data files. The recommended file name extension for secondary data files is .ndf.</li>
<li>Log files: Log files hold all the log information that is used to recover the database. There must be at least one log file for each database, although there can be more than one. The recommended file name extension for log files is .ldf.</li>
</ul>
<p><strong>Explained something about SQL Server Access Methods.</strong></p>
<ul>
<li>SQL doesn’t directly retrieve from disk, it makes requests to buffer manager which serves up the page in cache before rendering out.</li>
<li>When scan starts, SQL Server can use look-ahead mechanisms to qualify rows and index entries on a page. The retrieving of rows that meet specified criteria is known as a qualified retrieval.</li>
</ul>
<p><strong>Tell us something about the SQL Server Database Transactions.</strong></p>
<ul>
<li>Provides support for Atomicity, Consistency, Isolation and Durability.</li>
<li>Log records are always written to disk before the data pages where changes were made are actually written.</li>
<li>Writes to the transaction log are synchronous while writes to data pages can be asynchronous.</li>
</ul>
<p><strong>What is the sparse file?</strong></p>
<blockquote><p>A database snapshot that is created by a user stores its data in one or more sparse files. Sparse file technology is a feature of the NTFS file system.</p></blockquote>
<p><strong>What is the Database Filegroups?</strong></p>
<blockquote><p>Database objects and files can be grouped together in filegroups for allocation and administration purposes.</p></blockquote>
<p><strong>What are the different type of Filegroups?</strong></p>
<ul>
<li>Primary: The primary filegroup contains the primary data file and any other files not specifically assigned to another filegroup.</li>
<li>User-defined: User-defined filegroups are any filegroups that are specified by using the FILEGROUP keyword in a CREATE DATABASE or ALTER DATABASE statement.</li>
</ul>
<p><strong>What are Page Splits?</strong></p>
<blockquote><p>When there is not enough room on a page for a new row, a server splits the page, allocates a new page, and moves some rows to the new page.</p>
<p>Page splits are considered as a very bad performance and there are number of techniques which is used to reduce the risk of page splits.</p></blockquote>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Best way to store IP Address into Database System</title>
		<link>https://www.dbrnd.com/2015/05/store-ip-address-into-database-system/</link>
					<comments>https://www.dbrnd.com/2015/05/store-ip-address-into-database-system/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 31 May 2015 16:58:37 +0000</pubDate>
				<category><![CDATA[Database Designing]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database concept]]></category>
		<category><![CDATA[Database Design]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[database standards]]></category>
		<category><![CDATA[Database Theory]]></category>
		<category><![CDATA[database topic]]></category>
		<category><![CDATA[ip address]]></category>
		<category><![CDATA[RDBMS]]></category>
		<category><![CDATA[Storage]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=218</guid>

					<description><![CDATA[In this post, I am sharing about the effective storage of IP-Address into Database System. Now let&#8217;s talk about four part of IP-Address. E.g, 152.145.10.25 Many database developers or database designer store this IP-Address into one column which is VARCHAR(15). What do you think? Is this effective storage of IP-Address?. Now imagine that you are [&#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%2F2015%2F05%2Fstore-ip-address-into-database-system%2F&amp;linkname=Best%20way%20to%20store%20IP%20Address%20into%20Database%20System" 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%2F2015%2F05%2Fstore-ip-address-into-database-system%2F&amp;linkname=Best%20way%20to%20store%20IP%20Address%20into%20Database%20System" 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%2F2015%2F05%2Fstore-ip-address-into-database-system%2F&amp;linkname=Best%20way%20to%20store%20IP%20Address%20into%20Database%20System" 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%2F2015%2F05%2Fstore-ip-address-into-database-system%2F&amp;linkname=Best%20way%20to%20store%20IP%20Address%20into%20Database%20System" 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%2F2015%2F05%2Fstore-ip-address-into-database-system%2F&amp;linkname=Best%20way%20to%20store%20IP%20Address%20into%20Database%20System" 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%2F2015%2F05%2Fstore-ip-address-into-database-system%2F&amp;linkname=Best%20way%20to%20store%20IP%20Address%20into%20Database%20System" 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%2F2015%2F05%2Fstore-ip-address-into-database-system%2F&#038;title=Best%20way%20to%20store%20IP%20Address%20into%20Database%20System" data-a2a-url="https://www.dbrnd.com/2015/05/store-ip-address-into-database-system/" data-a2a-title="Best way to store IP Address into Database System"></a></p><p>In this post, I am sharing about the effective storage of IP-Address into Database System.</p>
<p>Now let&#8217;s talk about four part of IP-Address.</p>
<p>E.g, 152.145.10.25</p>
<p>Many database developers or database designer store this IP-Address into one column which is VARCHAR(15).</p>
<p><strong>What do you think? Is this effective storage of IP-Address?.</strong></p>
<blockquote><p>Now imagine that you are playing with 10,0,00,00 online customers in which all this IP-Address of the customer requires for analysis.</p>
<p>If we stored all IP-Addresses into one column, you have to perform string manipulation for finding a particular range of IP-Address.<br />
The string operation is always costly and not advisable.</p></blockquote>
<p><b><br />
Effective storage of IP-Address is very simple:</b></p>
<p>Just divide your full-length IP-Address into four part.</p>
<p>E.g.</p>
<p>Full IP-Address: 152.145.10.25</p>
<p>Four Part :</p>
<p>152</p>
<p>145</p>
<p>10</p>
<p>25</p>
<p>Now create four tinyint/smallint column to store this four different part.</p>
<p>column like,</p>
<p>ip1 tinyint</p>
<p>ip2 tinyint</p>
<p>ip3 tinyint</p>
<p>ip4 tinyint</p>
<p>The full IP-Address split into four different integer part.</p>
<p>Now the task is very easy:<br />
You can also apply an index on all this part and perform range analysis very quickly.</p>
<blockquote><p><b>Yes, I agree that during insertion you also require splitting for storing in the different columns, but this is only a one time process after that you can easily use different parts for various analysis. </b></p></blockquote>
<p>During select, you can also concat this four part and make full IP-Address for display purpose.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2015/05/store-ip-address-into-database-system/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Effective storage of Email Address into Database System</title>
		<link>https://www.dbrnd.com/2015/05/effective-storage-of-email-address-into/</link>
					<comments>https://www.dbrnd.com/2015/05/effective-storage-of-email-address-into/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Tue, 19 May 2015 13:23:10 +0000</pubDate>
				<category><![CDATA[Database Designing]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[Database Design]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[Email Address]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[MySQL Database Administrator]]></category>
		<category><![CDATA[MySQL Query]]></category>
		<category><![CDATA[Storage]]></category>
		<category><![CDATA[String Functions]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=125</guid>

					<description><![CDATA[Problem : Email Address is a ubiquitous field and column for every application or system. As per the application size and scope database system stores lots of user Email Addresses. E.g. 10,00,000 email address is stored in a database system and it is also increasing day by day. Usually, any database user saves all this [&#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%2F2015%2F05%2Feffective-storage-of-email-address-into%2F&amp;linkname=Effective%20storage%20of%20Email%20Address%20into%20Database%20System" 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%2F2015%2F05%2Feffective-storage-of-email-address-into%2F&amp;linkname=Effective%20storage%20of%20Email%20Address%20into%20Database%20System" 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%2F2015%2F05%2Feffective-storage-of-email-address-into%2F&amp;linkname=Effective%20storage%20of%20Email%20Address%20into%20Database%20System" 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%2F2015%2F05%2Feffective-storage-of-email-address-into%2F&amp;linkname=Effective%20storage%20of%20Email%20Address%20into%20Database%20System" 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%2F2015%2F05%2Feffective-storage-of-email-address-into%2F&amp;linkname=Effective%20storage%20of%20Email%20Address%20into%20Database%20System" 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%2F2015%2F05%2Feffective-storage-of-email-address-into%2F&amp;linkname=Effective%20storage%20of%20Email%20Address%20into%20Database%20System" 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%2F2015%2F05%2Feffective-storage-of-email-address-into%2F&#038;title=Effective%20storage%20of%20Email%20Address%20into%20Database%20System" data-a2a-url="https://www.dbrnd.com/2015/05/effective-storage-of-email-address-into/" data-a2a-title="Effective storage of Email Address into Database System"></a></p><p><b>Problem :</b></p>
<p>Email Address is a ubiquitous field and column for every application or system. As per the application size and scope database system stores lots of user Email Addresses.</p>
<p>E.g. 10,00,000 email address is stored in a database system and it is also increasing day by day.<br />
Usually, any database user saves all this email address into one column. Most probably there is one column name is EmailAddress Varchar(250)  and user store email address like &#8221; myprofile@yahoo.co.in &#8221; into this column. &#8211; Great and usually 70% to 75% user doing this.</p>
<p>Once database size and number of users are going to increase day by day at that time, this storage will not perform as per expectation and decrease the performance of the database.</p>
<p><b>How this will decrease the performance of the database?</b></p>
<ul>
<li>As we assumed that email address stored into one column like &#8221; myprofile@yahoo.co.in&#8221;.</li>
<li>Now, we require to find that, how many total numbers of users from only &#8220;Yahoo&#8221;  domain?</li>
<li>How many total number of users from only &#8220;India Yahoo&#8221;?</li>
<li>Require to set some additional offer only for &#8220;Gmail&#8221; domain.</li>
</ul>
<p>Friends, now think about above questions.</p>
<blockquote><p>In my career path I have also stored email address into one column, but gradually I came to know that this is a bad idea because now a day Email address is not only for user name or only for storage purpose.<br />
This is very important for promotional and marketing activity.</p></blockquote>
<p>When you have stored in one column and let&#8217;s imagine, you want to find only &#8221; Gmail &#8221; domain out of 10,0,00,000 email address. </p>
<p>As a database developer, you can think that you require one string operation on all stored email address in which you will find the part which is after  @&#8221;. But this is not a solution where string searching and parsing is required, which slows down the performance of relevant select statement.</p>
<p><b>Solution :</b><br />
The solution is simple,</p>
<p>Just divide your Email address into two part or three part.</p>
<p>E.g.</p>
<ul>
<li>Single Part : &#8221; myprofile@yahoo.co.in &#8220;.</li>
<li>Two Part : &#8221; myprofile&#8221; and &#8221; yahoo.co.in &#8220;.</li>
<li>Three Part : &#8220;myprofile&#8221; and &#8221; yahoo &#8221; and &#8221; co.in &#8220;.</li>
</ul>
<p><b>Now, I am going to explain this using one MySQL Demo. </b><br />
<a href="https://www.dbrnd.com/wp-content/uploads/2015/05/UserEmailRelation.png"><img fetchpriority="high" decoding="async" class=" wp-image-127 size-full aligncenter" title="User Email Relation" src="https://www.dbrnd.com/wp-content/uploads/2015/05/UserEmailRelation.png" alt="UserEmailRelation" width="359" height="145" srcset="https://www.dbrnd.com/wp-content/uploads/2015/05/UserEmailRelation.png 359w, https://www.dbrnd.com/wp-content/uploads/2015/05/UserEmailRelation-300x121.png 300w, https://www.dbrnd.com/wp-content/uploads/2015/05/UserEmailRelation-150x61.png 150w" sizes="(max-width: 359px) 100vw, 359px" /></a></p>
<p>I have created above two table into MySQL. I have divided Email Address into three part.<br />
Below is a sample data.<br />
<b>tbl_User table Data:</b><br />
<a href="https://www.dbrnd.com/wp-content/uploads/2015/05/UserMaster.png"><img loading="lazy" decoding="async" class=" wp-image-128 size-full aligncenter" title="User Master" src="https://www.dbrnd.com/wp-content/uploads/2015/05/UserMaster.png" alt="User Master" width="386" height="81" srcset="https://www.dbrnd.com/wp-content/uploads/2015/05/UserMaster.png 386w, https://www.dbrnd.com/wp-content/uploads/2015/05/UserMaster-300x63.png 300w" sizes="auto, (max-width: 386px) 100vw, 386px" /></a><b>tbl_Email table Data:</b><br />
<a href="https://www.dbrnd.com/wp-content/uploads/2015/05/EmailMaster.png"><img loading="lazy" decoding="async" class="aligncenter wp-image-129 size-full" title="Email Master" src="https://www.dbrnd.com/wp-content/uploads/2015/05/EmailMaster.png" alt="Email Master" width="290" height="81" /></a></p>
<p><strong>Examine the first email address:</strong></p>
<blockquote><p>User Anvesh has anvesh@gmail.com, Roy has roy@yahoo.co.in<br />
As you can find the EmailDomainID reference column in, a User master table which is indicating that which email address is associated with User.<br />
Now a thing is going to easy:<br />
How ?</p></blockquote>
<p>If I require finding how many users with Gmail, I need to find the only EmailDomainID=1.</p>
<p>You can also apply easy extension filter like Yahoo from co.in and .com.<br />
This will give you 80% to 85% better performance than to store Email into one column.</p>
<blockquote><p><b>Also, This will reduce the size of data, E.g, if we store &#8221; Gmail &#8221; keyword 10,00,000 times into the database, then it consume more space than to store only integer &#8221; 1 &#8220;.</b></p></blockquote>
<p>Yes, I also agree that, during every insert, you have to split email address for storing purpose, but this is a good instead of parsing string to count only domain name.</p>
<p>This structure is quite complex to manage at every insert and every email existence check, but it gives better performance.</p>
<p>Below is simple string operation.</p>
<blockquote><p>Full Email Address is : anvesh@yahoo.co.in</p></blockquote>
<p><b>Now parse only &#8221; anvesh &#8221; from anvesh@yahoo.co.in</b></p><pre class="crayon-plain-tag">SELECT SUBSTRING
   ('anvesh@yahoo.CO.IN',1,
      (POSITION('@' IN 'anvesh@yahoo.CO.IN') -1)
   )</pre><p>
<b>Now parse only &#8221; yahoo &#8221; from anvesh@yahoo.co.in</b></p><pre class="crayon-plain-tag">SELECT SUBSTRING(
 SUBSTRING('anvesh@yahoo.CO.IN'
                ,(POSITION('@' IN 'anvesh@yahoo.CO.IN') + 1))
                ,1
                ,POSITION('.' IN SUBSTRING('anvesh@yahoo.CO.IN'
                      ,(POSITION('@' IN 'anvesh@yahoo.CO.IN')))
                         )-2
          )</pre><p>
<b>Now parse only &#8221; co.in &#8221; from anvesh@yahoo.co.in</b></p><pre class="crayon-plain-tag">SELECT SUBSTRING((SUBSTRING('anvesh@yahoo.CO.IN'
      ,(POSITION('@' IN 'anvesh@yahoo.CO.IN') + 1)))
      ,POSITION('.' IN SUBSTRING('anvesh@yahoo.CO.IN'
      ,(POSITION('@' IN 'anvesh@yahoo.CO.IN') + 1)))+1)</pre><p>
<blockquote><p>The above code is required whenever you insert the email address into the database because from the application end we receive one full email address, but for effective storage, you have to parse like above code. </p>
<p>You can also suggest three different input parameters from the application end where above all codes can shift to at application level.
</p></blockquote>
<p><b><a href="https://www.dbrnd.com/2015/05/mysql-string-functions/">Click here to find details about string functions of MySQL.</a></b></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2015/05/effective-storage-of-email-address-into/feed/</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
			</item>
	</channel>
</rss>
