could not write to hash-join temporary file: No space left on device

Yousuf Sultan picture Yousuf Sultan · Apr 13, 2015 · Viewed 16k times · Source

I am executing PostgreSQL functions to update a table which has a huge amount of data and the update happens for about 100000 records everyday. During the update I get an error saying:

"could not write to hash-join temporary file: No space left on device"

I have not really been able to get something useful to overcome this error. I got something where it says to SET a temporary table spaces. But I was not able to find how do I create a temporary table space where the data will be stored during the executing of the update procedure.

Answer

Vao Tsun picture Vao Tsun · Apr 13, 2015
  1. SQL> create tablespace temp_tbs location '/some/big/disk';
  2. change temp_tablespaces = 'temp_tbs' in postgresql.conf.
  3. select pg_reload_conf();
  4. enjoy