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. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 questions are:

  • What is inside that folder?
  • Any chance I can clean it out?
share|improve this question

migrated from Aug 17 '13 at 1:48

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

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 lose your data and PostgreSQL server will stop with a panic.

Basically, only files inside the 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


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