<b>Tablespace in PostgreSQL</b></figcaption></figure><p id="e6e7"><b>Types of tablespaces:</b></p><ul><li><b>1.Default tablespace</b></li><li>when we are creating DB without specifying tablespace location by default objects are stored
into pg_default
1.pg_default → all the user related objects are stored here
2.pg_global → all the system related objetcs are stored here</li><li><b>2. Non-Default tablespace</b>
The DB objects are stored into specific location/directory Which was defined by user.</li></ul><p id="7986"><b>What are the advantages of using non-default tablespace?</b></p><p id="d9f2">1.logically maintaining the objects on specific directory
2.better I/O retention
3.Maintenance activities (like to take backup specific volume backup)</p><p id="d781"><b>To define a tablespace</b></p><div id="c707"><pre><span class="hljs-keyword">CREATE</span> <span class="hljs-keyword">TABLESPACE</span> tbspace1 <span class="hljs-keyword">LOCATION</span> <span class="hljs-string">'/u01/postgresql/data'</span>;</pre></div><p id="7f9c"><b>Note:</b></p><ul><li>The
Options
location must be an existing, empty directory that is owned by the PostgreSQL operating system user. All objects subsequently created within the tablespace will be stored in files underneath this directory.</li><li>Creation of the tablespace itself must be done as a database superuser, but after that you can allow ordinary database users to use it</li></ul><p id="7a6e"><b>To create DB with tablespace:</b></p><div id="31c2"><pre><span class="hljs-keyword">CREATE</span> <span class="hljs-keyword">DATABASE</span> Sports <span class="hljs-keyword">TABLESPACE</span> tbspace1;</pre></div><p id="bc64"><b>To view the tablespace:</b></p><ul><li>Here this system catalog to view the existing tablespace .</li></ul><div id="8592"><pre><span class="hljs-keyword">SELECT</span> * <span class="hljs-keyword">FROM</span> pg_tablespace;</pre></div><p id="7c7f"><b>List Command To View Tablespace:</b></p><ul><li>The below meta-command is also useful for listing the existing tablespaces.</li></ul><div id="5abd"><pre><span class="hljs-string">\db</span></pre></div></article></body>
Dr Michael Heng PBM — A Top 50 Global Thought Leader & Influencer on CSR 2022
Illustration by www.thinkers360.com — Dr Michael Heng (№14) is boxed in redScreen captured from Youtube by www.thinkers360.com
Dr Michael Heng PBM created a renewable energy value integrator company with a sustainability theme. In response to the inconvenient truth of global climatic implosion, Energycorp Global was created from the vision of a brave new world with an abundant energy future where one and all would have access to the clean and limitless natural powers around us.
Illustration by Author
We embrace a natural partnership with the environment to bridge the nexus between sustainability and profitability to make them our twin business goals. We encourage new value innovations to harness renewable natural energy and deploy technologies in clean, cost-effective alternative energy methods.
He was conferred the CSR Leadership Award 2012 on World CSR Day 2012 in recognition of his contributions which have made a difference to people and the community. He also received a Global CSR Leadership Award at the Global CSR Summit 2012. And at the Philip Kotler World Marketing Summit 2013, he received the CSR Leadership Excellence Award. He was an Advisor to World CSR Congress from 2014–2017.
2012 Photo by Author
On National Day 2002, Dr Michael was recognised on the National Day 2002 Honours List and awarded the Public Service Medal (PBM) for community service by the President of Singapore.
Dr Michael Heng PBM is recognized as an influential thought-leader, thinker and writer on human capital, venture creation, business strategy, politics, sustainability and CSR.
Illustration by www.thinkers360.com
Thinkers360 is the largest and premier marketplace for B2B thought leaders and influencers with the world’s foremost experts on cutting-edge business, technology, and sustainability topics.
Please enjoy my recent Articles.
You can also subscribe to my stories and social media posts via your email. Enjoy more interesting Articles by signing up to Medium here:
Please become a Medium Member to directly support me and other writers you read. You’ll also get full access to every story on Medium. You can also receive an email whenever I publish a story on Medium.