PostgreSQL: work_mem tuning and log_temp_files
work_mem is used for sorts, aggregates, and a few other operations. This is non-shared memory, which is allocated per-operation (one to several times per query); the setting is used to put a limit on the amount of RAM any single operation can grab before being forced to disk through temp files. If it is been forced to the disk that can cause a bad execution time
With PostgreSQL 8.3 a new variable got added names as “log_temp_files” that enables/disables whether temporary files are logged when deleted. These temp files can be created for sorts, hashes, and temporary query results.
log_temp_files can be used to better tune the values for work_mem after analyzing the usage of temp files (from the db server logs) for a certain query so that you can minimize or nullify the temp file usage by raising the values for work_mem.
-Shoaib (shoaibmir[@]gmail.com)

To be honest with you, I have never written any comments or posts in the Internet. This is my first time. Why did I decide to post? The answer is simple – all information here is so amazing and interesting that it’s hard to imagine someone wouldn’t comment it.
Comment by rudy1133 — April 11, 2008 @ 3:21 pm