<?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>postgresql &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/postgresql/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>Tue, 17 Sep 2019 19:49:01 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>
	<item>
		<title>PostgreSQL: How to Delete all duplicate rows Except one</title>
		<link>https://www.dbrnd.com/2019/09/postgresql-how-to-delete-all-duplicate-rows-except-one/</link>
					<comments>https://www.dbrnd.com/2019/09/postgresql-how-to-delete-all-duplicate-rows-except-one/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Tue, 17 Sep 2019 19:49:01 +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[delete duplicate]]></category>
		<category><![CDATA[duplicate record]]></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[records]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3837</guid>

					<description><![CDATA[I have already written a similar article to delete duplicate records in SQL Server and MySQL. Here, You can also access that articles. Delete all duplicate rows in MySQL Delete all duplicates rows except one in SQL Server Recently, I got one request for one script to delete duplicate records in PostgreSQL. Most of 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%2F2019%2F09%2Fpostgresql-how-to-delete-all-duplicate-rows-except-one%2F&amp;linkname=PostgreSQL%3A%20How%20to%20Delete%20all%20duplicate%20rows%20Except%20one" 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%2F2019%2F09%2Fpostgresql-how-to-delete-all-duplicate-rows-except-one%2F&amp;linkname=PostgreSQL%3A%20How%20to%20Delete%20all%20duplicate%20rows%20Except%20one" 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%2F2019%2F09%2Fpostgresql-how-to-delete-all-duplicate-rows-except-one%2F&amp;linkname=PostgreSQL%3A%20How%20to%20Delete%20all%20duplicate%20rows%20Except%20one" 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%2F2019%2F09%2Fpostgresql-how-to-delete-all-duplicate-rows-except-one%2F&amp;linkname=PostgreSQL%3A%20How%20to%20Delete%20all%20duplicate%20rows%20Except%20one" 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%2F2019%2F09%2Fpostgresql-how-to-delete-all-duplicate-rows-except-one%2F&amp;linkname=PostgreSQL%3A%20How%20to%20Delete%20all%20duplicate%20rows%20Except%20one" 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%2F2019%2F09%2Fpostgresql-how-to-delete-all-duplicate-rows-except-one%2F&amp;linkname=PostgreSQL%3A%20How%20to%20Delete%20all%20duplicate%20rows%20Except%20one" 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%2F2019%2F09%2Fpostgresql-how-to-delete-all-duplicate-rows-except-one%2F&#038;title=PostgreSQL%3A%20How%20to%20Delete%20all%20duplicate%20rows%20Except%20one" data-a2a-url="https://www.dbrnd.com/2019/09/postgresql-how-to-delete-all-duplicate-rows-except-one/" data-a2a-title="PostgreSQL: How to Delete all duplicate rows Except one"></a></p><p>I have already written a similar article to delete duplicate records in SQL Server and MySQL.<br />
Here, You can also access that articles. </p>
<blockquote class="wp-embedded-content" data-secret="4BibnBnPRG"><p><a href="https://www.dbrnd.com/2015/09/delete-all-duplicate-rows-in-mysql/">Delete all duplicate rows in MySQL</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2015/09/delete-all-duplicate-rows-in-mysql/embed/#?secret=4BibnBnPRG" data-secret="4BibnBnPRG" width="600" height="338" title="&#8220;Delete all duplicate rows in MySQL&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote class="wp-embedded-content" data-secret="hOr3tlfWTl"><p><a href="https://www.dbrnd.com/2015/09/delete-all-duplicates-rows-in-sql-server/">Delete all duplicates rows except one in SQL Server</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2015/09/delete-all-duplicates-rows-in-sql-server/embed/#?secret=hOr3tlfWTl" data-secret="hOr3tlfWTl" width="600" height="338" title="&#8220;Delete all duplicates rows except one in SQL Server&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote><p>Recently, I got one request for one script to delete duplicate records in PostgreSQL.<br />
Most of the Database Developers have such a requirement to delete duplicate records from the Database.</p></blockquote>
<blockquote><p>Like SQL Server, ROW_NUMBER() PARTITION BY is also available in PostgreSQL.<br />
I have prepared this script, using simple inner query with the use of ROW_NUMBER() PARTITION BY clause. </p></blockquote>
<p><strong>Create a sample table:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_RemoveDuplicate
(	
	ID INTEGER PRIMARY KEY
	,Name VARCHAR(150)
);</pre> </p>
<p><strong>Insert few duplicate records:</strong></p>
<pre class="crayon-plain-tag">INSERT INTO tbl_RemoveDuplicate VALUES
(1,'ABC'),(2,'XYZ')
,(3,'XYZ'),(4,'RFQ')
,(5,'PQR'),(6,'EFG')
,(7,'EFG'),(8,'ABC');</pre> </p>
<p><strong>Except one, Delete all duplicate records:</strong></p>
<pre class="crayon-plain-tag">DELETE FROM tbl_RemoveDuplicate
WHERE ID IN 
(SELECT ID
FROM (SELECT id,
	     ROW_NUMBER() OVER (partition BY Name ORDER BY ID) AS RowNumber
     FROM tbl_RemoveDuplicate) AS T
WHERE T.RowNumber &gt; 1);</pre> </p>
<p><strong>Check the result:</strong></p>
<pre class="crayon-plain-tag">SELECT *FROM tbl_RemoveDuplicate;
 id | name
----+------
  1 | ABC
  2 | XYZ
  4 | RFQ
  5 | PQR
  6 | EFG
(5 rows)</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2019/09/postgresql-how-to-delete-all-duplicate-rows-except-one/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>PostgreSQL: Create Index on Full Text Search tsvector Data</title>
		<link>https://www.dbrnd.com/2019/07/postgresql-create-index-on-full-text-search-tsvector-data/</link>
					<comments>https://www.dbrnd.com/2019/07/postgresql-create-index-on-full-text-search-tsvector-data/#respond</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 22 Jul 2019 16:16:31 +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[Full Text Search]]></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[to_tsquery]]></category>
		<category><![CDATA[tsvector]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=6968</guid>

					<description><![CDATA[In this post, I am sharing an example of applying Full Text Search on PostgreSQL Table with Index. Here, I am using tsvector for full text search which is document type and uses match operator like @@. PostgreSQL: Example of Trigram Index for Full Text Search using pg_trgm Extension Below is an example: Create a [&#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%2F2019%2F07%2Fpostgresql-create-index-on-full-text-search-tsvector-data%2F&amp;linkname=PostgreSQL%3A%20Create%20Index%20on%20Full%20Text%20Search%20tsvector%20Data" 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%2F2019%2F07%2Fpostgresql-create-index-on-full-text-search-tsvector-data%2F&amp;linkname=PostgreSQL%3A%20Create%20Index%20on%20Full%20Text%20Search%20tsvector%20Data" 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%2F2019%2F07%2Fpostgresql-create-index-on-full-text-search-tsvector-data%2F&amp;linkname=PostgreSQL%3A%20Create%20Index%20on%20Full%20Text%20Search%20tsvector%20Data" 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%2F2019%2F07%2Fpostgresql-create-index-on-full-text-search-tsvector-data%2F&amp;linkname=PostgreSQL%3A%20Create%20Index%20on%20Full%20Text%20Search%20tsvector%20Data" 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%2F2019%2F07%2Fpostgresql-create-index-on-full-text-search-tsvector-data%2F&amp;linkname=PostgreSQL%3A%20Create%20Index%20on%20Full%20Text%20Search%20tsvector%20Data" 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%2F2019%2F07%2Fpostgresql-create-index-on-full-text-search-tsvector-data%2F&amp;linkname=PostgreSQL%3A%20Create%20Index%20on%20Full%20Text%20Search%20tsvector%20Data" 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%2F2019%2F07%2Fpostgresql-create-index-on-full-text-search-tsvector-data%2F&#038;title=PostgreSQL%3A%20Create%20Index%20on%20Full%20Text%20Search%20tsvector%20Data" data-a2a-url="https://www.dbrnd.com/2019/07/postgresql-create-index-on-full-text-search-tsvector-data/" data-a2a-title="PostgreSQL: Create Index on Full Text Search tsvector Data"></a></p><p>In this post, I am sharing an example of applying Full Text Search on PostgreSQL Table with Index. </p>
<p>Here, I am using tsvector for full text search which is document type and uses match operator like @@.</p>
<blockquote class="wp-embedded-content" data-secret="FxWul5DgOM"><p><a href="https://www.dbrnd.com/2016/08/postgresql-example-of-trigram-index-for-full-text-search-using-pg_trgm-extension/">PostgreSQL: Example of Trigram Index for Full Text Search using pg_trgm Extension</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/08/postgresql-example-of-trigram-index-for-full-text-search-using-pg_trgm-extension/embed/#?secret=FxWul5DgOM" data-secret="FxWul5DgOM" width="600" height="338" title="&#8220;PostgreSQL: Example of Trigram Index for Full Text Search using pg_trgm Extension&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>Below is an example:</strong></p>
<p><strong>Create a sample table with data:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_Textdata
(id int, txt character varying);

INSERT INTO tbl_Textdata VALUES
(1,'I am DBA'),(2,'database research &amp; development'),(3,'think for data only')
,(4,'data is important'),(5,'data is a future'),(6,'I am data owner');</pre> </p>
<p><strong>Do Full Text Searching:</strong></p>
<pre class="crayon-plain-tag">SELECT txt
FROM tbl_Textdata
WHERE to_tsvector(txt) @@ to_tsquery('data');</pre> </p>
<p><strong>Result:</strong></p>
<pre class="crayon-plain-tag">txt
--------------------------
'think for data only'
'data is important'
'data is a future'
'I am data owner'</pre> </p>
<p><strong>Apply an Index on require Text Pattern:</strong></p>
<pre class="crayon-plain-tag">CREATE INDEX tbl_Textdata_txt_idx ON tbl_Textdata USING GIN (to_tsvector('english',txt));</pre> </p>
<p><strong>Check the execution plan:</strong></p>
<pre class="crayon-plain-tag">explain analyze
SELECT txt
FROM tbl_Textdata
WHERE to_tsvector(txt) @@ to_tsquery('data');

'Seq Scan on tbl_textdata  (cost=0.00..4.07 rows=1 width=32) (actual time=0.043..0.058 rows=4 loops=1)'
'  Filter: (to_tsvector((txt)::text) @@ to_tsquery('data'::text))'
'  Rows Removed by Filter: 2'
'Planning time: 5.494 ms'
'Execution time: 0.083 ms'</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2019/07/postgresql-create-index-on-full-text-search-tsvector-data/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PostgreSQL: Example of SERIALIZABLE Isolation Level</title>
		<link>https://www.dbrnd.com/2019/07/postgresql-example-of-serializable-isolation-level-concurrency-control-of-transaction/</link>
					<comments>https://www.dbrnd.com/2019/07/postgresql-example-of-serializable-isolation-level-concurrency-control-of-transaction/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 01 Jul 2019 16:16:18 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[Concurrency Control]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Isolation level]]></category>
		<category><![CDATA[lock table]]></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[SERIALIZABLE Isolation Level]]></category>
		<category><![CDATA[transaction]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3831</guid>

					<description><![CDATA[THE SERIALIZABLE Isolation level is one kind of extended version of the REPEATABLE READ Isolation level. Now with the SERIALIZABLE Isolation level, you cannot modify the data while another transaction is reading the same data. For SELECT-only transactions, use the SERIALIZABLE isolation level when you do not want to see the other transaction commits during [&#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%2F2019%2F07%2Fpostgresql-example-of-serializable-isolation-level-concurrency-control-of-transaction%2F&amp;linkname=PostgreSQL%3A%20Example%20of%20SERIALIZABLE%20Isolation%20Level" 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%2F2019%2F07%2Fpostgresql-example-of-serializable-isolation-level-concurrency-control-of-transaction%2F&amp;linkname=PostgreSQL%3A%20Example%20of%20SERIALIZABLE%20Isolation%20Level" 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%2F2019%2F07%2Fpostgresql-example-of-serializable-isolation-level-concurrency-control-of-transaction%2F&amp;linkname=PostgreSQL%3A%20Example%20of%20SERIALIZABLE%20Isolation%20Level" 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%2F2019%2F07%2Fpostgresql-example-of-serializable-isolation-level-concurrency-control-of-transaction%2F&amp;linkname=PostgreSQL%3A%20Example%20of%20SERIALIZABLE%20Isolation%20Level" 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%2F2019%2F07%2Fpostgresql-example-of-serializable-isolation-level-concurrency-control-of-transaction%2F&amp;linkname=PostgreSQL%3A%20Example%20of%20SERIALIZABLE%20Isolation%20Level" 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%2F2019%2F07%2Fpostgresql-example-of-serializable-isolation-level-concurrency-control-of-transaction%2F&amp;linkname=PostgreSQL%3A%20Example%20of%20SERIALIZABLE%20Isolation%20Level" 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%2F2019%2F07%2Fpostgresql-example-of-serializable-isolation-level-concurrency-control-of-transaction%2F&#038;title=PostgreSQL%3A%20Example%20of%20SERIALIZABLE%20Isolation%20Level" data-a2a-url="https://www.dbrnd.com/2019/07/postgresql-example-of-serializable-isolation-level-concurrency-control-of-transaction/" data-a2a-title="PostgreSQL: Example of SERIALIZABLE Isolation Level"></a></p><p>THE SERIALIZABLE Isolation level is one kind of extended version of the REPEATABLE READ Isolation level.<br />
Now with the SERIALIZABLE Isolation level, you cannot modify the data while another transaction is reading the same data.</p>
<blockquote><p>For SELECT-only transactions, use the SERIALIZABLE isolation level when you do not want to see the other transaction commits during your transaction. </p>
<p>For UPDATE and DELETE transactions, SERIALIZABLE isolation prevents concurrent modification of the same data row; it should therefore be used with caution.</p></blockquote>
<p><strong>Create a table with few sample records:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_Employee
(
	EmpID INTEGER
	,EmpName VARCHAR(50)
);
 
INSERT INTO tbl_Employee
VALUES 
(1,'Anvesh'),(2,'Neevan')
,(3,'Roy'),(4,'Martin');</pre> </p>
<p><strong>Execute in this current session. e.g. Session &#8211; A:</strong></p>
<pre class="crayon-plain-tag">BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;  

UPDATE tbl_Employee SET EmpName ='Varlin' WHERE EmpID=4;

SELECT *FROM tbl_Employee;

 empid | empname
-------+---------
     1 | Anvesh
     2 | Neevan
     3 | Roy
     4 | Varlin</pre> </p>
<p><strong>Execute in anohter session, e.g. Session &#8211; B:<br />
</strong></p>
<pre class="crayon-plain-tag">UPDATE tbl_Employee SET EmpName ='Loother' WHERE EmpID=3;

SELECT *FROM tbl_Employee;

 empid | empname
-------+---------
     1 | Anvesh
     2 | Neevan
     4 | Varlin
     3 | Loother</pre> </p>
<p><strong>Execute in anohter session, e.g. Session &#8211; C:</strong></p>
<pre class="crayon-plain-tag">INSERT INTO tbl_Employee
VALUES (5,'Mahi');

SELECT *FROM tbl_Employee;

 empid | empname
-------+---------
     1 | Anvesh
     2 | Neevan
     4 | Martin
     3 | Loother
     5 | Mahi</pre> </p>
<p><strong>Execute COMMIT on first Current Session &#8211; A:</strong></p>
<pre class="crayon-plain-tag">--Nothing happen to this Query and Data is as it is. 

SELECT *FROM tbl_Employee; 

 empid | empname
-------+---------
     1 | Anvesh
     2 | Neevan
     3 | Roy
     4 | Varlin

-- Now Execute COMMIT:
COMMIT TRANSACTION;</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2019/07/postgresql-example-of-serializable-isolation-level-concurrency-control-of-transaction/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>PostgreSQL: Disable Non-Durable parameters and Improve Server Performance</title>
		<link>https://www.dbrnd.com/2019/06/postgresql-disable-non-durable-parameters-and-improve-server-performance/</link>
					<comments>https://www.dbrnd.com/2019/06/postgresql-disable-non-durable-parameters-and-improve-server-performance/#respond</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 10 Jun 2019 16:16:22 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[checkpoint_timeout]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[fsync]]></category>
		<category><![CDATA[full_page_writes]]></category>
		<category><![CDATA[max_wal_size]]></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[synchronous_commit]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=6920</guid>

					<description><![CDATA[Important notice: Never try in your Production or any other Live server. This post is only ad-hoc and test server. Data Durability is an important part of Database ACID property. In this post, I am sharing few parameters which we can disable for achieving good performance of PostgreSQL Database Server. We should disable Non-Durable parameters [&#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%2F2019%2F06%2Fpostgresql-disable-non-durable-parameters-and-improve-server-performance%2F&amp;linkname=PostgreSQL%3A%20Disable%20Non-Durable%20parameters%20and%20Improve%20Server%20Performance" 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%2F2019%2F06%2Fpostgresql-disable-non-durable-parameters-and-improve-server-performance%2F&amp;linkname=PostgreSQL%3A%20Disable%20Non-Durable%20parameters%20and%20Improve%20Server%20Performance" 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%2F2019%2F06%2Fpostgresql-disable-non-durable-parameters-and-improve-server-performance%2F&amp;linkname=PostgreSQL%3A%20Disable%20Non-Durable%20parameters%20and%20Improve%20Server%20Performance" 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%2F2019%2F06%2Fpostgresql-disable-non-durable-parameters-and-improve-server-performance%2F&amp;linkname=PostgreSQL%3A%20Disable%20Non-Durable%20parameters%20and%20Improve%20Server%20Performance" 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%2F2019%2F06%2Fpostgresql-disable-non-durable-parameters-and-improve-server-performance%2F&amp;linkname=PostgreSQL%3A%20Disable%20Non-Durable%20parameters%20and%20Improve%20Server%20Performance" 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%2F2019%2F06%2Fpostgresql-disable-non-durable-parameters-and-improve-server-performance%2F&amp;linkname=PostgreSQL%3A%20Disable%20Non-Durable%20parameters%20and%20Improve%20Server%20Performance" 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%2F2019%2F06%2Fpostgresql-disable-non-durable-parameters-and-improve-server-performance%2F&#038;title=PostgreSQL%3A%20Disable%20Non-Durable%20parameters%20and%20Improve%20Server%20Performance" data-a2a-url="https://www.dbrnd.com/2019/06/postgresql-disable-non-durable-parameters-and-improve-server-performance/" data-a2a-title="PostgreSQL: Disable Non-Durable parameters and Improve Server Performance"></a></p><blockquote><p>
<strong>Important notice: Never try in your Production or any other Live server. This post is only ad-hoc and test server. </strong></p></blockquote>
<p>Data Durability is an important part of Database ACID property. In this post, I am sharing few parameters which we can disable for achieving good performance of PostgreSQL Database Server.</p>
<p>We should disable Non-Durable parameters on our test server where we need only POC related work, and if your system doesn&#8217;t require any guarantee of data, then you can disable. </p>
<p><strong>Why disabling the Non-Durable parameters?</strong></p>
<blockquote><p>PostgreSQL guarantees the full durability of data even if the server crashes or loses power.<br />
But committing every single transaction in datafile and log file is also extra overhead on the database server.<br />
So simple, just disable that parameter for achieving good performance.
 </p></blockquote>
<blockquote class="wp-embedded-content" data-secret="T6TwASV5Ev"><p><a href="https://www.dbrnd.com/2015/05/acid-properties-in-database-system/">ACID Properties in Database System (Atomicity, Consistency, Isolation, Durability)</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2015/05/acid-properties-in-database-system/embed/#?secret=T6TwASV5Ev" data-secret="T6TwASV5Ev" width="600" height="338" title="&#8220;ACID Properties in Database System (Atomicity, Consistency, Isolation, Durability)&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>Below are parameters:</strong></p>
<blockquote><p>fsync: Turn off &#8211; no need to flush data to disk </p>
<p>synchronous_commit: Turn off &#8211; not need to write to disk on every commit</p>
<p>full_page_writes: Turn off &#8211; no need to guard against partial page writes</p>
<p>max_wal_size: Increase &#8211; reduces the frequency of checkpoints</p>
<p>checkpoint_timeout: Increase &#8211; reduces the frequency of checkpoints</p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2019/06/postgresql-disable-non-durable-parameters-and-improve-server-performance/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PostgreSQL: How to remove accents (diacritic signs) from lexemes</title>
		<link>https://www.dbrnd.com/2019/05/postgresql-how-to-remove-accents-diacritic-signs-from-lexemes/</link>
					<comments>https://www.dbrnd.com/2019/05/postgresql-how-to-remove-accents-diacritic-signs-from-lexemes/#respond</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 13 May 2019 16:16:20 +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[diacritic signs]]></category>
		<category><![CDATA[lexemes]]></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[unaccent]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=7018</guid>

					<description><![CDATA[In this post, I am sharing the use of &#8220;unaccent&#8221; extension of PostgreSQL. Use unaccent, for removing diacritic signs from the string and convert into the valid character as per the specified collation. When we are importing data from different types of datasets, we can find diacritic signs in the data. We can use unaccent() [&#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%2F2019%2F05%2Fpostgresql-how-to-remove-accents-diacritic-signs-from-lexemes%2F&amp;linkname=PostgreSQL%3A%20How%20to%20remove%20accents%20%28diacritic%20signs%29%20from%20lexemes" 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%2F2019%2F05%2Fpostgresql-how-to-remove-accents-diacritic-signs-from-lexemes%2F&amp;linkname=PostgreSQL%3A%20How%20to%20remove%20accents%20%28diacritic%20signs%29%20from%20lexemes" 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%2F2019%2F05%2Fpostgresql-how-to-remove-accents-diacritic-signs-from-lexemes%2F&amp;linkname=PostgreSQL%3A%20How%20to%20remove%20accents%20%28diacritic%20signs%29%20from%20lexemes" 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%2F2019%2F05%2Fpostgresql-how-to-remove-accents-diacritic-signs-from-lexemes%2F&amp;linkname=PostgreSQL%3A%20How%20to%20remove%20accents%20%28diacritic%20signs%29%20from%20lexemes" 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%2F2019%2F05%2Fpostgresql-how-to-remove-accents-diacritic-signs-from-lexemes%2F&amp;linkname=PostgreSQL%3A%20How%20to%20remove%20accents%20%28diacritic%20signs%29%20from%20lexemes" 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%2F2019%2F05%2Fpostgresql-how-to-remove-accents-diacritic-signs-from-lexemes%2F&amp;linkname=PostgreSQL%3A%20How%20to%20remove%20accents%20%28diacritic%20signs%29%20from%20lexemes" 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%2F2019%2F05%2Fpostgresql-how-to-remove-accents-diacritic-signs-from-lexemes%2F&#038;title=PostgreSQL%3A%20How%20to%20remove%20accents%20%28diacritic%20signs%29%20from%20lexemes" data-a2a-url="https://www.dbrnd.com/2019/05/postgresql-how-to-remove-accents-diacritic-signs-from-lexemes/" data-a2a-title="PostgreSQL: How to remove accents (diacritic signs) from lexemes"></a></p><p>In this post, I am sharing the use of &#8220;unaccent&#8221; extension of PostgreSQL. </p>
<p>Use unaccent, for removing diacritic signs from the string and convert into the valid character as per the specified collation.</p>
<p>When we are importing data from different types of datasets, we can find diacritic signs in the data. We can use unaccent() for removing those signs. </p>
<p><strong>Check below demonstration:</strong></p>
<p><strong>Create an extension:</strong></p>
<pre class="crayon-plain-tag">CREATE EXTENSION unaccent;</pre> </p>
<p><strong>Use unaccent():</strong></p>
<pre class="crayon-plain-tag">SELECT unaccent('ô ã À Æ ß Ä');</pre> </p>
<p><strong>Result:</strong></p>
<pre class="crayon-plain-tag">unaccent
------------------
'o a A AE ss A'</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2019/05/postgresql-how-to-remove-accents-diacritic-signs-from-lexemes/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PostgreSQL: Find Factorial, Absolute, Negation value</title>
		<link>https://www.dbrnd.com/2019/04/postgresql-find-factorial-absolute-negation-value/</link>
					<comments>https://www.dbrnd.com/2019/04/postgresql-find-factorial-absolute-negation-value/#respond</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 15 Apr 2019 18:34:07 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[absolute value]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[factorial]]></category>
		<category><![CDATA[negation value]]></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>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=6979</guid>

					<description><![CDATA[In this post, I am sharing few mathematical operators for finding factorial, absolute and negation value in PostgreSQL. I was reading the official the official page of PostgreSQL and found few interesting operators which we can use for the mathematical purpose. Check below examples: ! operator for factorial: [crayon-6a8eb11d93e2c801430111/] @ operator for absolute: [crayon-6a8eb11d93e2e531278489/] ~ [&#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%2F2019%2F04%2Fpostgresql-find-factorial-absolute-negation-value%2F&amp;linkname=PostgreSQL%3A%20Find%20Factorial%2C%20Absolute%2C%20Negation%20value" 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%2F2019%2F04%2Fpostgresql-find-factorial-absolute-negation-value%2F&amp;linkname=PostgreSQL%3A%20Find%20Factorial%2C%20Absolute%2C%20Negation%20value" 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%2F2019%2F04%2Fpostgresql-find-factorial-absolute-negation-value%2F&amp;linkname=PostgreSQL%3A%20Find%20Factorial%2C%20Absolute%2C%20Negation%20value" 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%2F2019%2F04%2Fpostgresql-find-factorial-absolute-negation-value%2F&amp;linkname=PostgreSQL%3A%20Find%20Factorial%2C%20Absolute%2C%20Negation%20value" 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%2F2019%2F04%2Fpostgresql-find-factorial-absolute-negation-value%2F&amp;linkname=PostgreSQL%3A%20Find%20Factorial%2C%20Absolute%2C%20Negation%20value" 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%2F2019%2F04%2Fpostgresql-find-factorial-absolute-negation-value%2F&amp;linkname=PostgreSQL%3A%20Find%20Factorial%2C%20Absolute%2C%20Negation%20value" 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%2F2019%2F04%2Fpostgresql-find-factorial-absolute-negation-value%2F&#038;title=PostgreSQL%3A%20Find%20Factorial%2C%20Absolute%2C%20Negation%20value" data-a2a-url="https://www.dbrnd.com/2019/04/postgresql-find-factorial-absolute-negation-value/" data-a2a-title="PostgreSQL: Find Factorial, Absolute, Negation value"></a></p><p>In this post, I am sharing few mathematical operators for finding factorial, absolute and negation value in PostgreSQL. </p>
<p>I was reading the official the official page of PostgreSQL and found few interesting operators which we can use for the mathematical purpose.</p>
<p><strong>Check below examples:</strong></p>
<p><strong>! operator for factorial:</strong></p>
<pre class="crayon-plain-tag">SELECT 8 ! AS "8 factorial";

8 factorial
------------
'40320'</pre> </p>
<p><strong>@ operator for absolute:</strong></p>
<pre class="crayon-plain-tag">SELECT @ '-8.8' AS "absolute value";

absolute values
------------
'40320'</pre> </p>
<p><strong>~ operator for negation:</strong></p>
<pre class="crayon-plain-tag">SELECT ~ CAST('16' AS int8) AS "negation value";

negation value
---------------
'-17'</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2019/04/postgresql-find-factorial-absolute-negation-value/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>MySQL: Download Link for Sample Database (Sakila)</title>
		<link>https://www.dbrnd.com/2019/04/mysql-download-link-for-sample-database-sakila/</link>
					<comments>https://www.dbrnd.com/2019/04/mysql-download-link-for-sample-database-sakila/#respond</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 01 Apr 2019 16:16:20 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[DVD Rental Database]]></category>
		<category><![CDATA[MySQL Command]]></category>
		<category><![CDATA[MySQL Database Administrator]]></category>
		<category><![CDATA[MySQL Database Designing]]></category>
		<category><![CDATA[MySQL Database Programming]]></category>
		<category><![CDATA[MySQL Error]]></category>
		<category><![CDATA[MySQL Performance Tuning]]></category>
		<category><![CDATA[MySQL Query]]></category>
		<category><![CDATA[MySQL Sample Database]]></category>
		<category><![CDATA[MySQL Tips and Tricks]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[PostgreSQL Sample Database]]></category>
		<category><![CDATA[Sakila Sample Database]]></category>
		<category><![CDATA[Sample Database]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=7021</guid>

					<description><![CDATA[Beginners are always searching for sample database so, in this post, I am sharing an official download link to a MySQL Sakila sample database which we can use for our testing purpose. Sakila sample database is a DVD rental database. The database contains sample tables, views, SPs, Functions and Triggers. The MySQL beginner can install [&#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%2F2019%2F04%2Fmysql-download-link-for-sample-database-sakila%2F&amp;linkname=MySQL%3A%20Download%20Link%20for%20Sample%20Database%20%28Sakila%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%2F2019%2F04%2Fmysql-download-link-for-sample-database-sakila%2F&amp;linkname=MySQL%3A%20Download%20Link%20for%20Sample%20Database%20%28Sakila%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%2F2019%2F04%2Fmysql-download-link-for-sample-database-sakila%2F&amp;linkname=MySQL%3A%20Download%20Link%20for%20Sample%20Database%20%28Sakila%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%2F2019%2F04%2Fmysql-download-link-for-sample-database-sakila%2F&amp;linkname=MySQL%3A%20Download%20Link%20for%20Sample%20Database%20%28Sakila%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%2F2019%2F04%2Fmysql-download-link-for-sample-database-sakila%2F&amp;linkname=MySQL%3A%20Download%20Link%20for%20Sample%20Database%20%28Sakila%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%2F2019%2F04%2Fmysql-download-link-for-sample-database-sakila%2F&amp;linkname=MySQL%3A%20Download%20Link%20for%20Sample%20Database%20%28Sakila%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%2F2019%2F04%2Fmysql-download-link-for-sample-database-sakila%2F&#038;title=MySQL%3A%20Download%20Link%20for%20Sample%20Database%20%28Sakila%29" data-a2a-url="https://www.dbrnd.com/2019/04/mysql-download-link-for-sample-database-sakila/" data-a2a-title="MySQL: Download Link for Sample Database (Sakila)"></a></p><p>Beginners are always searching for sample database so, in this post, I am sharing an official download link to a MySQL Sakila sample database which we can use for our testing purpose. </p>
<p>Sakila sample database is a DVD rental database. The database contains sample tables, views, SPs, Functions and Triggers. </p>
<p>The MySQL beginner can install this database and can start the practice with it.<br />
PostgreSQL beginner can also use this database. </p>
<p>Please check the official page <a href="https://dev.mysql.com/doc/sakila/en/" rel="noopener" target="_blank">here</a>, and you can see all require documentation like, database structure, installation steps.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2019/04/mysql-download-link-for-sample-database-sakila/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PostgreSQL: Script to convert User to Super User</title>
		<link>https://www.dbrnd.com/2019/03/postgresql-script-to-convert-user-to-super-user/</link>
					<comments>https://www.dbrnd.com/2019/03/postgresql-script-to-convert-user-to-super-user/#respond</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 25 Mar 2019 16:16:47 +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[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[super user]]></category>
		<category><![CDATA[User Permission]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=7322</guid>

					<description><![CDATA[In this post, I am sharing a script for transforming normal DB user to Super User in PostgreSQL. The Super User is the admin user and it has all kind of access to PostgreSQL Server. We can create multiple superusers in PostgreSQL. I need this kind of handy commands/scripts because when any new dba join [&#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%2F2019%2F03%2Fpostgresql-script-to-convert-user-to-super-user%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20convert%20User%20to%20Super%20User" 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%2F2019%2F03%2Fpostgresql-script-to-convert-user-to-super-user%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20convert%20User%20to%20Super%20User" 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%2F2019%2F03%2Fpostgresql-script-to-convert-user-to-super-user%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20convert%20User%20to%20Super%20User" 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%2F2019%2F03%2Fpostgresql-script-to-convert-user-to-super-user%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20convert%20User%20to%20Super%20User" 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%2F2019%2F03%2Fpostgresql-script-to-convert-user-to-super-user%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20convert%20User%20to%20Super%20User" 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%2F2019%2F03%2Fpostgresql-script-to-convert-user-to-super-user%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20convert%20User%20to%20Super%20User" 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%2F2019%2F03%2Fpostgresql-script-to-convert-user-to-super-user%2F&#038;title=PostgreSQL%3A%20Script%20to%20convert%20User%20to%20Super%20User" data-a2a-url="https://www.dbrnd.com/2019/03/postgresql-script-to-convert-user-to-super-user/" data-a2a-title="PostgreSQL: Script to convert User to Super User"></a></p><p>In this post, I am sharing a script for transforming normal DB user to Super User in PostgreSQL. </p>
<p>The Super User is the admin user and it has all kind of access to PostgreSQL Server. We can create multiple superusers in PostgreSQL. </p>
<p>I need this kind of handy commands/scripts because when any new dba join the team, giving basic permission of database and later the same user requires superuser permission. </p>
<p><strong>Convert a user into Super User:</strong></p>
<pre class="crayon-plain-tag">ALTER USER user_name WITH SUPERUSER;</pre> </p>
<p><strong>Revoke Super User Permission:</strong></p>
<pre class="crayon-plain-tag">ALTER USER user_name WITH NOSUPERUSER;</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2019/03/postgresql-script-to-convert-user-to-super-user/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PostgreSQL: Bash Shell Script to execute psql command in UNIX / LINUX</title>
		<link>https://www.dbrnd.com/2019/03/postgresql-bash-shell-script-to-execute-psql-command-in-unix-linux/</link>
					<comments>https://www.dbrnd.com/2019/03/postgresql-bash-shell-script-to-execute-psql-command-in-unix-linux/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 04 Mar 2019 16:16:25 +0000</pubDate>
				<category><![CDATA[Bash Shell Script]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[PostgreSQL DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[Bash shell script]]></category>
		<category><![CDATA[chmod]]></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 Monitoring]]></category>
		<category><![CDATA[PostgreSQL Performance Tuning]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[psql]]></category>
		<category><![CDATA[vi editor]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4374</guid>

					<description><![CDATA[As per the en.wikibooks.org: Bash is a &#8220;Unix shell&#8221;: a command-line interface for interacting with the operating system. It has the ability to run an entire script of commands, known as a &#8220;Bash shell script&#8221;. I recently started to create UNIX / LINUX Bash Shell script for enhancing my PostgreSQL DBA Work. You can create [&#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%2F2019%2F03%2Fpostgresql-bash-shell-script-to-execute-psql-command-in-unix-linux%2F&amp;linkname=PostgreSQL%3A%20Bash%20Shell%20Script%20to%20execute%20psql%20command%20in%20UNIX%20%2F%20LINUX" 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%2F2019%2F03%2Fpostgresql-bash-shell-script-to-execute-psql-command-in-unix-linux%2F&amp;linkname=PostgreSQL%3A%20Bash%20Shell%20Script%20to%20execute%20psql%20command%20in%20UNIX%20%2F%20LINUX" 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%2F2019%2F03%2Fpostgresql-bash-shell-script-to-execute-psql-command-in-unix-linux%2F&amp;linkname=PostgreSQL%3A%20Bash%20Shell%20Script%20to%20execute%20psql%20command%20in%20UNIX%20%2F%20LINUX" 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%2F2019%2F03%2Fpostgresql-bash-shell-script-to-execute-psql-command-in-unix-linux%2F&amp;linkname=PostgreSQL%3A%20Bash%20Shell%20Script%20to%20execute%20psql%20command%20in%20UNIX%20%2F%20LINUX" 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%2F2019%2F03%2Fpostgresql-bash-shell-script-to-execute-psql-command-in-unix-linux%2F&amp;linkname=PostgreSQL%3A%20Bash%20Shell%20Script%20to%20execute%20psql%20command%20in%20UNIX%20%2F%20LINUX" 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%2F2019%2F03%2Fpostgresql-bash-shell-script-to-execute-psql-command-in-unix-linux%2F&amp;linkname=PostgreSQL%3A%20Bash%20Shell%20Script%20to%20execute%20psql%20command%20in%20UNIX%20%2F%20LINUX" 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%2F2019%2F03%2Fpostgresql-bash-shell-script-to-execute-psql-command-in-unix-linux%2F&#038;title=PostgreSQL%3A%20Bash%20Shell%20Script%20to%20execute%20psql%20command%20in%20UNIX%20%2F%20LINUX" data-a2a-url="https://www.dbrnd.com/2019/03/postgresql-bash-shell-script-to-execute-psql-command-in-unix-linux/" data-a2a-title="PostgreSQL: Bash Shell Script to execute psql command in UNIX / LINUX"></a></p><p>As per the en.wikibooks.org:</p>
<blockquote><p>Bash is a &#8220;Unix shell&#8221;: a command-line interface for interacting with the operating system. It has the ability to run an entire script of commands, known as a &#8220;Bash shell script&#8221;.</p></blockquote>
<p>I recently started to create UNIX / LINUX Bash Shell script for enhancing my PostgreSQL DBA Work. You can create a Bash shell script and can connect PostgreSQL using psql. </p>
<p>In this post, I am sharing a sample bash shell script to execute psql commands. </p>
<p><strong>Open a new file in vi editor:</strong></p>
<pre class="crayon-plain-tag">[root@dbrnd anvesh]$ vi helloworld.bash</pre> </p>
<p><strong>Press [i] key to get an insert prompt:</strong></p>
<p><strong>Copy below sample Bash Shell Script and Paste into vi editor:</strong></p>
<pre class="crayon-plain-tag">#!/bin/bash

###################################################
# First Bash Shell script to execute psql command 
###################################################

#Set the value of variable
database="database_name"

#Execute few psql commands: 
#Note: you can also add -h hostname -U username in the below commands. 

psql -d $database -c "CREATE TABLE public.tbl_students(rno integer, name character varying)"
psql -d $database -c "INSERT INTO public.tbl_students VALUES (1,'Anvesh'),(2,'Neevan'),(3,'Roy'),(4,'Martin'),(5,'Jenny')"
psql -d $database -c "SELECT *FROM public.tbl_students"

#Assign table count to variable
TableCount=$(psql -d $database -t -c "select count(1) from public.tbl_students")

#Print the value of variable
echo "Total table records count....:"$TableCount</pre> </p>
<p><strong>Press [Esc] key to get a command prompt and execute below command:</strong><br />
To save and exit vi editor.</p>
<pre class="crayon-plain-tag">:wq</pre> </p>
<p><strong>Give permission to the file:</strong></p>
<pre class="crayon-plain-tag">[root@dbrnd anvesh]$ chmod +x helloworld.bash</pre> </p>
<p><strong>Execute this file:</strong></p>
<pre class="crayon-plain-tag">[root@dbrnd anvesh]$ ./helloworld.bash</pre> </p>
<p><strong>You can find below result:</strong></p>
<pre class="crayon-plain-tag">rno |  name
-----+--------
   1 | Anvesh
   5 | Jenny
   2 | Neevan
   3 | Roy
   4 | Martin
(5 rows)

Total table records count....: 5</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2019/03/postgresql-bash-shell-script-to-execute-psql-command-in-unix-linux/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>PostgreSQL: Don&#8217;t take backup until your Database is changed</title>
		<link>https://www.dbrnd.com/2019/02/postgresql-dont-take-backup-until-your-database-is-changed-check-pg_stat_database-tuple/</link>
					<comments>https://www.dbrnd.com/2019/02/postgresql-dont-take-backup-until-your-database-is-changed-check-pg_stat_database-tuple/#respond</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 25 Feb 2019 16:16:38 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[pg_stat_database]]></category>
		<category><![CDATA[pg_stat_reset]]></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[tup_inserted]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4442</guid>

					<description><![CDATA[In this post, I am sharing an important tip for PostgreSQL DBAs. I recently started work with a new PostgreSQL Client. They have total 326 databases in their PostgreSQL Server. They are taking full backup for all the database and this process is taking around total 7 hours. When I looked this, my first step [&#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%2F2019%2F02%2Fpostgresql-dont-take-backup-until-your-database-is-changed-check-pg_stat_database-tuple%2F&amp;linkname=PostgreSQL%3A%20Don%E2%80%99t%20take%20backup%20until%20your%20Database%20is%20changed" 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%2F2019%2F02%2Fpostgresql-dont-take-backup-until-your-database-is-changed-check-pg_stat_database-tuple%2F&amp;linkname=PostgreSQL%3A%20Don%E2%80%99t%20take%20backup%20until%20your%20Database%20is%20changed" 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%2F2019%2F02%2Fpostgresql-dont-take-backup-until-your-database-is-changed-check-pg_stat_database-tuple%2F&amp;linkname=PostgreSQL%3A%20Don%E2%80%99t%20take%20backup%20until%20your%20Database%20is%20changed" 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%2F2019%2F02%2Fpostgresql-dont-take-backup-until-your-database-is-changed-check-pg_stat_database-tuple%2F&amp;linkname=PostgreSQL%3A%20Don%E2%80%99t%20take%20backup%20until%20your%20Database%20is%20changed" 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%2F2019%2F02%2Fpostgresql-dont-take-backup-until-your-database-is-changed-check-pg_stat_database-tuple%2F&amp;linkname=PostgreSQL%3A%20Don%E2%80%99t%20take%20backup%20until%20your%20Database%20is%20changed" 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%2F2019%2F02%2Fpostgresql-dont-take-backup-until-your-database-is-changed-check-pg_stat_database-tuple%2F&amp;linkname=PostgreSQL%3A%20Don%E2%80%99t%20take%20backup%20until%20your%20Database%20is%20changed" 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%2F2019%2F02%2Fpostgresql-dont-take-backup-until-your-database-is-changed-check-pg_stat_database-tuple%2F&#038;title=PostgreSQL%3A%20Don%E2%80%99t%20take%20backup%20until%20your%20Database%20is%20changed" data-a2a-url="https://www.dbrnd.com/2019/02/postgresql-dont-take-backup-until-your-database-is-changed-check-pg_stat_database-tuple/" data-a2a-title="PostgreSQL: Don’t take backup until your Database is changed"></a></p><p>In this post, I am sharing an important tip for PostgreSQL DBAs. </p>
<p>I recently started work with a new PostgreSQL Client. They have total 326 databases in their PostgreSQL Server. They are taking full backup for all the database and this process is taking around total 7 hours. </p>
<p>When I looked this, my first step was to find database statistics. I have found 25% of databases are not being updated frequently. </p>
<blockquote><p>I added one additional check in a backup process like &#8220;skip the backup for those databases which have not been changed for any operations (DDL or DML operation)&#8221;.<br />
After this check, the backup process is taking around total 5 hours to complete the job.</p></blockquote>
<blockquote><p>Using pg_stat_database, you can check the stats of database and can compare the value for tuple columns with the old value. If you found any changes, your database has been changed.</p></blockquote>
<p>If any of your DBA reset the PostgreSQL database statistics using something like pg_stat_reset, you have to add some more extra logic to understand the difference between statistics. </p>
<p>Below is a sample demonstration:<br />
<strong>Create a backup table to store DatabaseStats:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE public.tbl_DatabaseStats AS
SELECT 
	datname
	,tup_inserted
	,tup_updated
	,tup_deleted	
FROM pg_stat_database;</pre> </p>
<p><strong>Perform few DDLs and DMLs actions:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE public.tbl_Students(rno int, name character varying);
INSERT INTO public.tbl_Students VALUES(1,'Anvesh');
CREATE TABLE public.tbl_Test88(id int);</pre> </p>
<p><strong>Compare the result of below two queries:</strong><br />
If you find differences on any of the columns of your Database, your database stats has been changed and you should take the backup of your database.</p>
<pre class="crayon-plain-tag">SELECT 
	datname
	,tup_inserted
	,tup_updated
	,tup_deleted	
FROM pg_stat_database;

SELECT *FROM public.tbl_DatabaseStats;</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2019/02/postgresql-dont-take-backup-until-your-database-is-changed-check-pg_stat_database-tuple/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
