I get an error “could not write block … of temporary file no space left on device …” using postgresql

前端 未结 3 1246
闹比i
闹比i 2021-02-19 04:35

I\'m running a really big query, that insert a lot of rows in table, almost 8 million of rows divide in some smaller querys, but in some moment appear that error : \"I get an er

3条回答
  •  野的像风
    2021-02-19 05:16

    Inserting data or index(create) always needs temp_tablespaces, which determines the placement of temporary tables and indexes, as well as temporary files that are used for purposes such as sorting large data sets.according to your error, it meant that your temp_tablespace location is not enough for disk space .

    To resolve this problem you may need these two ways:
    1.Re-claim the space of your temp_tablespace located to, default /PG_DATA/base/pgsql_tmp

    2. If your temp_tablespace space still not enough for temp storing you can create the other temp tablespace for that database:

    create tablespace tmp_YOURS location '[your enough space location';
    alter database yourDB set temp_tablespaces = tmp_YOURS ;
    GRANT ALL ON TABLESPACE tmp_YOURS to USER_OF_DB;
    

    then disconnect the session and reconnect it.

提交回复
热议问题