Andreas Joseph Krogh
2014-10-08 23:27:48 UTC
Hi all. Â I'm having a database, called "apeland", which at first (when
created) was in the default-tablespace (in $PGDATA), then I moved it with the
commands: Â # create tablespace apeland location
'/home/andreak/programs/postgresql/9.3.5/tablespaces/apeland'; CREATE TABLESPACE
 Check space-usage before moving: $ du -hs data/ tablespaces/
59MÂ Â Â Â data/
27MÂ Â Â Â tablespaces/ Â Move the database to new tablespace # alter database
apeland set tablespace apeland; ALTER DATABASE Â Check space-usage after moving:
$ du -hs data/ tablespaces/
52MÂ Â Â Â data/
34MÂ Â Â Â tablespaces/ Â Â Then I created this table: # create table files(data
oid);
CREATE TABLE Â Insert this file: $ du -hs origo-war-01-14-01.20.war
130M   origo-war-01-14-01.20.war  # insert into files(data)
values(lo_import('/home/andreak/data/origo-war-01-14-01.20.war'));
INSERT 0 1 Â Check space-usage: $ du -hs data/ tablespaces/
164MÂ Â Â data/
208MÂ Â Â tablespaces/ Â Now - why is so much extra space used in $PGDATA? Is
there a way to reclame it? Was the "apeland"-db moved completely or is there
lots dangeling left in PGDATA? Â Thanks. Â -- Andreas Joseph Krogh CTO / Partner
- Visena AS Mobile: +47 909 56 963 ***@visena.com
<mailto:***@visena.com> www.visena.com <https://www.visena.com>
<https://www.visena.com>
created) was in the default-tablespace (in $PGDATA), then I moved it with the
commands: Â # create tablespace apeland location
'/home/andreak/programs/postgresql/9.3.5/tablespaces/apeland'; CREATE TABLESPACE
 Check space-usage before moving: $ du -hs data/ tablespaces/
59MÂ Â Â Â data/
27MÂ Â Â Â tablespaces/ Â Move the database to new tablespace # alter database
apeland set tablespace apeland; ALTER DATABASE Â Check space-usage after moving:
$ du -hs data/ tablespaces/
52MÂ Â Â Â data/
34MÂ Â Â Â tablespaces/ Â Â Then I created this table: # create table files(data
oid);
CREATE TABLE Â Insert this file: $ du -hs origo-war-01-14-01.20.war
130M   origo-war-01-14-01.20.war  # insert into files(data)
values(lo_import('/home/andreak/data/origo-war-01-14-01.20.war'));
INSERT 0 1 Â Check space-usage: $ du -hs data/ tablespaces/
164MÂ Â Â data/
208MÂ Â Â tablespaces/ Â Now - why is so much extra space used in $PGDATA? Is
there a way to reclame it? Was the "apeland"-db moved completely or is there
lots dangeling left in PGDATA? Â Thanks. Â -- Andreas Joseph Krogh CTO / Partner
- Visena AS Mobile: +47 909 56 963 ***@visena.com
<mailto:***@visena.com> www.visena.com <https://www.visena.com>
<https://www.visena.com>