<?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>schema &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/schema/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, 02 Apr 2018 19:16:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.5</generator>
	<item>
		<title>SQL Server 2014: Introduced DBCC CLONEDATABASE TO generate only Schema and Statistics</title>
		<link>https://www.dbrnd.com/2018/01/sql-server-2014-introduced-dbcc-clonedatabase-to-generate-only-schema-statistics-query-store/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Tue, 02 Jan 2018 16:16:21 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbcc]]></category>
		<category><![CDATA[DBCC CLONEDATABASE]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Query Store]]></category>
		<category><![CDATA[schema]]></category>
		<category><![CDATA[SNAPSHOT]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server 2014]]></category>
		<category><![CDATA[SQL Server 2016]]></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[Statistics]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4139</guid>

					<description><![CDATA[<div><img width="452" height="336" src="https://www.dbrnd.com/wp-content/uploads/2018/01/SQL-Server-Clone-Database.jpg" class="attachment-post-image size-post-image wp-post-image" alt="SQL Server Clone Database" decoding="async" fetchpriority="high" /></div>SQL Server 2014 introduced DBCC CLONEDATABASE for creating a blank database with only Schema and Statistics. SQL Server 2016 added support of the Query Store in DBCC CLONEDATABASE. This feature is very helpful in certain conditions. For example, Your production database size is around 800 GB, and You faced some performance related issues because the [&#8230;]]]></description>
										<content:encoded><![CDATA[<div><img width="452" height="336" src="https://www.dbrnd.com/wp-content/uploads/2018/01/SQL-Server-Clone-Database.jpg" class="attachment-post-image size-post-image wp-post-image" alt="SQL Server Clone Database" decoding="async" /></div><p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F01%2Fsql-server-2014-introduced-dbcc-clonedatabase-to-generate-only-schema-statistics-query-store%2F&amp;linkname=SQL%20Server%202014%3A%20Introduced%20DBCC%20CLONEDATABASE%20TO%20generate%20only%20Schema%20and%20Statistics" 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%2F2018%2F01%2Fsql-server-2014-introduced-dbcc-clonedatabase-to-generate-only-schema-statistics-query-store%2F&amp;linkname=SQL%20Server%202014%3A%20Introduced%20DBCC%20CLONEDATABASE%20TO%20generate%20only%20Schema%20and%20Statistics" 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%2F2018%2F01%2Fsql-server-2014-introduced-dbcc-clonedatabase-to-generate-only-schema-statistics-query-store%2F&amp;linkname=SQL%20Server%202014%3A%20Introduced%20DBCC%20CLONEDATABASE%20TO%20generate%20only%20Schema%20and%20Statistics" 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%2F2018%2F01%2Fsql-server-2014-introduced-dbcc-clonedatabase-to-generate-only-schema-statistics-query-store%2F&amp;linkname=SQL%20Server%202014%3A%20Introduced%20DBCC%20CLONEDATABASE%20TO%20generate%20only%20Schema%20and%20Statistics" 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%2F2018%2F01%2Fsql-server-2014-introduced-dbcc-clonedatabase-to-generate-only-schema-statistics-query-store%2F&amp;linkname=SQL%20Server%202014%3A%20Introduced%20DBCC%20CLONEDATABASE%20TO%20generate%20only%20Schema%20and%20Statistics" 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%2F2018%2F01%2Fsql-server-2014-introduced-dbcc-clonedatabase-to-generate-only-schema-statistics-query-store%2F&amp;linkname=SQL%20Server%202014%3A%20Introduced%20DBCC%20CLONEDATABASE%20TO%20generate%20only%20Schema%20and%20Statistics" 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%2F2018%2F01%2Fsql-server-2014-introduced-dbcc-clonedatabase-to-generate-only-schema-statistics-query-store%2F&#038;title=SQL%20Server%202014%3A%20Introduced%20DBCC%20CLONEDATABASE%20TO%20generate%20only%20Schema%20and%20Statistics" data-a2a-url="https://www.dbrnd.com/2018/01/sql-server-2014-introduced-dbcc-clonedatabase-to-generate-only-schema-statistics-query-store/" data-a2a-title="SQL Server 2014: Introduced DBCC CLONEDATABASE TO generate only Schema and Statistics"></a></p><p><em>SQL Server 2014 introduced DBCC CLONEDATABASE for creating a blank database with only Schema and Statistics.</p>
<p>SQL Server 2016 added support of the Query Store in DBCC CLONEDATABASE.</em></p>
<blockquote><p>
This feature is very helpful in certain conditions.<br />
For example, Your production database size is around 800 GB, and You faced some performance related issues because the problem of outdated Statistics or Indexes issue.</p></blockquote>
<blockquote><p>Now the situation is, you can do a test and trial in your Production Database, so DBA takes a copy of Production Database and restore it in different server for further investigation.</p></blockquote>
<blockquote><p>Do you think, this is the only one solution because Its require additional time and infrastructure.</p></blockquote>
<blockquote><p>In this kind of situation, you can use the DBCC CLONEDATABASE feature of SQL Server 2014.</p></blockquote>
<blockquote><p>It creates a blank database copy with the only Schema, Statistics and Query Store information. It is not copying the data, so it does not require any additional space.</p></blockquote>
<blockquote><p>You can find the same statistical information in the new clone database which generates the same execution plan for your investigation.</p>
<p>A Query Execution Plan is prepared to base on Database Statistics so If Database Statistics are same then you check your query execution plan without data.</p></blockquote>
<p>Once you are finished with your task with Clone Database, you can delete it.</p>
<p><strong>How internally SQL Server creates a Clone Database?</strong></p>
<blockquote><p>It validates the source database and acquires the shared lock on the source database</p>
<p>	It creates a snapshot of the source database (Include only: Schema, Statistics, Query Store)</p>
<p>	Create Clone Database and acquires an exclusive lock on it</p>
<p>	Copy the metadata, schema, statistics, query store information from the source database to clone database</p>
<p>	Release all locks from Clone Database</p></blockquote>
<p><strong>How to create a Clone Database?</strong></p>
<p>Use DBCC CLONEDATABASE command to create a Clone Database.<br />
<pre class="crayon-plain-tag">DBCC CLONEDATABASE (MyDatabase,MyDatabase_Clone);</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PostgreSQL: Move Table with Data from one Schema to another Schema</title>
		<link>https://www.dbrnd.com/2017/11/postgresql-move-table-with-data-from-one-schema-to-another-schema/</link>
					<comments>https://www.dbrnd.com/2017/11/postgresql-move-table-with-data-from-one-schema-to-another-schema/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 23 Nov 2017 16:16:54 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[pg_catalog]]></category>
		<category><![CDATA[pg_class]]></category>
		<category><![CDATA[pg_type]]></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 Monitoring]]></category>
		<category><![CDATA[PostgreSQL Performance Tuning]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[schema]]></category>
		<category><![CDATA[Table Copy]]></category>
		<category><![CDATA[Table Move]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=6126</guid>

					<description><![CDATA[In this post, I am sharing a quick way to move your table with data from one schema to another schema of PostgreSQL. I already shared an article on, how to copy a table from one schema to another schema. PostgreSQL: Script to copy Table Data from one Schema to another Schema For moving the [&#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%2F11%2Fpostgresql-move-table-with-data-from-one-schema-to-another-schema%2F&amp;linkname=PostgreSQL%3A%20Move%20Table%20with%20Data%20from%20one%20Schema%20to%20another%20Schema" 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%2F11%2Fpostgresql-move-table-with-data-from-one-schema-to-another-schema%2F&amp;linkname=PostgreSQL%3A%20Move%20Table%20with%20Data%20from%20one%20Schema%20to%20another%20Schema" 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%2F11%2Fpostgresql-move-table-with-data-from-one-schema-to-another-schema%2F&amp;linkname=PostgreSQL%3A%20Move%20Table%20with%20Data%20from%20one%20Schema%20to%20another%20Schema" 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%2F11%2Fpostgresql-move-table-with-data-from-one-schema-to-another-schema%2F&amp;linkname=PostgreSQL%3A%20Move%20Table%20with%20Data%20from%20one%20Schema%20to%20another%20Schema" 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%2F11%2Fpostgresql-move-table-with-data-from-one-schema-to-another-schema%2F&amp;linkname=PostgreSQL%3A%20Move%20Table%20with%20Data%20from%20one%20Schema%20to%20another%20Schema" 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%2F11%2Fpostgresql-move-table-with-data-from-one-schema-to-another-schema%2F&amp;linkname=PostgreSQL%3A%20Move%20Table%20with%20Data%20from%20one%20Schema%20to%20another%20Schema" 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%2F11%2Fpostgresql-move-table-with-data-from-one-schema-to-another-schema%2F&#038;title=PostgreSQL%3A%20Move%20Table%20with%20Data%20from%20one%20Schema%20to%20another%20Schema" data-a2a-url="https://www.dbrnd.com/2017/11/postgresql-move-table-with-data-from-one-schema-to-another-schema/" data-a2a-title="PostgreSQL: Move Table with Data from one Schema to another Schema"></a></p><p>In this post, I am sharing a quick way to move your table with data from one schema to another schema of PostgreSQL. </p>
<p>I already shared an article on, how to copy a table from one schema to another schema. </p>
<blockquote class="wp-embedded-content" data-secret="xeMf9dtttF"><p><a href="https://www.dbrnd.com/2017/02/postgresql-script-to-copy-schema-table-data-to-another-schema-table-migration/">PostgreSQL: Script to copy Table Data from one Schema to another Schema</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2017/02/postgresql-script-to-copy-schema-table-data-to-another-schema-table-migration/embed/#?secret=xeMf9dtttF" data-secret="xeMf9dtttF" width="600" height="338" title="&#8220;PostgreSQL: Script to copy Table Data from one Schema to another Schema&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p>For moving the table between the schemas is a very simple, you should just update the entry in pg_class and pg_type table.<br />
Something like update the table schema name from old to the new basis on given table name. </p>
<p><strong>Please check the below solution, try it your self:</strong></p>
<pre class="crayon-plain-tag">UPDATE pg_catalog.pg_class
SET relnamespace = (SELECT oid FROM pg_catalog.pg_namespace
                    WHERE nspname = 'destination_schema')
WHERE relnamespace = (SELECT oid FROM pg_catalog.pg_namespace
                      WHERE nspname = 'source_schema')
AND relname = 'table_name';</pre> </p>
<pre class="crayon-plain-tag">UPDATE pg_catalog.pg_type
SET typnamespace = (SELECT oid FROM pg_catalog.pg_namespace
                    WHERE nspname = 'destination_schema')
WHERE typnamespace = (SELECT oid FROM pg_catalog.pg_namespace
                      WHERE nspname = 'source_schema')
AND typname = 'table_name';</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2017/11/postgresql-move-table-with-data-from-one-schema-to-another-schema/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>Greenplum: Script to check the size of Database, Schema and Table (Using gp_toolkit schema)</title>
		<link>https://www.dbrnd.com/2017/11/greenplum-script-to-check-the-size-of-database-schema-and-table-using-gp_toolkit-schema/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 18 Nov 2017 16:16:33 +0000</pubDate>
				<category><![CDATA[Greenplum]]></category>
		<category><![CDATA[Greenplum DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[gp_size_of_database]]></category>
		<category><![CDATA[gp_size_of_schema_disk]]></category>
		<category><![CDATA[gp_toolkit]]></category>
		<category><![CDATA[Greenplum Administrator]]></category>
		<category><![CDATA[Greenplum Error]]></category>
		<category><![CDATA[Greenplum Monitoring]]></category>
		<category><![CDATA[Greenplum Performance Tuning]]></category>
		<category><![CDATA[Greenplum Programming]]></category>
		<category><![CDATA[Greenplum Query]]></category>
		<category><![CDATA[Greenplum Tips and Tricks]]></category>
		<category><![CDATA[pg_size_pretty]]></category>
		<category><![CDATA[pg_total_relation_size]]></category>
		<category><![CDATA[PostgreSQL 8.2]]></category>
		<category><![CDATA[schema]]></category>
		<category><![CDATA[Table]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=6118</guid>

					<description><![CDATA[In this post, I am sharing a few scripts for checking the size of Database, Schema and Table of Greenplum Server. Here, I am doing this exercise using the views of the gp_toolkit schema of Greenplum. Check the size of database in MB, GB and TB: [crayon-6ab290cbdbe1c690365541/] Checkt the size of database in MB, GB [&#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%2F11%2Fgreenplum-script-to-check-the-size-of-database-schema-and-table-using-gp_toolkit-schema%2F&amp;linkname=Greenplum%3A%20Script%20to%20check%20the%20size%20of%20Database%2C%20Schema%20and%20Table%20%28Using%20gp_toolkit%20schema%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%2F2017%2F11%2Fgreenplum-script-to-check-the-size-of-database-schema-and-table-using-gp_toolkit-schema%2F&amp;linkname=Greenplum%3A%20Script%20to%20check%20the%20size%20of%20Database%2C%20Schema%20and%20Table%20%28Using%20gp_toolkit%20schema%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%2F2017%2F11%2Fgreenplum-script-to-check-the-size-of-database-schema-and-table-using-gp_toolkit-schema%2F&amp;linkname=Greenplum%3A%20Script%20to%20check%20the%20size%20of%20Database%2C%20Schema%20and%20Table%20%28Using%20gp_toolkit%20schema%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%2F2017%2F11%2Fgreenplum-script-to-check-the-size-of-database-schema-and-table-using-gp_toolkit-schema%2F&amp;linkname=Greenplum%3A%20Script%20to%20check%20the%20size%20of%20Database%2C%20Schema%20and%20Table%20%28Using%20gp_toolkit%20schema%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%2F2017%2F11%2Fgreenplum-script-to-check-the-size-of-database-schema-and-table-using-gp_toolkit-schema%2F&amp;linkname=Greenplum%3A%20Script%20to%20check%20the%20size%20of%20Database%2C%20Schema%20and%20Table%20%28Using%20gp_toolkit%20schema%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%2F2017%2F11%2Fgreenplum-script-to-check-the-size-of-database-schema-and-table-using-gp_toolkit-schema%2F&amp;linkname=Greenplum%3A%20Script%20to%20check%20the%20size%20of%20Database%2C%20Schema%20and%20Table%20%28Using%20gp_toolkit%20schema%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%2F2017%2F11%2Fgreenplum-script-to-check-the-size-of-database-schema-and-table-using-gp_toolkit-schema%2F&#038;title=Greenplum%3A%20Script%20to%20check%20the%20size%20of%20Database%2C%20Schema%20and%20Table%20%28Using%20gp_toolkit%20schema%29" data-a2a-url="https://www.dbrnd.com/2017/11/greenplum-script-to-check-the-size-of-database-schema-and-table-using-gp_toolkit-schema/" data-a2a-title="Greenplum: Script to check the size of Database, Schema and Table (Using gp_toolkit schema)"></a></p><p>In this post, I am sharing a few scripts for checking the size of Database, Schema and Table of Greenplum Server. </p>
<p>Here, I am doing this exercise using the views of the gp_toolkit schema of Greenplum. </p>
<p><strong>Check the size of database in MB, GB and TB:</strong></p>
<pre class="crayon-plain-tag">SELECT sodddatname, (sodddatsize/1048576) AS Sizein_MB
FROM gp_toolkit.gp_size_of_database;
 
SELECT sodddatname, (sodddatsize/1073741824) AS Sizein_GB
FROM gp_toolkit.gp_size_of_database;
 
SELECT sodddatname, (sodddatsize/1073741824)/1024 AS Sizein_TB
FROM gp_toolkit.gp_size_of_database;</pre> </p>
<p><strong>Checkt the size of database in MB, GB and TB:</strong></p>
<pre class="crayon-plain-tag">SELECT sosdnsp, (sosdschematablesize/1048576) AS Sizein_MB
FROM gp_toolkit.gp_size_of_schema_disk;
 
SELECT sosdnsp, (sosdschematablesize/1073741824) AS Sizein_GB
FROM gp_toolkit.gp_size_of_schema_disk;
 
SELECT sosdnsp, (sosdschematablesize/1073741824)/1024 AS Sizein_TB
FROM gp_toolkit.gp_size_of_schema_disk;</pre> </p>
<p><strong>Check the size of any Table or Index:</strong></p>
<pre class="crayon-plain-tag">SELECT pg_size_pretty(pg_total_relation_size('schema_name.table_name'));</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Greenplum: How to check the Database Schema Size?</title>
		<link>https://www.dbrnd.com/2017/06/greenplum-how-to-check-the-database-schema-size-gp_toolkit-gp_size_of_schema_disk/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 29 Jun 2017 16:16:21 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[gp_size_of_schema_disk]]></category>
		<category><![CDATA[gp_toolkit]]></category>
		<category><![CDATA[Greenplum]]></category>
		<category><![CDATA[Greenplum Administrator]]></category>
		<category><![CDATA[Greenplum Error]]></category>
		<category><![CDATA[Greenplum Monitoring]]></category>
		<category><![CDATA[Greenplum Performance Tuning]]></category>
		<category><![CDATA[Greenplum Programming]]></category>
		<category><![CDATA[Greenplum Query]]></category>
		<category><![CDATA[Greenplum Tips and Tricks]]></category>
		<category><![CDATA[pg_namespace]]></category>
		<category><![CDATA[PostgreSQL 8.2]]></category>
		<category><![CDATA[schema]]></category>
		<category><![CDATA[size]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=5441</guid>

					<description><![CDATA[Greenplum is a based on MVCC architecture that means user&#8217;s action like UPDATE will insert a new record in a database. Greenplum Data warehouse can manage billions of data, but it doesn&#8217;t mean that user can generate or UPDATE random data set. Periodically, The Greenplum DBA should check the size of database schemas and their [&#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%2F06%2Fgreenplum-how-to-check-the-database-schema-size-gp_toolkit-gp_size_of_schema_disk%2F&amp;linkname=Greenplum%3A%20How%20to%20check%20the%20Database%20Schema%20Size%3F" 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%2F06%2Fgreenplum-how-to-check-the-database-schema-size-gp_toolkit-gp_size_of_schema_disk%2F&amp;linkname=Greenplum%3A%20How%20to%20check%20the%20Database%20Schema%20Size%3F" 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%2F06%2Fgreenplum-how-to-check-the-database-schema-size-gp_toolkit-gp_size_of_schema_disk%2F&amp;linkname=Greenplum%3A%20How%20to%20check%20the%20Database%20Schema%20Size%3F" 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%2F06%2Fgreenplum-how-to-check-the-database-schema-size-gp_toolkit-gp_size_of_schema_disk%2F&amp;linkname=Greenplum%3A%20How%20to%20check%20the%20Database%20Schema%20Size%3F" 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%2F06%2Fgreenplum-how-to-check-the-database-schema-size-gp_toolkit-gp_size_of_schema_disk%2F&amp;linkname=Greenplum%3A%20How%20to%20check%20the%20Database%20Schema%20Size%3F" 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%2F06%2Fgreenplum-how-to-check-the-database-schema-size-gp_toolkit-gp_size_of_schema_disk%2F&amp;linkname=Greenplum%3A%20How%20to%20check%20the%20Database%20Schema%20Size%3F" 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%2F06%2Fgreenplum-how-to-check-the-database-schema-size-gp_toolkit-gp_size_of_schema_disk%2F&#038;title=Greenplum%3A%20How%20to%20check%20the%20Database%20Schema%20Size%3F" data-a2a-url="https://www.dbrnd.com/2017/06/greenplum-how-to-check-the-database-schema-size-gp_toolkit-gp_size_of_schema_disk/" data-a2a-title="Greenplum: How to check the Database Schema Size?"></a></p><p>Greenplum is a based on MVCC architecture that means user&#8217;s action like UPDATE will insert a new record in a database.<br />
Greenplum Data warehouse can manage billions of data, but it doesn&#8217;t mean that user can generate or UPDATE random data set.<br />
Periodically, The Greenplum DBA should check the size of database schemas and their appropriate usage.</p>
<p>In this post, I shared different scripts to check the size of Greenplum Database Schemas.</p>
<p><strong>Option 1:</strong></p>
<pre class="crayon-plain-tag">select *
from gp_toolkit.gp_size_of_schema_disk;</pre> </p>
<p><strong>Option 2:</strong></p>
<pre class="crayon-plain-tag">select
	schemaname
	,round(sum(pg_total_relation_size(schemaname||'.'||tablename))) SchemaSize
from pg_tables group by 1;</pre> </p>
<p><strong>Option 3:</strong></p>
<pre class="crayon-plain-tag">SELECT
	schema_name
	,pg_size_pretty(sum(table_size)::bigint)
FROM
(
	SELECT pg_catalog.pg_namespace.nspname as schema_name,
	pg_relation_size(pg_catalog.pg_class.oid) as table_size
	FROM pg_catalog.pg_class
	JOIN pg_catalog.pg_namespace ON relnamespace = pg_catalog.pg_namespace.oid
) t
GROUP BY schema_name
ORDER BY schema_name;</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PostgreSQL: Script to copy Table Data from one Schema to another Schema</title>
		<link>https://www.dbrnd.com/2017/02/postgresql-script-to-copy-schema-table-data-to-another-schema-table-migration/</link>
					<comments>https://www.dbrnd.com/2017/02/postgresql-script-to-copy-schema-table-data-to-another-schema-table-migration/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Wed, 08 Feb 2017 16:16:52 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[PostgreSQL DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[migrate schema data]]></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 Monitoring]]></category>
		<category><![CDATA[PostgreSQL Performance Tuning]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[schema]]></category>
		<category><![CDATA[schema copy]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4491</guid>

					<description><![CDATA[In this post, I am sharing one script to copy your Schema tables into another Schema of PostgreSQL. I found this script at wiki.postgresql.org and modified the coding standard for the best use. In our organization, I am creating a different schema for all the database developers, and at every new schema, we require to [&#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%2F02%2Fpostgresql-script-to-copy-schema-table-data-to-another-schema-table-migration%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20copy%20Table%20Data%20from%20one%20Schema%20to%20another%20Schema" 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%2F02%2Fpostgresql-script-to-copy-schema-table-data-to-another-schema-table-migration%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20copy%20Table%20Data%20from%20one%20Schema%20to%20another%20Schema" 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%2F02%2Fpostgresql-script-to-copy-schema-table-data-to-another-schema-table-migration%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20copy%20Table%20Data%20from%20one%20Schema%20to%20another%20Schema" 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%2F02%2Fpostgresql-script-to-copy-schema-table-data-to-another-schema-table-migration%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20copy%20Table%20Data%20from%20one%20Schema%20to%20another%20Schema" 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%2F02%2Fpostgresql-script-to-copy-schema-table-data-to-another-schema-table-migration%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20copy%20Table%20Data%20from%20one%20Schema%20to%20another%20Schema" 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%2F02%2Fpostgresql-script-to-copy-schema-table-data-to-another-schema-table-migration%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20copy%20Table%20Data%20from%20one%20Schema%20to%20another%20Schema" 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%2F02%2Fpostgresql-script-to-copy-schema-table-data-to-another-schema-table-migration%2F&#038;title=PostgreSQL%3A%20Script%20to%20copy%20Table%20Data%20from%20one%20Schema%20to%20another%20Schema" data-a2a-url="https://www.dbrnd.com/2017/02/postgresql-script-to-copy-schema-table-data-to-another-schema-table-migration/" data-a2a-title="PostgreSQL: Script to copy Table Data from one Schema to another Schema"></a></p><p>In this post, I am sharing one script to copy your Schema tables into another Schema of PostgreSQL.<br />
I found this script at wiki.postgresql.org and modified the coding standard for the best use. </p>
<p>In our organization, I am creating a different schema for all the database developers, and at every new schema, we require to migrate development origin schema&#8217;s table data into a newly created schema. </p>
<blockquote><p>I created different database users for each database developer, and they can only access their assigned schema. I am doing this for security reason, and it is also very easy to audit the changes and work progress of all the database developers. </p></blockquote>
<p>Create a below function and execute to migrate your schema.</p>
<p><strong>Create a function to copy old schema data to new schema:</strong></p>
<pre class="crayon-plain-tag">CREATE OR REPLACE FUNCTION fn_CopySchemaData(source_schema text, dest_schema text) 
RETURNS void AS
$$
 
DECLARE
  object text;
  buffer text;
  default_ text;
  column_ text;
BEGIN

	-- Create a new schema
	EXECUTE 'CREATE SCHEMA ' || dest_schema; 
  
FOR object IN
	SELECT sequence_name::text 
	FROM information_schema.SEQUENCES 
	WHERE sequence_schema = source_schema
LOOP
	EXECUTE 'CREATE SEQUENCE ' || dest_schema || '.' || object;
END LOOP;
 
FOR object IN
	SELECT TABLE_NAME::text 
	FROM information_schema.TABLES 
	WHERE table_schema = source_schema
LOOP
	buffer := dest_schema || '.' || object;
	EXECUTE 'CREATE TABLE ' || buffer || ' (LIKE ' || source_schema || '.' || object || ' INCLUDING CONSTRAINTS INCLUDING INDEXES INCLUDING DEFAULTS)';
 
	FOR column_, default_ IN
		SELECT column_name::text, REPLACE(column_default::text, source_schema, dest_schema) 
		FROM information_schema.COLUMNS 
		WHERE table_schema = dest_schema 
			AND TABLE_NAME = object 
			AND column_default LIKE 'nextval(%' || source_schema || '%::regclass)'
	LOOP
	EXECUTE 'ALTER TABLE ' || buffer || ' ALTER COLUMN ' || column_ || ' SET DEFAULT ' || default_;
	END LOOP;
END LOOP;
 
END;
 
$$ LANGUAGE plpgsql VOLATILE;</pre> </p>
<p><strong>Sample Execution:</strong></p>
<pre class="crayon-plain-tag">select *from fn_CopySchemaData('old_schema','new_schema');</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2017/02/postgresql-script-to-copy-schema-table-data-to-another-schema-table-migration/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>SQL Server: T-SQL Script to change Schema of all the Tables</title>
		<link>https://www.dbrnd.com/2016/12/sql-server-t-sql-script-to-change-schema-of-all-the-tables-alter-schema/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Tue, 13 Dec 2016 20:18:27 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server DBA Script]]></category>
		<category><![CDATA[alter schema]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[schema]]></category>
		<category><![CDATA[SQL Query]]></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[table schema]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4050</guid>

					<description><![CDATA[In this post, I am sharing one T-SQL script to change the schema name of all the tables in a SQL Server Database. When you require to alter your database schema name and you have a large number of tables, you can use this kind of script to alter the schema name. First, you need [&#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%2F12%2Fsql-server-t-sql-script-to-change-schema-of-all-the-tables-alter-schema%2F&amp;linkname=SQL%20Server%3A%20T-SQL%20Script%20to%20change%20Schema%20of%20all%20the%20Tables" 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%2F12%2Fsql-server-t-sql-script-to-change-schema-of-all-the-tables-alter-schema%2F&amp;linkname=SQL%20Server%3A%20T-SQL%20Script%20to%20change%20Schema%20of%20all%20the%20Tables" 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%2F12%2Fsql-server-t-sql-script-to-change-schema-of-all-the-tables-alter-schema%2F&amp;linkname=SQL%20Server%3A%20T-SQL%20Script%20to%20change%20Schema%20of%20all%20the%20Tables" 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%2F12%2Fsql-server-t-sql-script-to-change-schema-of-all-the-tables-alter-schema%2F&amp;linkname=SQL%20Server%3A%20T-SQL%20Script%20to%20change%20Schema%20of%20all%20the%20Tables" 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%2F12%2Fsql-server-t-sql-script-to-change-schema-of-all-the-tables-alter-schema%2F&amp;linkname=SQL%20Server%3A%20T-SQL%20Script%20to%20change%20Schema%20of%20all%20the%20Tables" 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%2F12%2Fsql-server-t-sql-script-to-change-schema-of-all-the-tables-alter-schema%2F&amp;linkname=SQL%20Server%3A%20T-SQL%20Script%20to%20change%20Schema%20of%20all%20the%20Tables" 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%2F12%2Fsql-server-t-sql-script-to-change-schema-of-all-the-tables-alter-schema%2F&#038;title=SQL%20Server%3A%20T-SQL%20Script%20to%20change%20Schema%20of%20all%20the%20Tables" data-a2a-url="https://www.dbrnd.com/2016/12/sql-server-t-sql-script-to-change-schema-of-all-the-tables-alter-schema/" data-a2a-title="SQL Server: T-SQL Script to change Schema of all the Tables"></a></p><p>In this post, I am sharing one T-SQL script to change the schema name of all the tables in a SQL Server Database.</p>
<blockquote><p>When you require to alter your database schema name and you have a large number of tables, you can use this kind of script to alter the schema name.</p></blockquote>
<blockquote><p>First, you need to create one new schema and you can replace [New_Schema_Name] by your newly created schema name. You can also add a table filter in the cursor main query.</p></blockquote>
<pre class="crayon-plain-tag">USE [DB_NAME]
GO

DECLARE @TABNAME VARCHAR(255)
DECLARE @SQLCMD VARCHAR(500)
DECLARE CHANGESCHEMA CURSOR

FOR SELECT TABNAME FROM (SELECT '['+B.NAME+'].['+A.NAME+']' TABNAME FROM SYS.TABLES A
	INNER JOIN SYS.SCHEMAS B ON A.SCHEMA_ID= B.SCHEMA_ID) T
OPEN CHANGESCHEMA
FETCH NEXT FROM CHANGESCHEMA INTO @TABNAME
	WHILE @@FETCH_STATUS = 0	
	BEGIN
		SET @SQLCMD= 'ALTER SCHEMA [New_Schema_Name] TRANSFER '+@TABNAME
		PRINT @SQLCMD
	EXEC(@SQLCMD)
FETCH NEXT FROM CHANGESCHEMA INTO @TABNAME
END
CLOSE CHANGESCHEMA
DEALLOCATE CHANGESCHEMA
GO</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PostgreSQL: Should we create Multiple Databases OR create Multiple Schemas?</title>
		<link>https://www.dbrnd.com/2016/07/postgresql-should-we-create-multiple-databases-or-create-multiple-schemas-into-one-database/</link>
					<comments>https://www.dbrnd.com/2016/07/postgresql-should-we-create-multiple-databases-or-create-multiple-schemas-into-one-database/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 25 Jul 2016 20:15:12 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[cross database query]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></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[schema]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=1841</guid>

					<description><![CDATA[This title looks like a very basic topic, but this is one of the most important topics for PostgreSQL database professionals. I have observed that most of the new PostgreSQL users are creating multiple databases into PostgreSQL Server which is not wrong We all have common practice for creating multiple databases for the different purpose [&#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%2F07%2Fpostgresql-should-we-create-multiple-databases-or-create-multiple-schemas-into-one-database%2F&amp;linkname=PostgreSQL%3A%20Should%20we%20create%20Multiple%20Databases%20OR%20create%20Multiple%20Schemas%3F" 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%2F07%2Fpostgresql-should-we-create-multiple-databases-or-create-multiple-schemas-into-one-database%2F&amp;linkname=PostgreSQL%3A%20Should%20we%20create%20Multiple%20Databases%20OR%20create%20Multiple%20Schemas%3F" 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%2F07%2Fpostgresql-should-we-create-multiple-databases-or-create-multiple-schemas-into-one-database%2F&amp;linkname=PostgreSQL%3A%20Should%20we%20create%20Multiple%20Databases%20OR%20create%20Multiple%20Schemas%3F" 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%2F07%2Fpostgresql-should-we-create-multiple-databases-or-create-multiple-schemas-into-one-database%2F&amp;linkname=PostgreSQL%3A%20Should%20we%20create%20Multiple%20Databases%20OR%20create%20Multiple%20Schemas%3F" 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%2F07%2Fpostgresql-should-we-create-multiple-databases-or-create-multiple-schemas-into-one-database%2F&amp;linkname=PostgreSQL%3A%20Should%20we%20create%20Multiple%20Databases%20OR%20create%20Multiple%20Schemas%3F" 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%2F07%2Fpostgresql-should-we-create-multiple-databases-or-create-multiple-schemas-into-one-database%2F&amp;linkname=PostgreSQL%3A%20Should%20we%20create%20Multiple%20Databases%20OR%20create%20Multiple%20Schemas%3F" 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%2F07%2Fpostgresql-should-we-create-multiple-databases-or-create-multiple-schemas-into-one-database%2F&#038;title=PostgreSQL%3A%20Should%20we%20create%20Multiple%20Databases%20OR%20create%20Multiple%20Schemas%3F" data-a2a-url="https://www.dbrnd.com/2016/07/postgresql-should-we-create-multiple-databases-or-create-multiple-schemas-into-one-database/" data-a2a-title="PostgreSQL: Should we create Multiple Databases OR create Multiple Schemas?"></a></p><p>This title looks like a very basic topic, but this is one of the most important topics for PostgreSQL database professionals. </p>
<p><em>I have observed that most of the new PostgreSQL users are creating multiple databases into PostgreSQL Server which is not wrong<br />
</em></p>
<blockquote><p>We all have common practice for creating multiple databases for the different purpose of the project.<br />
But in the PostgreSQL server, we should create multiple schemas instead of multiple databases. </p></blockquote>
<p><strong>I recommended 1-database many-schemas approach for the PostgreSQL Server because cross database queries is very costly in PostgreSQL. </strong></p>
<blockquote><p>In the Microsoft SQL Server, we are creating different databases and we can also execute query between multiple databases by specifying a database name.<br />
But this is not possible with the PostgreSQL. </p></blockquote>
<p><a href="https://www.dbrnd.com/2015/05/postgresql-cross-database-queries-using/" target="_blank"><strong><code>For more details, You can visit this article of cross database queries in PostgreSQL. </code></strong></a></p>
<blockquote><p>The Schemas in PostgreSQL are a lot like packages in Oracle. A number of schemas should be more lightweight than a number of databases. </p></blockquote>
<blockquote><p>We require to take a backup of the only single database, including all schemas. We can also add or remove particular schema during the backup or restore operation. </p></blockquote>
<blockquote><p>We can also create different database permission groups &#038; roles for each and every different schema so that we can control the access of database user.</p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/07/postgresql-should-we-create-multiple-databases-or-create-multiple-schemas-into-one-database/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
