<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1948920108711213708</id><updated>2026-05-31T03:31:30.578-07:00</updated><category term="SQL Server Tip"/><category term="SQL Server"/><category term="Oracle"/><category term="Oracle Query"/><category term="SQL Server Test"/><category term="PL/SQL"/><category term="SQL Server 2005"/><category term="T-SQL"/><category term="DBA Tasks"/><category term="MySQL"/><category term="MySQL Query"/><category term="PostgreSQL"/><category term="SQL Server 2008"/><category term="SQL Server 2000"/><category term="vtigerCRM"/><category term="PostgreSQL Tip"/><category term="Oracle Test"/><category term="PostgreSQL Query"/><category term="Project Server 2007"/><category term="OpenERP"/><category term="EPM"/><category term="PostgreSQL Quiz"/><category term="SharePoint"/><category term="SQL Tips"/><category term="Access"/><category term="linked server"/><category term="My OpenERP Setting"/><category term="OpenERP:HRM"/><category term="Quiz"/><category term="SharePoint Designer"/><category term="Video"/><category term="Agile"/><category term="Backup"/><category term="CLR"/><category term="MySQL Quiz"/><category term="Project Management"/><category term="SCRUM"/><category term="SOQL"/><category term="Salesforce Object Query Language"/><category term="Active Directory"/><category term="Administration"/><category term="Check"/><category term="DB2"/><category term="Domain Controller"/><category term="FI"/><category term="FICO"/><category term="Fun"/><category term="Gadget"/><category term="Management"/><category term="My Oracle Setting"/><category term="News"/><category term="Online database"/><category term="OpenERP:CRM"/><category term="Pligg"/><category term="Python"/><category term="Restore"/><category term="SAP"/><category term="SQLite"/><category term="Salesforce"/><category term="Security"/><category term="Virtual Machine"/><category term="VirtualBox"/><category term="YQL"/><category term="psql"/><title type='text'>Database Knowledge</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://dbaknowledge.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://dbaknowledge.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Richard Trương</name><uri>http://www.blogger.com/profile/04936460665153762540</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWCu2JfmfS1EpmWouwb5HaKbyXRgHuYtX8_caCMKjBFpENi-6h7xaqVRo7I5OaeUjaw2y9c0YwOCetqEFZd7_kzNFmpuOZmjIE-EAY8B_W74Z5Wl2O5dT1jI8ZDhbCQ/s220/Image002.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>390</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1948920108711213708.post-5573604872116816336</id><published>2015-04-12T21:55:00.001-07:00</published><updated>2015-04-12T21:55:45.383-07:00</updated><title type='text'>Life Quote</title><content type='html'>&lt;a href=&quot;http://languagexyz.appspot.com/LifeQuote&quot;&gt;Life Quote&lt;/a&gt;: The difficulties, hardships and trials of life, the obstacles...are positive blessings. They knit the muscles more firmly, and teach self-reliance. ~ William Matthews</content><link rel='replies' type='application/atom+xml' href='http://dbaknowledge.blogspot.com/feeds/5573604872116816336/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbaknowledge.blogspot.com/2015/04/life-quote.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/5573604872116816336'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/5573604872116816336'/><link rel='alternate' type='text/html' href='http://dbaknowledge.blogspot.com/2015/04/life-quote.html' title='Life Quote'/><author><name>Richard Trương</name><uri>http://www.blogger.com/profile/04936460665153762540</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWCu2JfmfS1EpmWouwb5HaKbyXRgHuYtX8_caCMKjBFpENi-6h7xaqVRo7I5OaeUjaw2y9c0YwOCetqEFZd7_kzNFmpuOZmjIE-EAY8B_W74Z5Wl2O5dT1jI8ZDhbCQ/s220/Image002.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1948920108711213708.post-2017237591914129381</id><published>2015-04-10T08:59:00.002-07:00</published><updated>2015-04-10T08:59:43.499-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="FI"/><category scheme="http://www.blogger.com/atom/ns#" term="FICO"/><category scheme="http://www.blogger.com/atom/ns#" term="Gadget"/><category scheme="http://www.blogger.com/atom/ns#" term="SAP"/><title type='text'>SAP FI Practice</title><content type='html'>If you are working with SAP in the module FICO, you can use this one to practice &lt;a href=&quot;http://languagexyz.appspot.com/sapfi&quot;&gt;http://languagexyz.appspot.com/sapfi&lt;/a&gt;&lt;br /&gt;
It looks like the following and you can run on your smartphone or tablet.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;http://languagexyz.appspot.com/images/SAPFI.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://languagexyz.appspot.com/images/SAPFI.png&quot; height=&quot;640&quot; width=&quot;392&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbaknowledge.blogspot.com/feeds/2017237591914129381/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbaknowledge.blogspot.com/2015/04/sap-fi-practice.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/2017237591914129381'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/2017237591914129381'/><link rel='alternate' type='text/html' href='http://dbaknowledge.blogspot.com/2015/04/sap-fi-practice.html' title='SAP FI Practice'/><author><name>Richard Trương</name><uri>http://www.blogger.com/profile/04936460665153762540</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWCu2JfmfS1EpmWouwb5HaKbyXRgHuYtX8_caCMKjBFpENi-6h7xaqVRo7I5OaeUjaw2y9c0YwOCetqEFZd7_kzNFmpuOZmjIE-EAY8B_W74Z5Wl2O5dT1jI8ZDhbCQ/s220/Image002.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1948920108711213708.post-546274332621514376</id><published>2014-02-22T20:19:00.001-08:00</published><updated>2014-02-22T20:22:21.897-08:00</updated><title type='text'>Better Decisions with Smarter Data | MIT Sloan Management Review</title><content type='html'>&lt;a href=&quot;http://sloanreview.mit.edu/article/better-decisions-with-smarter-data/?utm_source=facebook&amp;amp;utm_medium=social&amp;amp;utm_campaign=sm-direct&quot;&gt;Better Decisions with Smarter Data | MIT Sloan Management Review&lt;/a&gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;b&gt;Accurate &lt;/b&gt;– data must be what it says it is with enough precision to drive value. Data quality matters.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Actionable &lt;/b&gt;– data must drive an immediate scalable action in a way that maximizes a business objective like media reach across platforms. Scalable action matters.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Agile &lt;/b&gt;– data must be available in real-time and ready to adapt to the changing business environment. Flexibility matters.&lt;/li&gt;
&lt;/ol&gt;
</content><link rel='replies' type='application/atom+xml' href='http://dbaknowledge.blogspot.com/feeds/546274332621514376/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbaknowledge.blogspot.com/2014/02/better-decisions-with-smarter-data-mit.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/546274332621514376'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/546274332621514376'/><link rel='alternate' type='text/html' href='http://dbaknowledge.blogspot.com/2014/02/better-decisions-with-smarter-data-mit.html' title='Better Decisions with Smarter Data | MIT Sloan Management Review'/><author><name>Richard Trương</name><uri>http://www.blogger.com/profile/04936460665153762540</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWCu2JfmfS1EpmWouwb5HaKbyXRgHuYtX8_caCMKjBFpENi-6h7xaqVRo7I5OaeUjaw2y9c0YwOCetqEFZd7_kzNFmpuOZmjIE-EAY8B_W74Z5Wl2O5dT1jI8ZDhbCQ/s220/Image002.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1948920108711213708.post-5579493032824868403</id><published>2014-01-22T07:36:00.001-08:00</published><updated>2014-01-22T07:36:51.999-08:00</updated><title type='text'>Agile Principles and Values, by Jeff Sutherland</title><content type='html'>&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/dd997578.aspx&quot;&gt;Agile Principles and Values, by Jeff Sutherland&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbaknowledge.blogspot.com/feeds/5579493032824868403/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbaknowledge.blogspot.com/2014/01/agile-principles-and-values-by-jeff.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/5579493032824868403'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/5579493032824868403'/><link rel='alternate' type='text/html' href='http://dbaknowledge.blogspot.com/2014/01/agile-principles-and-values-by-jeff.html' title='Agile Principles and Values, by Jeff Sutherland'/><author><name>Richard Trương</name><uri>http://www.blogger.com/profile/04936460665153762540</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWCu2JfmfS1EpmWouwb5HaKbyXRgHuYtX8_caCMKjBFpENi-6h7xaqVRo7I5OaeUjaw2y9c0YwOCetqEFZd7_kzNFmpuOZmjIE-EAY8B_W74Z5Wl2O5dT1jI8ZDhbCQ/s220/Image002.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1948920108711213708.post-3428992967845362527</id><published>2013-01-01T08:48:00.000-08:00</published><updated>2013-01-01T08:48:37.403-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="DBA Tasks"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Query"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Tip"/><title type='text'>PostgreSQL: Replace multiple spaces with one</title><content type='html'>If you want to use a single query to replace multiple spaces with one on SQL Server, you can read the articles here http://www.sqlservercentral.com/articles/T-SQL/68378/&lt;br /&gt;
However, it&#39;s very simple in PostgreSQL by using Regular Expression&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;b&gt;SELECT &lt;/b&gt;&lt;/span&gt;regexp_replace(&#39;This&amp;nbsp;&amp;nbsp;&amp;nbsp; sentence&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; contains&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; multiple&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; spaces&#39;, &#39;\s+&#39;, &#39; &#39;, &#39;g&#39;);&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbaknowledge.blogspot.com/feeds/3428992967845362527/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbaknowledge.blogspot.com/2013/01/postgresql-replace-multiple-spaces-with.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/3428992967845362527'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/3428992967845362527'/><link rel='alternate' type='text/html' href='http://dbaknowledge.blogspot.com/2013/01/postgresql-replace-multiple-spaces-with.html' title='PostgreSQL: Replace multiple spaces with one'/><author><name>Richard Trương</name><uri>http://www.blogger.com/profile/04936460665153762540</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWCu2JfmfS1EpmWouwb5HaKbyXRgHuYtX8_caCMKjBFpENi-6h7xaqVRo7I5OaeUjaw2y9c0YwOCetqEFZd7_kzNFmpuOZmjIE-EAY8B_W74Z5Wl2O5dT1jI8ZDhbCQ/s220/Image002.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1948920108711213708.post-839851971148470784</id><published>2012-12-30T20:08:00.004-08:00</published><updated>2012-12-30T20:08:53.717-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="DBA Tasks"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Query"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Tip"/><title type='text'>PostgreSQL - Copy CSV to table with psql - part 2</title><content type='html'>&lt;br /&gt;
&lt;pre&gt;&lt;span style=&quot;color: blue;&quot;&gt;CREATE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;TABLE&lt;/span&gt; tbl_test
(
 a text,
 b text,
 c text
)
&lt;/pre&gt;
Content of test.csv, and it put in /Database folder&lt;br /&gt;&lt;i&gt;
a1,b1,c1&lt;br /&gt;
a2,b2,c2&lt;br /&gt;
a3,b3,c3&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;Instead of using COPY command directly, you can modify the test.cvs file to include it, as&lt;br /&gt;
&lt;i&gt;COPY tbl_test FROM STDIN WITH CSV;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;a1,b1,c1&lt;br /&gt;a2,b2,c2&lt;br /&gt;a3,b3,c3&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;\.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Note that you have to include a carriage return in the last line of the file (after &#39;\.&#39;)&lt;br /&gt;
Then, run the following command to import&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;code-java&quot;&gt;MyComputer$ psql -h localhost -p 5432 -U postgres testdb -f ~/Database/test.csv&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://dbaknowledge.blogspot.com/feeds/839851971148470784/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbaknowledge.blogspot.com/2012/12/postgresql-copy-csv-to-table-with-psql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/839851971148470784'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/839851971148470784'/><link rel='alternate' type='text/html' href='http://dbaknowledge.blogspot.com/2012/12/postgresql-copy-csv-to-table-with-psql.html' title='PostgreSQL - Copy CSV to table with psql - part 2'/><author><name>Richard Trương</name><uri>http://www.blogger.com/profile/04936460665153762540</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWCu2JfmfS1EpmWouwb5HaKbyXRgHuYtX8_caCMKjBFpENi-6h7xaqVRo7I5OaeUjaw2y9c0YwOCetqEFZd7_kzNFmpuOZmjIE-EAY8B_W74Z5Wl2O5dT1jI8ZDhbCQ/s220/Image002.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1948920108711213708.post-1947923665577149594</id><published>2012-12-13T07:41:00.002-08:00</published><updated>2012-12-13T07:41:47.778-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Backup"/><category scheme="http://www.blogger.com/atom/ns#" term="DBA Tasks"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Query"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Tip"/><title type='text'>PostgreSQL - Copy database</title><content type='html'>Sometimes, instead of back up and restore to a new db and wait your time if you only want to copy a database and put in the same server, you can use the following query:&lt;br /&gt;
&lt;pre&gt;&lt;span style=&quot;color: blue;&quot;&gt;CREATE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;DATABASE&lt;/span&gt; newdb &lt;span style=&quot;color: blue;&quot;&gt;WITH TEMPLATE &lt;/span&gt;originaldb OWNER dbuser;&lt;/pre&gt;
Note that this query only successfully if no sessions existing in originaldb. So, you can check originaldb sessions and kill them with this function &lt;b&gt;pg_terminate_backend(procpid)&lt;/b&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbaknowledge.blogspot.com/feeds/1947923665577149594/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbaknowledge.blogspot.com/2012/12/postgresql-copy-database.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/1947923665577149594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/1947923665577149594'/><link rel='alternate' type='text/html' href='http://dbaknowledge.blogspot.com/2012/12/postgresql-copy-database.html' title='PostgreSQL - Copy database'/><author><name>Richard Trương</name><uri>http://www.blogger.com/profile/04936460665153762540</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWCu2JfmfS1EpmWouwb5HaKbyXRgHuYtX8_caCMKjBFpENi-6h7xaqVRo7I5OaeUjaw2y9c0YwOCetqEFZd7_kzNFmpuOZmjIE-EAY8B_W74Z5Wl2O5dT1jI8ZDhbCQ/s220/Image002.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1948920108711213708.post-9414850205725198</id><published>2012-12-13T06:43:00.003-08:00</published><updated>2012-12-13T06:43:59.981-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="DBA Tasks"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Query"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Tip"/><title type='text'>PostgreSQL - Kill idle processes</title><content type='html'>Sometimes, you need to kill all unnecessary processes running on your database server. You can do that by using the following query:
&lt;br /&gt;
&lt;pre&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp;procpid,
&amp;nbsp; &amp;nbsp;(
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; pg_terminate_backend(procpid)
&amp;nbsp; &amp;nbsp;) &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; killed
&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; pg_stat_activity
&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt; current_query &lt;span style=&quot;color: blue;&quot;&gt;LIKE&lt;/span&gt; &#39;%idle%&#39; &lt;span style=&quot;color: blue;&quot;&gt;AND&lt;/span&gt; datname = &#39;YourDBName&#39;;
&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://dbaknowledge.blogspot.com/feeds/9414850205725198/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbaknowledge.blogspot.com/2012/12/postgresql-kill-idle-processes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/9414850205725198'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/9414850205725198'/><link rel='alternate' type='text/html' href='http://dbaknowledge.blogspot.com/2012/12/postgresql-kill-idle-processes.html' title='PostgreSQL - Kill idle processes'/><author><name>Richard Trương</name><uri>http://www.blogger.com/profile/04936460665153762540</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWCu2JfmfS1EpmWouwb5HaKbyXRgHuYtX8_caCMKjBFpENi-6h7xaqVRo7I5OaeUjaw2y9c0YwOCetqEFZd7_kzNFmpuOZmjIE-EAY8B_W74Z5Wl2O5dT1jI8ZDhbCQ/s220/Image002.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1948920108711213708.post-4717468203531425761</id><published>2012-12-09T07:54:00.000-08:00</published><updated>2012-12-09T07:54:01.952-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Query"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Tip"/><category scheme="http://www.blogger.com/atom/ns#" term="psql"/><title type='text'>PostgreSQL - Copy csv file to table with psql</title><content type='html'>&lt;pre&gt;&lt;span style=&quot;color: blue;&quot;&gt;CREATE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;TABLE&lt;/span&gt; tbl_test
(
 a text,
 b text,
 c text
)
&lt;/pre&gt;
Content of test.csv&lt;br /&gt;
a1,b1,c1&lt;br /&gt;
a2,b2,c2&lt;br /&gt;
a3,b3,c3&lt;br /&gt;
&lt;br /&gt;
psql to COPY&lt;br /&gt;
psql -h localhost -U postgres testdb&lt;br /&gt;
testdb=# COPY tbl_test FROM &#39;D:\Temp\test.csv&#39; WITH DELIMITER &#39;,&#39; CSV;&amp;nbsp; </content><link rel='replies' type='application/atom+xml' href='http://dbaknowledge.blogspot.com/feeds/4717468203531425761/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbaknowledge.blogspot.com/2012/12/postgresql-copy-csv-file-to-table-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/4717468203531425761'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/4717468203531425761'/><link rel='alternate' type='text/html' href='http://dbaknowledge.blogspot.com/2012/12/postgresql-copy-csv-file-to-table-with.html' title='PostgreSQL - Copy csv file to table with psql'/><author><name>Richard Trương</name><uri>http://www.blogger.com/profile/04936460665153762540</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWCu2JfmfS1EpmWouwb5HaKbyXRgHuYtX8_caCMKjBFpENi-6h7xaqVRo7I5OaeUjaw2y9c0YwOCetqEFZd7_kzNFmpuOZmjIE-EAY8B_W74Z5Wl2O5dT1jI8ZDhbCQ/s220/Image002.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1948920108711213708.post-1013623438600477959</id><published>2012-12-09T06:35:00.003-08:00</published><updated>2012-12-09T06:35:50.341-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Query"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Quiz"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Tip"/><title type='text'>PostgreSQL - VACUUM ANALYZE EXPLAIN NOTIFY</title><content type='html'>Select the correct statement that records the space occupied by deleted or updated rows for later reuse, and also updates statistics. &lt;br /&gt;&lt;br /&gt;A. VACUUM &lt;br /&gt;B. VACUUM ANALYZE &lt;br /&gt;C. EXPLAIN &lt;br /&gt;D. EXPLAIN ANALYZE &lt;br /&gt;E. NOTIFY&lt;br /&gt;
F. None of the above &lt;br /&gt;
&lt;br /&gt;
Answer: &lt;span style=&quot;color: white;&quot;&gt;[B]&lt;/span&gt;&lt;br /&gt;
Highlight to find out the answer.</content><link rel='replies' type='application/atom+xml' href='http://dbaknowledge.blogspot.com/feeds/1013623438600477959/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbaknowledge.blogspot.com/2012/12/postgresql-vacuum-analyze-explain-notify.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/1013623438600477959'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/1013623438600477959'/><link rel='alternate' type='text/html' href='http://dbaknowledge.blogspot.com/2012/12/postgresql-vacuum-analyze-explain-notify.html' title='PostgreSQL - VACUUM ANALYZE EXPLAIN NOTIFY'/><author><name>Richard Trương</name><uri>http://www.blogger.com/profile/04936460665153762540</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWCu2JfmfS1EpmWouwb5HaKbyXRgHuYtX8_caCMKjBFpENi-6h7xaqVRo7I5OaeUjaw2y9c0YwOCetqEFZd7_kzNFmpuOZmjIE-EAY8B_W74Z5Wl2O5dT1jI8ZDhbCQ/s220/Image002.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1948920108711213708.post-46398911773261839</id><published>2012-12-09T06:15:00.000-08:00</published><updated>2012-12-09T06:15:28.662-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Query"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Quiz"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Tip"/><title type='text'>PostgreSQL - ANALYZE quiz</title><content type='html'>What does the following command do?&lt;br /&gt;
Choose the correct answer below. &lt;br /&gt;Note: &quot;psql=#&quot; is the command prompt for psql. &lt;br /&gt;psql=# ANALYZE xyz; &lt;br /&gt;&lt;br /&gt;A. Collects statistical information related to the content of the database xyz. &lt;br /&gt;B. Collects statistical information related to the content of the table xyz. &lt;br /&gt;C. Outputs statistical information related to the content of the table xyz. &lt;br /&gt;D. No ANALYZE command in PostgreSQL, error will occur. &lt;br /&gt;E. None of the above&lt;br /&gt;
F. Both B &amp;amp; C&lt;br /&gt;
&lt;br /&gt;
Answer: &lt;span style=&quot;color: white;&quot;&gt;[B]&lt;/span&gt;&lt;br /&gt;
Highlight to find out the answer.</content><link rel='replies' type='application/atom+xml' href='http://dbaknowledge.blogspot.com/feeds/46398911773261839/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbaknowledge.blogspot.com/2012/12/postgresql-analyze-quiz.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/46398911773261839'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/46398911773261839'/><link rel='alternate' type='text/html' href='http://dbaknowledge.blogspot.com/2012/12/postgresql-analyze-quiz.html' title='PostgreSQL - ANALYZE quiz'/><author><name>Richard Trương</name><uri>http://www.blogger.com/profile/04936460665153762540</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWCu2JfmfS1EpmWouwb5HaKbyXRgHuYtX8_caCMKjBFpENi-6h7xaqVRo7I5OaeUjaw2y9c0YwOCetqEFZd7_kzNFmpuOZmjIE-EAY8B_W74Z5Wl2O5dT1jI8ZDhbCQ/s220/Image002.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1948920108711213708.post-9187139306990320466</id><published>2012-12-07T09:14:00.001-08:00</published><updated>2012-12-07T09:49:22.811-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Query"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Tip"/><title type='text'>PostgreSQL – Convert rows to string</title><content type='html'>&lt;pre&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; array_to_string(
    array(
        &lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; name
        &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; pg_settings
        &lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt; setting = &#39;off&#39; &lt;span style=&quot;color: blue;&quot;&gt;AND&lt;/span&gt; context = &#39;postmaster&#39;
    ), &#39;,&#39;);

&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; setting, array_to_string(array_agg(name), &#39;,&#39;)
&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; pg_settings
&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt; setting &lt;span style=&quot;color: blue;&quot;&gt;IN&lt;/span&gt; (&#39;on&#39;, &#39;off&#39;)
&lt;span style=&quot;color: blue;&quot;&gt;GROUP&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;BY&lt;/span&gt; setting;
&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://dbaknowledge.blogspot.com/feeds/9187139306990320466/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbaknowledge.blogspot.com/2012/12/postgresql-convert-rows-to-string_7.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/9187139306990320466'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/9187139306990320466'/><link rel='alternate' type='text/html' href='http://dbaknowledge.blogspot.com/2012/12/postgresql-convert-rows-to-string_7.html' title='PostgreSQL – Convert rows to string'/><author><name>Richard Trương</name><uri>http://www.blogger.com/profile/04936460665153762540</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWCu2JfmfS1EpmWouwb5HaKbyXRgHuYtX8_caCMKjBFpENi-6h7xaqVRo7I5OaeUjaw2y9c0YwOCetqEFZd7_kzNFmpuOZmjIE-EAY8B_W74Z5Wl2O5dT1jI8ZDhbCQ/s220/Image002.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1948920108711213708.post-1102252326950215710</id><published>2012-11-24T09:02:00.002-08:00</published><updated>2012-11-24T09:02:50.016-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="DBA Tasks"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Query"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Tip"/><title type='text'>PostgreSQL - Query data from another database/server</title><content type='html'>Assume that, you have two databases:&lt;br /&gt;
1. db1 with two schemas: public and sch1&lt;br /&gt;
2. db2 with two schemas: public and sch2&lt;br /&gt;
&lt;br /&gt;
In PostgreSQL, you can access a table from a different schema by using SELECT * FROM schema_name.table_name such as SELECT * FROM db1_sch.employee;&lt;br /&gt;
However, you cannot access a table on the different database with explicit way like SELECT * FROM db2.sch2.employee;&lt;br /&gt;
&lt;br /&gt;
The question is how can we access like SQL Server or some other DBMS.&lt;br /&gt;
Fortunately, PostgreSQL support dblink to do that.&lt;br /&gt;
&lt;br /&gt;
First, install extension dblink on the database you want to be able to access to other&lt;br /&gt;
CREATE EXTENSION dblink;&lt;br /&gt;
&lt;br /&gt;
If db2 is in the same server, you can query table in db2 like that:&lt;br /&gt;
SELECT *&lt;br /&gt;
FROM dblink(&#39;dbname=db2&#39;, &#39;SELECT employee_id, employee_name FROM sch2.employee&#39;)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AS employee(employee_id integer, employee_name text);&lt;br /&gt;
&lt;br /&gt;
If db2 is in the different server, you can query:&lt;br /&gt;
SELECT *&lt;br /&gt;
FROM dblink(&#39;hostaddr=172.x.x.x dbname=db2 user=admin password=pwd port=5432&#39;, &#39;SELECT employee_id, employee_name FROM sch2.employee&#39;)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AS employee(employee_id integer, employee_name text);</content><link rel='replies' type='application/atom+xml' href='http://dbaknowledge.blogspot.com/feeds/1102252326950215710/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbaknowledge.blogspot.com/2012/11/postgresql-query-data-from-another.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/1102252326950215710'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/1102252326950215710'/><link rel='alternate' type='text/html' href='http://dbaknowledge.blogspot.com/2012/11/postgresql-query-data-from-another.html' title='PostgreSQL - Query data from another database/server'/><author><name>Richard Trương</name><uri>http://www.blogger.com/profile/04936460665153762540</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWCu2JfmfS1EpmWouwb5HaKbyXRgHuYtX8_caCMKjBFpENi-6h7xaqVRo7I5OaeUjaw2y9c0YwOCetqEFZd7_kzNFmpuOZmjIE-EAY8B_W74Z5Wl2O5dT1jI8ZDhbCQ/s220/Image002.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1948920108711213708.post-6615954237117938685</id><published>2012-11-05T07:20:00.001-08:00</published><updated>2012-11-05T07:25:01.704-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="DBA Tasks"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Query"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Tip"/><title type='text'>PostgreSQL - get table structure</title><content type='html'>&lt;span style=&quot;color: blue&quot;&gt;SELECT&lt;/span&gt; ordinal_position  &lt;br /&gt; , column_name   &lt;br /&gt;, &lt;span style=&quot;color: blue&quot;&gt;CASE&lt;/span&gt; data_type &lt;span style=&quot;color: blue&quot;&gt;WHEN&lt;/span&gt; &#39;character varying&#39; &lt;span style=&quot;color: blue&quot;&gt;THEN&lt;/span&gt; data_type || &#39;(&#39;||character_maximum_length || &#39;)&#39; &lt;span style=&quot;color: blue&quot;&gt;ELSE&lt;/span&gt; data_type &lt;span style=&quot;color: blue&quot;&gt;END&lt;/span&gt; data_type  &lt;br /&gt; , column_default   &lt;br /&gt;, is_nullable   &lt;br /&gt;, character_maximum_length   &lt;br /&gt;, numeric_precision   &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;FROM&lt;/span&gt; information_schema.columns   &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;WHERE&lt;/span&gt; table_catalog = &#39;database_name&#39;   &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;AND&lt;/span&gt; table_schema = &#39;schema_name&#39;   &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;AND&lt;/span&gt; table_name = &#39;table_name&#39;   &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;ORDER&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;BY&lt;/span&gt; ordinal_position;     </content><link rel='replies' type='application/atom+xml' href='http://dbaknowledge.blogspot.com/feeds/6615954237117938685/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbaknowledge.blogspot.com/2012/11/postgresql-get-table-structure.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/6615954237117938685'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/6615954237117938685'/><link rel='alternate' type='text/html' href='http://dbaknowledge.blogspot.com/2012/11/postgresql-get-table-structure.html' title='PostgreSQL - get table structure'/><author><name>Richard Trương</name><uri>http://www.blogger.com/profile/04936460665153762540</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWCu2JfmfS1EpmWouwb5HaKbyXRgHuYtX8_caCMKjBFpENi-6h7xaqVRo7I5OaeUjaw2y9c0YwOCetqEFZd7_kzNFmpuOZmjIE-EAY8B_W74Z5Wl2O5dT1jI8ZDhbCQ/s220/Image002.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1948920108711213708.post-3670801313029643928</id><published>2012-10-19T01:02:00.001-07:00</published><updated>2012-10-19T01:03:39.443-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="DBA Tasks"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Query"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Tip"/><title type='text'>PostgreSQL: check the core settings of server</title><content type='html'>&lt;p&gt;&lt;span style=&quot;color: blue&quot;&gt;SELECT&lt;/span&gt; name, context, unit, setting, short_desc &lt;/p&gt;  &lt;p&gt;&lt;span style=&quot;color: blue&quot;&gt;FROM&lt;/span&gt; pg_settings &lt;/p&gt;  &lt;p&gt;&lt;span style=&quot;color: blue&quot;&gt;WHERE&lt;/span&gt; name in (&#39;listen_addresses&#39; ,&#39;max_connections&#39; ,&#39;shared_buffers&#39; ,&#39;effective_cache_size&#39; , &#39;work_mem&#39; , &#39;maintenance_work_mem&#39;) &lt;/p&gt;  &lt;p&gt;&lt;span style=&quot;color: blue&quot;&gt;ORDER&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;BY&lt;/span&gt; context,name; &lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvT7kjv5Zcyo5XqGBEzS4HOm2j36Zzwc0ejJ6SBI-QzTi0hAGxVE8ByG_slk-Emp6KCZPyXy4y88RCasHF0F9hvJ4RoPGTPMmQ-qhEgsZZc6UvvJRR-XjWCtWWDOpBrk9EhyphenhyphentUnWNf9WBY/s1600-h/image%25255B3%25255D.png&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwramqeTmgq_FaEVcylTqLsuY0sX0HLj0ajgjUTAWcJyVVbK3RBxWzZu945OOELRAM_mnvVdUB0-3T92OdIleXoq2cudoZ-EhzE0EXzdVfli1t3YVBMZ0QiK031KoMTDALZadnzRRZe4ZO/?imgmax=800&quot; width=&quot;613&quot; height=&quot;131&quot; /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;If &lt;strong&gt;context&lt;/strong&gt; is set to &lt;strong&gt;&lt;em&gt;postmaster&lt;/em&gt;&lt;/strong&gt;, it means changing this parameter requires a restart of the postgresql service. If &lt;strong&gt;context&lt;/strong&gt; is set to user, changes require at least a reload. Furthermore, these settings can be&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; overridden at the database, user, session, or function levels.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;unit&lt;/strong&gt; tells you the unit of measurement that the setting is reported in. This is very important for memory settings since, as you can see, some are reported in 8 kB and some in kB&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://dbaknowledge.blogspot.com/feeds/3670801313029643928/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbaknowledge.blogspot.com/2012/10/postgresql-check-core-settings-of-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/3670801313029643928'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/3670801313029643928'/><link rel='alternate' type='text/html' href='http://dbaknowledge.blogspot.com/2012/10/postgresql-check-core-settings-of-server.html' title='PostgreSQL: check the core settings of server'/><author><name>Richard Trương</name><uri>http://www.blogger.com/profile/04936460665153762540</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWCu2JfmfS1EpmWouwb5HaKbyXRgHuYtX8_caCMKjBFpENi-6h7xaqVRo7I5OaeUjaw2y9c0YwOCetqEFZd7_kzNFmpuOZmjIE-EAY8B_W74Z5Wl2O5dT1jI8ZDhbCQ/s220/Image002.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwramqeTmgq_FaEVcylTqLsuY0sX0HLj0ajgjUTAWcJyVVbK3RBxWzZu945OOELRAM_mnvVdUB0-3T92OdIleXoq2cudoZ-EhzE0EXzdVfli1t3YVBMZ0QiK031KoMTDALZadnzRRZe4ZO/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1948920108711213708.post-2413506562543644931</id><published>2012-10-18T00:36:00.001-07:00</published><updated>2012-10-18T00:37:16.420-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="DBA Tasks"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Tip"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Tips"/><title type='text'>PosgreSQL: get main configuration files</title><content type='html'>&lt;span style=&quot;color: blue&quot;&gt;SELECT&lt;/span&gt; name, setting &lt;span style=&quot;color: blue&quot;&gt;FROM&lt;/span&gt; pg_settings &lt;span style=&quot;color: blue&quot;&gt;WHERE&lt;/span&gt; category = &#39;File Locations&#39;;   &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgguakMnME4AeXonkt_NP0FkymYuVw-_EUnshbywAJBw5gZ2IaPPoNnBgnk8gSh74xlM0bX58USIfhdVAhfA20k9MzHosDX9bzbB2uSngKs3mtcpipZDU0X2NDLem4BOOG9MkUeVnYyl2gN/s1600-h/image%25255B4%25255D.png&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlawOfKUk62Aq4o6JoAzT0HsSHm1RRBLgQLMhH8tJBccVLpGS5yPJJU3r4BTbRpcA-_0iHfaAHjUnNxJbNcKz3HqNYTfYdewtdG4OH_Vbijw4IsTJCs8fRULGpDMGU1OuY3EsidyH0e-tA/?imgmax=800&quot; width=&quot;447&quot; height=&quot;113&quot; /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;postgresql.conf&lt;/strong&gt; controls general settings, such as how much memory to allocate, default storage location for new databases, which IPs PostgreSQL listens on, where logs are stored, and so forth.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;pg_hba.conf&lt;/strong&gt; controls security. It manages access to the server, dictating which users can login into which databases, which IPs or groups of IPs are permitted to connect and the authentication scheme expected.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;pg_ident.conf&lt;/strong&gt; is the mapping file that maps an authenticated OS login to a PostgreSQL user. This file is used less often, but allows you to map a server account to a PostgreSQL account. For example, people sometimes map the OS root account to the postgre’s super user account. Each authentication line in pg_hba.conf can use a different pg_ident.conf file&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://dbaknowledge.blogspot.com/feeds/2413506562543644931/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbaknowledge.blogspot.com/2012/10/posgresql-get-main-configuration-files.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/2413506562543644931'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/2413506562543644931'/><link rel='alternate' type='text/html' href='http://dbaknowledge.blogspot.com/2012/10/posgresql-get-main-configuration-files.html' title='PosgreSQL: get main configuration files'/><author><name>Richard Trương</name><uri>http://www.blogger.com/profile/04936460665153762540</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWCu2JfmfS1EpmWouwb5HaKbyXRgHuYtX8_caCMKjBFpENi-6h7xaqVRo7I5OaeUjaw2y9c0YwOCetqEFZd7_kzNFmpuOZmjIE-EAY8B_W74Z5Wl2O5dT1jI8ZDhbCQ/s220/Image002.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlawOfKUk62Aq4o6JoAzT0HsSHm1RRBLgQLMhH8tJBccVLpGS5yPJJU3r4BTbRpcA-_0iHfaAHjUnNxJbNcKz3HqNYTfYdewtdG4OH_Vbijw4IsTJCs8fRULGpDMGU1OuY3EsidyH0e-tA/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1948920108711213708.post-6838655873498610158</id><published>2012-10-17T23:39:00.001-07:00</published><updated>2012-10-17T23:39:29.301-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Quiz"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Tip"/><category scheme="http://www.blogger.com/atom/ns#" term="Quiz"/><title type='text'>PostgreSQL quiz: stored procedure execution</title><content type='html'>&lt;p&gt;Assume that you have a table contact and a stored procedure called insert_contact as the following screenshots&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJNJcC9LiZsJGPFV_2Qps4UGMv7uETJGrlaBHxI9mge10RyrAFEGe0NVxpJGPAjxSU3eYXX5zYHuc1_5BO9KgjpAfwEBwzLaVPx4Mc1bnhIpZEOtQSAAsNsAZl9XYsH9T_RGZNwJw3nwUV/s1600-h/image%25255B6%25255D.png&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9t6rGJcF1lE5XSyiL9ph8pykTHzCTVjOfMhm6dCv7WX3WhFrg_XNVPaNtNBw1YngFdmBA02yGSDTXQG2oRHxfmas7mEM5tKyHalpwCGdwiQqMOKtvdf_8qgR0BrR7Xmr3PXz4ExUzjhm4/?imgmax=800&quot; width=&quot;239&quot; height=&quot;100&quot; /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZMeDaEISNJJ-Y6OfK6jPDQMzdSt7fOdFBcd2Vp4p6emkpZLDEwaM2w0-QbWW7ssNdIwFmzbvZQD9HlKZl8uk0SLJPEGiSuOlXgGaLjgz1ehqY1KiahUu336JhyphenhyphenRRbxUc9fWzW0ji7RPwG/s1600-h/image%25255B3%25255D.png&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhemQy2Mu-RDhRsfvIb33yLEUDaMV-KKxUPLWQQRaBZz6RxCec2pggqDNsnJZ4gZr7UYjslYWz5AREFLJ1cbqdkOufzpdWOgDpo8nz0Ct26Ib0s-sso9BLZv4pONiiJ5QLyCE0vs5j0KIZI/?imgmax=800&quot; width=&quot;368&quot; height=&quot;106&quot; /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Which one below is correct?&lt;/p&gt;  &lt;p&gt;A. CALL insert_contact(‘John’,&#39;Tran’);&lt;/p&gt;  &lt;p&gt;B. EXECUTE insert_contact(‘John’,’Tran’);&lt;/p&gt;  &lt;p&gt;C. SELECT insert_contact(‘John’,’Tran’)&lt;/p&gt;  &lt;p&gt;D. Both A &amp;amp; B&lt;/p&gt;  &lt;p&gt;E. Error in the store procedure code&lt;/p&gt;  &lt;p&gt;F. None of the above&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Answer:&lt;font color=&quot;#ffffff&quot;&gt; [C]&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Highlight to find out the answer.&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://dbaknowledge.blogspot.com/feeds/6838655873498610158/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbaknowledge.blogspot.com/2012/10/postgresql-quiz-stored-procedure.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/6838655873498610158'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/6838655873498610158'/><link rel='alternate' type='text/html' href='http://dbaknowledge.blogspot.com/2012/10/postgresql-quiz-stored-procedure.html' title='PostgreSQL quiz: stored procedure execution'/><author><name>Richard Trương</name><uri>http://www.blogger.com/profile/04936460665153762540</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWCu2JfmfS1EpmWouwb5HaKbyXRgHuYtX8_caCMKjBFpENi-6h7xaqVRo7I5OaeUjaw2y9c0YwOCetqEFZd7_kzNFmpuOZmjIE-EAY8B_W74Z5Wl2O5dT1jI8ZDhbCQ/s220/Image002.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9t6rGJcF1lE5XSyiL9ph8pykTHzCTVjOfMhm6dCv7WX3WhFrg_XNVPaNtNBw1YngFdmBA02yGSDTXQG2oRHxfmas7mEM5tKyHalpwCGdwiQqMOKtvdf_8qgR0BrR7Xmr3PXz4ExUzjhm4/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1948920108711213708.post-8384822932879521173</id><published>2012-10-16T00:44:00.001-07:00</published><updated>2012-10-16T00:44:11.859-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Quiz"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Tip"/><category scheme="http://www.blogger.com/atom/ns#" term="Quiz"/><title type='text'>PostgreSQL license</title><content type='html'>&lt;p&gt;Select the most suitable statement about the PostgreSQL license from below.&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;A. PostgreSQL is distributed under the GPL license.    &lt;br /&gt;B. PostgreSQL is distributed under the PostgreSQL license.    &lt;br /&gt;C. PostgreSQL is distributed under the LGPL license.    &lt;br /&gt;D. PostgreSQL is distributed under the BSD license.    &lt;br /&gt;E. PostgreSQL is distributed under the X11(MIT) license.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Answer:&lt;font color=&quot;#ffffff&quot;&gt; [D]&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Highlight to find out the answer.&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://dbaknowledge.blogspot.com/feeds/8384822932879521173/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbaknowledge.blogspot.com/2012/10/postgresql-license.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/8384822932879521173'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/8384822932879521173'/><link rel='alternate' type='text/html' href='http://dbaknowledge.blogspot.com/2012/10/postgresql-license.html' title='PostgreSQL license'/><author><name>Richard Trương</name><uri>http://www.blogger.com/profile/04936460665153762540</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWCu2JfmfS1EpmWouwb5HaKbyXRgHuYtX8_caCMKjBFpENi-6h7xaqVRo7I5OaeUjaw2y9c0YwOCetqEFZd7_kzNFmpuOZmjIE-EAY8B_W74Z5Wl2O5dT1jI8ZDhbCQ/s220/Image002.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1948920108711213708.post-3969428201039242141</id><published>2012-10-15T22:55:00.001-07:00</published><updated>2012-10-15T23:02:29.890-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="OpenERP"/><category scheme="http://www.blogger.com/atom/ns#" term="OpenERP:CRM"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Tip"/><title type='text'>Convert date time values to string in PostgreSQL</title><content type='html'>&lt;p&gt;&lt;span style=&quot;color: blue&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is a view extracted from OpenERP.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style=&quot;color: blue&quot;&gt;CREATE&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;OR&lt;/span&gt; REPLACE &lt;span style=&quot;color: blue&quot;&gt;VIEW&lt;/span&gt; crm_claim_report     &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;AS&lt;/span&gt;     &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;SELECT&lt;/span&gt; min(c.id) &lt;span style=&quot;color: blue&quot;&gt;AS&lt;/span&gt; id     &lt;br /&gt;, to_char(c.date, &#39;YYYY&#39;::text) &lt;span style=&quot;color: blue&quot;&gt;AS&lt;/span&gt; name     &lt;br /&gt;, to_char(c.date, &#39;MM&#39;::text) &lt;span style=&quot;color: blue&quot;&gt;AS&lt;/span&gt; month     &lt;br /&gt;, to_char(c.date, &#39;YYYY-MM-DD&#39;::text) &lt;span style=&quot;color: blue&quot;&gt;AS&lt;/span&gt; day     &lt;br /&gt;, to_char(c.date_closed, &#39;YYYY-MM-DD&#39;::text) &lt;span style=&quot;color: blue&quot;&gt;AS&lt;/span&gt; date_closed     &lt;br /&gt;, to_char(c.date_deadline::timestamp with time zone, &#39;YYYY-MM-DD&#39;::text) &lt;span style=&quot;color: blue&quot;&gt;AS&lt;/span&gt; date_deadline, c.state, c.user_id     &lt;br /&gt;, c.stage_id, c.section_id, c.partner_id, c.company_id, c.categ_id, count(*) &lt;span style=&quot;color: blue&quot;&gt;AS&lt;/span&gt; nbr, c.priority     &lt;br /&gt;, c.type_action, date_trunc(&#39;day&#39;::text, c.create_date) &lt;span style=&quot;color: blue&quot;&gt;AS&lt;/span&gt; create_date     &lt;br /&gt;, avg(date_part(&#39;epoch&#39;::text, c.date_closed - c.create_date)) / (3600 * 24)::double precision &lt;span style=&quot;color: blue&quot;&gt;AS&lt;/span&gt; delay_close     &lt;br /&gt;, ( &lt;span style=&quot;color: blue&quot;&gt;SELECT&lt;/span&gt; count(mailgate_message.id) &lt;span style=&quot;color: blue&quot;&gt;AS&lt;/span&gt; count &lt;span style=&quot;color: blue&quot;&gt;FROM&lt;/span&gt; mailgate_message     &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;WHERE&lt;/span&gt; mailgate_message.model::text = &#39;crm.claim&#39;::text &lt;span style=&quot;color: blue&quot;&gt;AND&lt;/span&gt; mailgate_message.res_id = c.id &lt;span style=&quot;color: blue&quot;&gt;AND&lt;/span&gt; mailgate_message.history = true) &lt;span style=&quot;color: blue&quot;&gt;AS&lt;/span&gt; email     &lt;br /&gt;, ( &lt;span style=&quot;color: blue&quot;&gt;SELECT&lt;/span&gt; avg(crm_case_stage.probability) &lt;span style=&quot;color: blue&quot;&gt;AS&lt;/span&gt; avg &lt;span style=&quot;color: blue&quot;&gt;FROM&lt;/span&gt; crm_case_stage     &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;WHERE&lt;/span&gt; crm_case_stage.type::text = &#39;claim&#39;::text &lt;span style=&quot;color: blue&quot;&gt;AND&lt;/span&gt; crm_case_stage.id = c.stage_id) &lt;span style=&quot;color: blue&quot;&gt;AS&lt;/span&gt; probability     &lt;br /&gt;, date_part(&#39;epoch&#39;::text, c.date_deadline::timestamp without time zone - c.date_closed) / (3600 * 24)::double precision &lt;span style=&quot;color: blue&quot;&gt;AS&lt;/span&gt; delay_expected     &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;FROM&lt;/span&gt; crm_claim c     &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;GROUP&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;BY&lt;/span&gt; to_char(c.date, &#39;YYYY&#39;::text), to_char(c.date, &#39;MM&#39;::text), to_char(c.date, &#39;YYYY-MM-DD&#39;::text), c.state, c.user_id, c.section_id     &lt;br /&gt;, c.stage_id, c.categ_id, c.partner_id, c.company_id, c.create_date, c.priority, c.type_action, c.date_deadline, c.date_closed, c.id; &lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://dbaknowledge.blogspot.com/feeds/3969428201039242141/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbaknowledge.blogspot.com/2012/10/convert-date-time-values-to-string-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/3969428201039242141'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/3969428201039242141'/><link rel='alternate' type='text/html' href='http://dbaknowledge.blogspot.com/2012/10/convert-date-time-values-to-string-in.html' title='Convert date time values to string in PostgreSQL'/><author><name>Richard Trương</name><uri>http://www.blogger.com/profile/04936460665153762540</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWCu2JfmfS1EpmWouwb5HaKbyXRgHuYtX8_caCMKjBFpENi-6h7xaqVRo7I5OaeUjaw2y9c0YwOCetqEFZd7_kzNFmpuOZmjIE-EAY8B_W74Z5Wl2O5dT1jI8ZDhbCQ/s220/Image002.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1948920108711213708.post-6625942770608902499</id><published>2012-10-14T04:24:00.000-07:00</published><updated>2012-10-14T04:24:02.013-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL Quiz"/><category scheme="http://www.blogger.com/atom/ns#" term="Quiz"/><title type='text'>PostgreSQL Contactenation</title><content type='html'>Which query is correct in PostgreSQL?&lt;br /&gt;
&lt;br /&gt;
A. SELECT &#39;Test&#39; . &#39;query&#39;;&lt;br /&gt;
B. SELECT cat(&#39;Test&#39;,&#39;query&#39;) FROM dual;&lt;br /&gt;
C. SELECT &#39;Test&#39; + &#39;query&#39;;&lt;br /&gt;
D. SELECT &#39;Test&#39; + &#39;query&#39; FROM dual;&lt;br /&gt;
E. SELECT &#39;Test&#39; || &#39;query&#39;;&lt;br /&gt;
&lt;br /&gt;
Answer:&lt;span style=&quot;color: white;&quot;&gt;[E]&lt;/span&gt;&lt;br /&gt;
Highlight to find out the answer.</content><link rel='replies' type='application/atom+xml' href='http://dbaknowledge.blogspot.com/feeds/6625942770608902499/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbaknowledge.blogspot.com/2012/10/postgresql-contactenation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/6625942770608902499'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/6625942770608902499'/><link rel='alternate' type='text/html' href='http://dbaknowledge.blogspot.com/2012/10/postgresql-contactenation.html' title='PostgreSQL Contactenation'/><author><name>Richard Trương</name><uri>http://www.blogger.com/profile/04936460665153762540</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWCu2JfmfS1EpmWouwb5HaKbyXRgHuYtX8_caCMKjBFpENi-6h7xaqVRo7I5OaeUjaw2y9c0YwOCetqEFZd7_kzNFmpuOZmjIE-EAY8B_W74Z5Wl2O5dT1jI8ZDhbCQ/s220/Image002.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1948920108711213708.post-288271863214119399</id><published>2012-10-12T10:51:00.001-07:00</published><updated>2012-10-12T10:51:14.897-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2000"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2005"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2008"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server Tip"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Tips"/><category scheme="http://www.blogger.com/atom/ns#" term="T-SQL"/><title type='text'>Same query for Fiscal and Normal calendar</title><content type='html'>&lt;p&gt;tblFiscalMapping&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZjaTNKWfjVKyZubHP7BDfpSfginM3FtYw6gQgR9iDTRcvO0Wtz98GAZxkvaGO1ZkkNLwTBcs37uZWek1k8A3uTvaNmDShOfyiuJe_FgiyXj3sTJe5mPLqmjTAr7eVnbw58fUGSrGwx6wY/s1600-h/image%25255B3%25255D.png&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEin6BwVSQS4rIf2IN82crRftuXYH0NAOdYKo8WiIuFpY_tH4oxhGafe3zC7EP5af9jQpOIJSh8DzdpWGzVaiVrxl44U-cLfhaBLe8UCCKokqJ9_hSnbDxsAyOVvbQpDBAqDsSMGPck80rI9/?imgmax=800&quot; width=&quot;296&quot; height=&quot;103&quot; /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Assume that you have a mapping table between Fiscal and Normal calendar above.&lt;/p&gt;  &lt;p&gt;Sometimes, you need to write one stored procedure with a param @IsFiscal to determine when to return order info on Fiscal year or Normal calendar year.&lt;/p&gt;  &lt;p&gt;You can implement as the following&lt;/p&gt;  &lt;p&gt;DECLARE @StartMonth SMALLDATETIME;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;DECLARE @EndMonth SMALLDATETIME;&lt;/p&gt;  &lt;p&gt;IF ISNULL(@IsFiscal,0) = 0   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; SELECT @StartMonth = CAST(CAST(@Year AS VARCHAR) + &#39;-01-01&#39; AS SMALLDATETIME);    &lt;br /&gt;ELSE    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; SELECT @StartMonth = CAST(CAST([Year] AS VARCHAR) + &#39;-&#39; + CAST(NormalMonth AS VARCHAR) + &#39;-01&#39; AS SMALLDATETIME)    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; FROM dbo.tblFiscalMapping    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; WHERE FiscalYear = @Year;&lt;/p&gt;  &lt;p&gt;SET @EndMonth = DATEADD(m, 11, @StartMonth);&lt;/p&gt;  &lt;p&gt;SELECT OrderID, OrderNumber, OrderDate, CustomerID, TotalAmount&lt;/p&gt;  &lt;p&gt;FROM dbo.tblOrder&lt;/p&gt;  &lt;p&gt;WHERE DATEDIFF(m, @StartMonth, OrderDate) &amp;gt;= 0   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; AND DATEDIFF(m, @EndMonth, OrderDate) &amp;lt;= 0&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://dbaknowledge.blogspot.com/feeds/288271863214119399/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbaknowledge.blogspot.com/2012/10/same-query-for-fiscal-and-normal.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/288271863214119399'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/288271863214119399'/><link rel='alternate' type='text/html' href='http://dbaknowledge.blogspot.com/2012/10/same-query-for-fiscal-and-normal.html' title='Same query for Fiscal and Normal calendar'/><author><name>Richard Trương</name><uri>http://www.blogger.com/profile/04936460665153762540</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWCu2JfmfS1EpmWouwb5HaKbyXRgHuYtX8_caCMKjBFpENi-6h7xaqVRo7I5OaeUjaw2y9c0YwOCetqEFZd7_kzNFmpuOZmjIE-EAY8B_W74Z5Wl2O5dT1jI8ZDhbCQ/s220/Image002.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEin6BwVSQS4rIf2IN82crRftuXYH0NAOdYKo8WiIuFpY_tH4oxhGafe3zC7EP5af9jQpOIJSh8DzdpWGzVaiVrxl44U-cLfhaBLe8UCCKokqJ9_hSnbDxsAyOVvbQpDBAqDsSMGPck80rI9/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1948920108711213708.post-3661124442813248755</id><published>2012-10-12T08:52:00.001-07:00</published><updated>2012-10-12T08:54:48.457-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Active Directory"/><category scheme="http://www.blogger.com/atom/ns#" term="Domain Controller"/><category scheme="http://www.blogger.com/atom/ns#" term="Virtual Machine"/><category scheme="http://www.blogger.com/atom/ns#" term="VirtualBox"/><title type='text'>Create a Virtual Active Directory Domain Controller with VirtualBox</title><content type='html'>&lt;p&gt;I need to query Active Directory by using SQL Server, so I created virtual Active Directory Domain Controller to do that.&lt;/p&gt;  &lt;p&gt;1. Install Windows Server virtual machine, such as Windows Server 2003&lt;/p&gt;  &lt;p&gt;2. Install Client virtual machine, such as Windows XP&lt;/p&gt;  &lt;p&gt;3. Set up network&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivX-hZrzRhzsREys_Id5TQTyJiMgOMURJANYVR9eWt-_-fNgkX57BWZMUmnRf3rgqpjojqRIqWOi-lEz8gtgwjYHjE37UDRYEBPovObAhm2s0RuyEfM6DlzMaGbTodYnTYncsBbDaD_wQ-/s1600-h/image%25255B4%25255D.png&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzBjzB6OunhzhbqytdHI8Kvh4lnLHBrVAe7nxDyTU_KiW9-oOFnXfFnIVben4MFPdqGLd0gQTF9OMMfRQ67Sz3V_1ZyTrns82cxs84T423wL6-w71PQoOfWtLyrTCjSJCM5QcbObsLX6VJ/?imgmax=800&quot; width=&quot;266&quot; height=&quot;235&quot; /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEga7qhgRtve7hlVn4qxYu57R3cSdMklur3pBZxsylIyYe3RDu-6bhDM93Gl9bIC0M45EW0AGRWpjsZ0StVNOOa0WwY4qXMmfNI-DaK5-tHM7xNrGx9LerojNyorSbD_haQ3jPbxh809MwYg/s1600-h/image%25255B10%25255D.png&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghbYh7VTG-PPVbxa8qNfdvh8GKoexgwS9qbgb3PDNYU6ciI8XnnpydJWeUJeYz_APstNlU1KCkjL5vvesS5ZjNIQjSEO4EmXiIAlAeOkMM7Fz2CSLhtJZNicNhJQP64Kp1Dpbq8o6TziD8/?imgmax=800&quot; width=&quot;451&quot; height=&quot;529&quot; /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;4. Set up new Adapter for each machine, use the adapter set up on Step 3&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxPwxOgsoRJ48i-dELVGz53cxnq0Rkje5Iv6A28KiLr3aOl0gs0J_GLmZNNbWiPXb3YTISTaW6dnE8q6t7SPMxXcbzzFYuW_J0HVZ_XNU_bffoT7H2z5_zHzmH2EfpwNa8nJaiTEthJ91P/s1600-h/image%25255B15%25255D.png&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIMtn90c5rFVfAE_9MKef0r6lJ4JgV2fpA7O_OACcjdZ97_1uOfcypd88wXuyWB13N7XEh1x-4tB8d4FMwp9u30cpuoTvw18acHM3ux3HTo5v4cjFXpSlu79mZ6TrLnFskaAUoogNNbP4d/?imgmax=800&quot; width=&quot;502&quot; height=&quot;374&quot; /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;5. Run Windows Server machine&lt;/p&gt;  &lt;p&gt;6. Install Active Directory by following steps after running &lt;strong&gt;dcpromo&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6uIJ_uWioT-JiDT_4To3sn0v5rQgSb9fZVRRk1Mil_QU8O6aEm3HiOcRV6Izg4eLwLOz8iG5hRVBL0UK5PardjAGbBzkNmp057JdmhSilQEIcb38j8muTJCAVFc3Zu8jDr56MKnLusoZe/s1600-h/image%25255B18%25255D.png&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4auUGT1yMkBnO2vNngcHEcgAi49woVeQWPl3IeihgIQM39TK7NyJQkQDVQSMpvX8UBRPCmZp4WMhvxsw8mhhPJF19_FXTkMGVqUXBsBiWKZ5o9FNAFt6apUgyhmHs7_zWhWu2NFMm3Dce/?imgmax=800&quot; width=&quot;244&quot; height=&quot;132&quot; /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;7. Set up IP Address on Windows Server, note that IP address must be in the range set up in Step 3&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsSEhiT6LUBRtyDEtUt6h_yegm1JhD8J6iJXvW6hhpaXe3B4U-PoSV9t41lo96ZuI6Jha7w7JlUC8JV8Fvfx5dCJiXiAhyphenhyphenYfGISOH0bnCuyL6xmyXTl7OCBn754LjiC1UN3W_hYN4lv5IC/s1600-h/image%25255B22%25255D.png&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdqVydtFBG7_b7PsVKjXYJsR3MTBdBV2rGXYaiYt8r-PLBlmeKas3Za9iahOZ20j6-ZHASmPb_vULt9EJF0RoU9pf41s6fB7jwJ9iw-NWFkWvMu33Eab3Ag4QaSD5q0E5f6dp588_hnAwc/?imgmax=800&quot; width=&quot;339&quot; height=&quot;360&quot; /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;8. Set up IP Address on Client machine&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXxOQRYas7ButXIh0EmVLIUnDJi6f5lShj_OJebRGoZpR9oC5TlcJG6QABDcoKsE6FeVWesM4KWBuG3RFT9K0UPTOrlmKONV_hTkKD-Jj048K8YlRz1YMX_bEaseo5ZsUrkroVoHsbPz-X/s1600-h/image%25255B27%25255D.png&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRT6nR6m9Zmwbiqi6kgQc3q44fs16f_VbgfW62Ly6PWGCKXB0zOtdULsc53kxXxTpUUnkpNyNmaEKxDwjtB6Rdqva4kzawGmDynVSgSotJpBh7pudksQ3T-dVOPPkzQOcVBdW2kLQqE1sj/?imgmax=800&quot; width=&quot;338&quot; height=&quot;382&quot; /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;9. Create a domain user for client machine in Domain Controller&lt;/p&gt;  &lt;p&gt;To allow domain user as local admin, &lt;a href=&quot;http://publib.boulder.ibm.com/infocenter/tivihelp/v4r1/index.jsp?topic=%2Fcom.ibm.tpc_V33.doc%2Ffqz0_t_granting_admin_privileges_domain_account.html&quot; target=&quot;_blank&quot;&gt;please visit this link&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;10. Register client machine in domain controller which is defined in Step 6, then input user name/pwd defined in Step 9&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLcY0BoQETYdeyJwHM8oHI298kd5aJnkIdhyphenhyphen_hAB_orptwM_uc9W7VzUGa1d453khfzaGe-9SlvJMFZ0puJGM1jqYaWSGoF0Fu2Px6bOhUiENvCTi95Zq5eSH8Dl3abk3KoSzg3seHrrmu/s1600-h/image%25255B31%25255D.png&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieg6xG2fHFXlGkRJx4GXESqNTJ_chP4W5e4717J2r7Zal618M6TBVsAp1sjvYkBJl_R4LjcVvtYCQQGnFrA2gCCpa9c0ftSEt1TFeR8e_dFP_iV-uetNN6wqTjLt9tFDCCJngXHVrUpFCX/?imgmax=800&quot; width=&quot;302&quot; height=&quot;360&quot; /&gt;&lt;/a&gt;&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://dbaknowledge.blogspot.com/feeds/3661124442813248755/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbaknowledge.blogspot.com/2012/10/create-virtual-active-directory-domain.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/3661124442813248755'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/3661124442813248755'/><link rel='alternate' type='text/html' href='http://dbaknowledge.blogspot.com/2012/10/create-virtual-active-directory-domain.html' title='Create a Virtual Active Directory Domain Controller with VirtualBox'/><author><name>Richard Trương</name><uri>http://www.blogger.com/profile/04936460665153762540</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWCu2JfmfS1EpmWouwb5HaKbyXRgHuYtX8_caCMKjBFpENi-6h7xaqVRo7I5OaeUjaw2y9c0YwOCetqEFZd7_kzNFmpuOZmjIE-EAY8B_W74Z5Wl2O5dT1jI8ZDhbCQ/s220/Image002.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzBjzB6OunhzhbqytdHI8Kvh4lnLHBrVAe7nxDyTU_KiW9-oOFnXfFnIVben4MFPdqGLd0gQTF9OMMfRQ67Sz3V_1ZyTrns82cxs84T423wL6-w71PQoOfWtLyrTCjSJCM5QcbObsLX6VJ/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1948920108711213708.post-5423782824020730791</id><published>2012-10-09T08:34:00.001-07:00</published><updated>2012-10-09T08:38:03.548-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="DBA Tasks"/><category scheme="http://www.blogger.com/atom/ns#" term="linked server"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2005"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2008"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server Tip"/><category scheme="http://www.blogger.com/atom/ns#" term="T-SQL"/><title type='text'>Create SQL Server linked server to PostgreSQL database</title><content type='html'>&lt;p&gt;1. Download ODBC Driver at this address &lt;a title=&quot;http://www.postgresql.org/ftp/odbc/versions/msi/&quot; href=&quot;http://www.postgresql.org/ftp/odbc/versions/msi/&quot;&gt;http://www.postgresql.org/ftp/odbc/versions/msi/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Choose the suitable version with your PostgreSQL database. I’m using PostgreSQL 9, so I chose latest version. (^_^)&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGlwtT5lvysMeVBNRCqBXxRJCE3a9ixuj1Em0pYRsKHy28vwl-7zOikSVbTyAnUVrDKQJRt2YGvOo0wKPldoOwsK6EX3fY2jL7N7umNaSwqge0ykCIzGCUtTEL7NCkvYh4Xv1Iyn2O7oL0/s1600-h/image%25255B3%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiq5sp8S30PnQW3i5JF2zdlYknF9SDcBOxIluSX0qyN6rOoNGm0smJ-9tJlUey3wKV5xpI-6AxXiUpJyn7h7OJ-FzNBUGPixLeqjSc6dFRHZdJcDMi-HkMv-ECtBFzTCxjS5b4jTDO8TOyB/?imgmax=800&quot; width=&quot;437&quot; height=&quot;466&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;2. Install ODBC Driver for PostgreSQL&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjZki0bdqLXHYekUX5oGCRSpcalMSdAp02OuNOvm-y72VLugLo_5SetoKJl_uCfMHsBfTWuE8jKFl-zooiaJAWwiy3c3q_Zgu1431ZElNTEy4PApAa6wvDEKkQ08bzhnm5N3mZ9Y8SQ5vQ/s1600-h/image%25255B7%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgWt1fgO39yo1nSL76rDd9NlIe_35xyNrkjWQSy5Mu4LyTrWXJHIBNaQy29nbcoqdsXTnxo73uXjB4rzZTPW7yeIasMs8IXLY7oQdmHtBwLQ_LDhoWsyGEInMb2n5yD9NOT5imIEKM1Qra/?imgmax=800&quot; width=&quot;401&quot; height=&quot;50&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPg8BpekFWw7ZBwLOqZCeNqmSFziqD00Hewykg5Z1JJCSdDzZcRpQu6mP64KA0f76r1bT1wc7J_y9uIIrf97MSiQEL1_Jyt4Fptj6yuC9s6nWG_W5cTbh5h7C6DnljXPb09_7BuKWFHFeg/s1600-h/image%25255B11%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjba0rS-TflPweqaEhjFa9Ecp-OqZmflO-grXAkDo8CT6v7BJqK63jnoOYZSXElNp9p7hEU6WHkDmQyUkSoC3ozXsDfwWkQG1hfiAg8bbcuuYVDqyCuLyOeUh1oCtrkaZohNRo_eH6o81V3/?imgmax=800&quot; width=&quot;416&quot; height=&quot;327&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;3. Create connection to PostgreSQL database with ODBC Driver&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLWS_Obx81d12SNEL-fbJ9kQmHBA65_Ahcz2v_3MSYRc9CVo69jKD41gd3RQ-ilsUr2wFs6-LHCVsEL0oy4nu1SBFNLOhffzJoUFG_pgTSb_wg5P09GS1qnDV19yRFG4-j_A06hZyKr4XE/s1600-h/image%25255B19%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1Ty7_suMLdi722CBMW8sHuh2gO_9D-1Yf_ZwUQ9acjGLfKpQpskR9d01hn2rqpxZm1zxlurW2-eqoWEugk3gMZ3XN_ReiWF7FUs2TAq42hGMyKH5bEx47oEhSihi6ERKE8QP0rZlrLux1/?imgmax=800&quot; width=&quot;265&quot; height=&quot;138&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipVOzvjGGwb-Z1jzqLpc0oKJis8jzkKe-7WNWDuL9gmEDOBQqgUzTBsMzsxEv5sN-b8tm76YZEm0MSHN_UU1wkD5GOa1MH-lfOOP3HVxGvWl9CbtcUgtUeh9bn7Vl7sfJ42XeREBPBWyna/s1600-h/image%25255B15%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhinRXAqQy7Fj-i76aH3UWN0AQ8WFoDDJWVCmocLDGNPJy_YlorE4nlY_FS4091QM0nVEmHh5lJBw336vHPLwRD3He22Crl93eo1LMLSRrQifYdELQWV019jHSFKQceIb81ieryIuL5VqD2/?imgmax=800&quot; width=&quot;404&quot; height=&quot;336&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFRXKL7V7ISYoElFwdMyw5uxm44_qPpgYdENum1eQlMyFRZN14wF6AdHkoSYgUK-dHc9978yJGupYwOS9TqrnSybjrdFoV-3YWUBdTi-0GhZmm0ihWM6BkYrOfwVH2419-jiE8uu_G4GxJ/s1600-h/image%25255B23%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7QLu7kh3GjF805FzQgSC4nDFKbAtrnNgZirBbAZeP3y1wtofG95tE-koG0IYos5TM5EZiMIDJcSaiawItPPXE2mlqMnBVPwwQ75ocWj4rZ_C4bPYainXt-AY-QLMrEvLpLd_Dcco3QqeY/?imgmax=800&quot; width=&quot;409&quot; height=&quot;304&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhLQPrHmrV9OeqoUkINAlFKoN_3edKHiK8-rYSqzNY-KqLFbSdRd7w9pE5KEXPscB0vkMf5v6H-Q4XJKXh058O2P3g3bZG-9FoSsUKNdSh2xwNrEUp8FPGVC_2iMjn8hyD45J2sSRK8B8o/s1600-h/image%25255B27%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0gB9kwyNWX24tBlJvvMHuwo2K0TKb_0puicSPBb_ToeVYyX0Y3SugS6sb5YLUvYZMeqlSluN6-lcfcl5tGY-Gz2LElN0jPunZDCImEmXdifUeXay8Ym-QCn2qWkuFVDvS3bFwK6EK6NB8/?imgmax=800&quot; width=&quot;410&quot; height=&quot;234&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;4. Now, it’s time to create linked server to PostgreSQL database:&lt;/p&gt;  &lt;p&gt;You can create with GUI&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUyITISPcWLjfPHTHlkH4t3TqGFwS3hyxy2hrmZpzT8_2et4JXKzfNYJf6SeX7uRUL8sWSDda-52Kqa89oXHJVt6S5Au-PeKNGpoXFFhu1otAhZzIsJ6iZS5Q5W1xEOhNLZxNEsoQRYwke/s1600-h/image%25255B36%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3CyDNHVve_-O_p-Ea9mrz8uymjUo1bU8dvl1fjKrtfyzojIxgWw_0FS_CdPRpU3v0Nz3oqn_3kTBwsoO2PqYVYcEmHInNrRIeSFJbCCmu4z6r4tmz893_QduDX0l5_DNdQGmmJJow4UC8/?imgmax=800&quot; width=&quot;443&quot; height=&quot;379&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Or can create with scripts&lt;/p&gt;  &lt;p&gt;EXEC master.dbo.sp_addlinkedserver @server = N&#39;OPENERP&#39;, @srvproduct=N&#39;PostgreSQL&#39;, @provider=N&#39;MSDASQL&#39;, @datasrc=N&#39;OpenERP&#39;;&lt;/p&gt;  &lt;p&gt;GO   &lt;br /&gt;EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N&#39;OPENERP&#39;,@useself=N&#39;False&#39;,@locallogin=NULL,@rmtuser=NULL,@rmtpassword=NULL;&lt;/p&gt;  &lt;p&gt;GO&lt;/p&gt;  &lt;p&gt;Finally, you can query PostgreSQL database inside SQL Server&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSv31f0cibR5iK1WLcVRJntCRM6VfLCtoH2FsnhGHwkXGui2BG2deCRZgMyAj4p-eoZ1ivj9GPpbLsOd6SYCIvt6rDIJFKquzsu5g5orKMqGnpV9AEe0tZA1L-PBKeX0yZ4-NZUMPizl_Y/s1600-h/image%25255B31%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi97L6VXaZHi_GYUSUgZHge478XJK9pIbtjyzyCCiLQNxpFfXiDgD5fajjbrw6H4w62Ga9iX0Izz0wsJjmOufkP7HEuSn2glR8aNM8c_8SUlE3SLaI1GAFJi8LrL4eRXApnncAOt-BOF1tT/?imgmax=800&quot; width=&quot;367&quot; height=&quot;411&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;5. Verify the linked server&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiz4bxgJMwLe8hHRzmvSHaoDId_qhpD4TRSn7sv9joG5hXPd8uxDXVXMId8ThyphenhyphenDpVrbjTeNg7lP287uJHl6os9KPLi2k0n3zpsUYAiO3FlhLpKqLua9AsjM0Z0d1gON1lBkdLEp4WzU7CSl/s1600-h/image%25255B40%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfIn5Jw8a8icjadMBStELCv9wpuw7Tj6qFxXJN4k66pnfCtUg0BwBXgQ9n1EN8N7o3AXJKcSz9VZuy-lxq2WRYu2d88uMVNxDvZWmoVBYaxe1Br3Gq53v8oZoa2rBoAkBVaDgudArGAL02/?imgmax=800&quot; width=&quot;496&quot; height=&quot;232&quot; /&gt;&lt;/a&gt;&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://dbaknowledge.blogspot.com/feeds/5423782824020730791/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbaknowledge.blogspot.com/2012/10/create-sql-server-linked-server-to.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/5423782824020730791'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/5423782824020730791'/><link rel='alternate' type='text/html' href='http://dbaknowledge.blogspot.com/2012/10/create-sql-server-linked-server-to.html' title='Create SQL Server linked server to PostgreSQL database'/><author><name>Richard Trương</name><uri>http://www.blogger.com/profile/04936460665153762540</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWCu2JfmfS1EpmWouwb5HaKbyXRgHuYtX8_caCMKjBFpENi-6h7xaqVRo7I5OaeUjaw2y9c0YwOCetqEFZd7_kzNFmpuOZmjIE-EAY8B_W74Z5Wl2O5dT1jI8ZDhbCQ/s220/Image002.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiq5sp8S30PnQW3i5JF2zdlYknF9SDcBOxIluSX0qyN6rOoNGm0smJ-9tJlUey3wKV5xpI-6AxXiUpJyn7h7OJ-FzNBUGPixLeqjSc6dFRHZdJcDMi-HkMv-ECtBFzTCxjS5b4jTDO8TOyB/s72-c?imgmax=800" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1948920108711213708.post-6965065511205870589</id><published>2012-10-09T05:46:00.001-07:00</published><updated>2012-10-09T07:31:46.954-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="DBA Tasks"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2005"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2008"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server Tip"/><category scheme="http://www.blogger.com/atom/ns#" term="T-SQL"/><title type='text'>Query Excel spreadsheet on SQL Server 2008 64 bit with Linked Server</title><content type='html'>&lt;p&gt;For SQL Server 64 bit, if you use Microsoft.Jet.OLEDB.4.0, you may experience this issue:&lt;/p&gt;  &lt;p&gt;&lt;em&gt;OLE DB provider &#39;Microsoft.Jet.OLEDB.4.0&#39; cannot be used for distributed queries because the provider is configured to run in single-threaded apartment mode.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;To fix this, please follow the following:&lt;/p&gt;  &lt;p&gt;1. Download and install Microsoft Access Database Engine 2010 Redistributable at this address &lt;a title=&quot;http://www.microsoft.com/en-us/download/details.aspx?id=13255&quot; href=&quot;http://www.microsoft.com/en-us/download/details.aspx?id=13255&quot;&gt;http://www.microsoft.com/en-us/download/details.aspx?id=13255&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgc9eBxVBpL90by8xuMrBjm7G19AUUMkjzELhIvw8KZvqG5C4c-i8V6KOYDD3CQ0wNkkwE1DYfE-Xa-aSGndp3JFRSe820l3K8oWuTBSli7-9UNT7ZFTso2GkSGV_WOJHG3tGU39SezvR07/s1600-h/image%25255B3%25255D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhk2QOxQmY6qI5LOwucgiv6WPQc4Ef6rD_5aapM0Nq_1PQd-s4R2_GqXubg8hZldXhalAzPMJvypyW95GrbC-JKFy9uBx88mgN_oAcqTHjBbP_Pa3VfTbtLxEg1CuOxea4IjsZ4d4XQUscu/?imgmax=800&quot; width=&quot;531&quot; height=&quot;228&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;2. After installing, create a linked server to your Excel file&lt;/p&gt;  &lt;p&gt;EXEC master.dbo.sp_addlinkedserver @server = N&#39;EXCEL_LINKED_SERVER_NAME&#39;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; , @srvproduct=N&#39;Excel&#39;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; , @provider=N&#39;Microsoft.ACE.OLEDB.12.0&#39;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; , @datasrc=N&#39;C:\Your_Excel_File.xls&#39;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; , @provstr=N&#39;Excel 12.0&#39;;&lt;/p&gt;  &lt;p&gt;GO&lt;/p&gt;  &lt;p&gt;EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N&#39;EXCEL_LINKED_SERVER_NAME&#39;,@useself=N&#39;False&#39;,@locallogin=NULL,@rmtuser=NULL,@rmtpassword=NULL;&lt;/p&gt;  &lt;p&gt;GO&lt;/p&gt;  &lt;p&gt;3. Run OPENQUERY to get data from your Excel file&lt;/p&gt;  &lt;p&gt;SELECT * FROM OPENQUERY(EXCEL_LINKED_SERVER_NAME,&#39;SELECT * FROM [Sheet1$]&#39;)&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://dbaknowledge.blogspot.com/feeds/6965065511205870589/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbaknowledge.blogspot.com/2012/10/query-excel-spreadsheet-on-sql-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/6965065511205870589'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/6965065511205870589'/><link rel='alternate' type='text/html' href='http://dbaknowledge.blogspot.com/2012/10/query-excel-spreadsheet-on-sql-server.html' title='Query Excel spreadsheet on SQL Server 2008 64 bit with Linked Server'/><author><name>Richard Trương</name><uri>http://www.blogger.com/profile/04936460665153762540</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWCu2JfmfS1EpmWouwb5HaKbyXRgHuYtX8_caCMKjBFpENi-6h7xaqVRo7I5OaeUjaw2y9c0YwOCetqEFZd7_kzNFmpuOZmjIE-EAY8B_W74Z5Wl2O5dT1jI8ZDhbCQ/s220/Image002.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhk2QOxQmY6qI5LOwucgiv6WPQc4Ef6rD_5aapM0Nq_1PQd-s4R2_GqXubg8hZldXhalAzPMJvypyW95GrbC-JKFy9uBx88mgN_oAcqTHjBbP_Pa3VfTbtLxEg1CuOxea4IjsZ4d4XQUscu/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1948920108711213708.post-3510107873441506264</id><published>2012-10-08T08:11:00.000-07:00</published><updated>2012-10-08T08:11:02.928-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="DBA Tasks"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Tips"/><title type='text'>Get current queries executing on PostgreSQL</title><content type='html'>&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; datname &quot;Database Name&quot;&lt;br /&gt;
&amp;nbsp;, usename &quot;User Name&quot;&lt;br /&gt;
&amp;nbsp;, procpid &quot;Process ID&quot;&lt;br /&gt;
&amp;nbsp;, client_addr &quot;Client IP Address&quot;&lt;br /&gt;
&amp;nbsp;, waiting &quot;Is waiting&quot;&lt;br /&gt;
&amp;nbsp;, query_start &quot;Start Time&quot;&lt;br /&gt;
&amp;nbsp;, current_query &quot;Query Text&quot;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; pg_stat_activity;</content><link rel='replies' type='application/atom+xml' href='http://dbaknowledge.blogspot.com/feeds/3510107873441506264/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbaknowledge.blogspot.com/2012/10/get-current-queries-executing-on.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/3510107873441506264'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1948920108711213708/posts/default/3510107873441506264'/><link rel='alternate' type='text/html' href='http://dbaknowledge.blogspot.com/2012/10/get-current-queries-executing-on.html' title='Get current queries executing on PostgreSQL'/><author><name>Richard Trương</name><uri>http://www.blogger.com/profile/04936460665153762540</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWCu2JfmfS1EpmWouwb5HaKbyXRgHuYtX8_caCMKjBFpENi-6h7xaqVRo7I5OaeUjaw2y9c0YwOCetqEFZd7_kzNFmpuOZmjIE-EAY8B_W74Z5Wl2O5dT1jI8ZDhbCQ/s220/Image002.jpg'/></author><thr:total>0</thr:total></entry></feed>