pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Moreno Andreo <moreno.andreo@evolu-s.it>
To: PostgreSQL mailing lists <pgsql-general@postgresql.org>
Subject: New tablespace: just an advice
Date: Mon, 15 Oct 2018 14:48:07 +0200
Message-ID: <cfb7a3f5-2cf6-59a5-2fd2-5b27b3b4bae1@evolu-s.it> (raw)

Hi everyone!

My space on my Debian 8 DB server is running a bit low (10% left of a 
2TB disk), so, since it's not possible to have a primary MBR disk with 
size > 2 TB, I decided to create another disk and map it on the server, 
creating another tablespace on it and moving databases aross disks to 
balance disk usage.

After creating a test server on this night's production server image, I 
created a folder and assigned ownership to postgres user
mkdir /newdisk/tbsp_new
chown -R postgres /newdisk/tbsp_new

then created new tablespace
create tablspace tb2 location '/newdisk/tbsp_new';

and moved a database
alter database db set tablespace tb2;

As you can see a flat, basic tablespace with no customizations.
I just ran a VACUUM FULL on the cluster before creating tablespace.
After the ALTER DATABASE command ran successful, I checked disk space 
(df -h) and saw some more free space on primary disk, and the same space 
occupied on new disk. Just what I needed.
I psql'd in the cluster with the user's username connecting on the 
database just migrated, and was able to SELECT and UPDATE (not tried 
INSERTing).

Now, 2 questions.
1. Is it all or do I need to adjust something else about permissions, 
indexes, vacuuming, etc...?
ALTERing the database namespace means copying its physical files to new 
directory, but is it applied to all objects (indexes, triggers, etc)?

2. What will happen to who tries to access the database while it's being 
moved from one tablespace to another?

Thanks in advance,
Moreno.





view thread (3+ messages)  latest in thread

Message-ID: <cfb7a3f5-2cf6-59a5-2fd2-5b27b3b4bae1@evolu-s.it>
Permalink:  ../cfb7a3f5-2cf6-59a5-2fd2-5b27b3b4bae1@evolu-s.it/
Also on:    postgresql.org/message-id/cfb7a3f5-2cf6-59a5-2fd2-5b27b3b4bae1@evolu-s.it

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: moreno.andreo@evolu-s.it
  Subject: Re: New tablespace: just an advice
  In-Reply-To: <cfb7a3f5-2cf6-59a5-2fd2-5b27b3b4bae1@evolu-s.it>
  References: <cfb7a3f5-2cf6-59a5-2fd2-5b27b3b4bae1@evolu-s.it>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox