PostgreSQL: Create or Change default Tablespace of Table to Migrate on SSD

My Problem:

In our Windows based PostgreSQL Server, We were facing Hard disk related performance issue. Later, we decided to move some of our main tables on SSD Hard Disk (Solid State Drive).

The Performance of SSD Hard drive is 10 times faster than normal HDD Disk.

The Solution:

First, We have to create new Tablespace on SSD disk. The pg_default is a default Tablespace in PostgreSQL. A Tablespace contains all Table information and data.

In PostgreSQL, We can create a new Tablespace or we can also alter Tablespace for existing Tables.
We can perform this exercise using both PGAdmin tool and Script.

In below example, I am creating and changing Tablespace using script.


Create a sample Tablespace:

Create a new table under newly created Tablespace:

We can also change default Tablespace:
After this change, all your newly table can create under dbrnd Tablespace.

Create one more table and test this:

Change Tablespace of existing Table:

Check all Tablespace of your PostgreSQL Database Server:

Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

If you like this post, then please share it with others.
Please follow, I will share my experience towards the success of Database Research and Development Activity.

I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.

More from

Leave a Reply

Be the First to Comment!

Notify of