What do I do if the "ERROR: temporary file size exceeds temp_file_limit (1024kB)" error message is displayed when I run queries on my ApsaraDB RDS for PostgreSQL instance?

更新时间:
复制 MD 格式

Your query was canceled because it generated a temporary file larger than the temp_file_limit set for your RDS instance. When the temporary file size reaches the limit, PostgreSQL aborts the query.

The default value of temp_file_limit on ApsaraDB RDS for PostgreSQL is {DBInstanceClassMemory/1024} — the instance's memory capacity. For more information about the parameter, see temp_file_limit in the PostgreSQL documentation.

Increase temp_file_limit

Choose the method that fits your situation:

Global modification — applies to all sessions permanently. Use this when the limit is consistently too low for your workload.

Log on to the ApsaraDB RDS console and modify temp_file_limit. For detailed steps, see Modify the parameters of an ApsaraDB RDS for PostgreSQL instance.

Warning

Avoid setting temp_file_limit to -1 (unlimited) or an excessively large value. During complex queries, unrestricted temporary file growth can exhaust disk space and affect all databases on the instance.

Session-level modification — applies only to the current connection. Use this to unblock a specific query without changing the instance configuration permanently.

Log on to your RDS instance and run:

SET temp_file_limit = '1GB';