I have been playing a bit with a 9.1 instance as we plan for some new data.
I created a database in a tablespace:
CREATE DATABASE foo2test2 TEMPLATE template1 TABLESPACE data1;
I set my default tablesapce and create a dummy table with a small amount of data:
SET default_tablespace = data1;
CREATE TABLE testx(d_id serial not null,d_text text,d_val integer);
CREATE INDEX testx ON dingbats (d_id);
INSERT INTO testx VALUES (22,'A test value');
INSERT INTO testx VALUES(1011,'Another test value');
This created two new directories in my data1 tablespace:
-bash-3.2$ ls -lrt
total 40
drwx------ 2 postgres postgres 4096 Jan 16 10:13 1262754833
drwx------ 2 postgres postgres 4096 Jan 17 09:40 1262752970
drwx------ 2 postgres postgres 4096 Jan 26 19:08 1848319667
drwx------ 2 postgres postgres 4096 Jan 27 11:30 1262751111
drwx------ 2 postgres postgres 4096 Jan 27 15:12 979045183
drwx------ 2 postgres postgres 4096 Jan 31 16:37 3891138239
drwx------ 2 postgres postgres 4096 Jan 31 17:45 3891099801
drwx------ 2 postgres postgres 4096 Feb 6 10:14 941593524
drwx------ 2 postgres postgres 4096 Feb 6 14:38 1577008279 <-- the database itself
drwx------ 2 postgres postgres 4096 Feb 6 14:38 12698 <-- my little table
If I drop the database as a whole this 12698 directory is left in place but is empty.
If I drop just the table the directory is left with 0 length files:
-bash-3.2$ ls -lrt 12698
total 0
-rw------- 1 postgres postgres 0 Feb 6 14:49 1577013889
-rw------- 1 postgres postgres 0 Feb 6 14:49 1577011574
-rw------- 1 postgres postgres 0 Feb 6 14:49 1577011572
-rw------- 1 postgres postgres 0 Feb 6 14:49 1577011568
Are these safe to delete these files ?
Is it safe to delete the directory itself ?
Thanks,
Greg Williamson
DBA
Powerreviews.com