Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I suddenly found found my postgresql out of space. It's a tmp instance running on ram disk. Limited space (around 800M) allowed. Data are not actually stored on it, all table will be dropped after some calculation done.

I checked the folder and found tons of data under base folder:

$ du -h
6.0M    ./pgsql_tmp
706M    ./16384
6.0M    ./12780
6.0M    ./12772
6.0M    ./1
730M    .

My question is: what is inside that folder? Any change I can clean it out?

share|improve this question

migrated from stackoverflow.com Aug 17 '13 at 1:48

This question came from our site for professional and enthusiast programmers.

1 Answer 1

This folder is where PostgreSQL keeps all the data you insert on your databases (see PostgreSQL Database File Layout). Each sub-directory is used by a database in you cluster, the files inside them are the actual data of the relations (tables, indexes, sequences, ...).

So, your answer is no! You cannot clean it out, and if you do so, you will lost your data and PostgreSQL server will stop with panic.

Basically, only files inside pg_log directory (if any) can be removed. A side note, do not, ever remove files inside pg_xlog, it is not useless as the name may suggest (you didn't ask for it, but I saw happening sometimes).

Tips to solve your problem:

There are some things you can do to use less space in your case, like:

  1. Use another (not in RAM) tablespace for some tables or databases;
  2. Run a VACUUM FULL. But notice that you will need some temporary space to do that, so you can't do it while you are really out of space;
  3. Move pg_xlog to another location;
  4. As you said it is a temporary database, try to remove some indexes that are not been used.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.