Moving data around in PostgreSQL

My database is quickly filling up my 256GB SSD. So I needed to move some data.

First, I need to create a directory to store the data and give it the appropriate permissions:

cd /Volumes/Vertex3
mkdir data
sudo chown _postgres:_postgres data

Then I go to PostgreSQL, create a tablespace, then move data over to it:

CREATE TABLESPACE vertex3 LOCATION '/Volumes/Vertex3/data';
ALTER TABLE crsp.dsf SET TABLESPACE vertex3;

Voila! AS you can see below, PostgreSQL moves the data around behind the scenes.

ssd_move

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

One Response to Moving data around in PostgreSQL

  1. Pingback: TIP: Moving data around in PostgreSQL « DbRunas – Noticias y Recursos sobre Bases de Datos

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s