The PGSQL_WORK_MEM variable specifies the amount of memory to be used by internal sort operations and hash tables before switching to temporary disk files. .


The right value for this variable depends in part on the available RAM on the server where your site is running.

See What are the right PostgreSQL settings for my site? for values recommended by CollabNet.