Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m1bU9-0001Fi-0r for pgsql-performance@arkaria.postgresql.org; Thu, 08 Jul 2021 21:23:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m1bU7-00030R-TY for pgsql-performance@arkaria.postgresql.org; Thu, 08 Jul 2021 21:23:03 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m1bU7-00030J-L9 for pgsql-performance@lists.postgresql.org; Thu, 08 Jul 2021 21:23:03 +0000 Received: from mout.perfora.net ([74.208.4.197]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m1bU4-0001fJ-QZ for pgsql-performance@postgresql.org; Thu, 08 Jul 2021 21:23:02 +0000 Received: from [192.168.1.165] ([72.205.28.227]) by mrelay.perfora.net (mreueus004 [74.208.5.2]) with ESMTPSA (Nemesis) id 1MfHtf-1lYKTI15tz-00gpMG for ; Thu, 08 Jul 2021 23:22:59 +0200 To: PostgreSQL Performance From: MichaelDBA Subject: temporary file log lines Message-ID: Date: Thu, 8 Jul 2021 17:22:56 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 PostboxApp/7.0.48 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Provags-ID: V03:K1:yFc1rJCu/WqM4gUpCn0JFla1dp6MCfrDcSKi4k3ZwsDje6hU9HD dntpwFVqzEYwL+oD932psOBRN0Sr7sOPc+F06dkmCdvVF0nD3GQoNOlwiwfcvK+2bMAJY/d hXpuzVsm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ko6reDVy4g= List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi all, I got a question about PG log lines with temporary file info like this: case 1: log line with no contextual info 2021-07-07 20:28:15 UTC:10.100.11.95(50274):myapp@mydb:[35200]:LOG: temporary file: path "base/pgsql_tmp/pgsql_tmp35200.0", size 389390336 case 2: log line with contextual info 2021-07-07 20:56:18 UTC:172.16.193.118(56080):myapp@mydb:[22418]:LOG: temporary file: path "base/pgsql_tmp/pgsql_tmp22418.0", size 1048576000 2021-07-07 20:56:18 UTC:172.16.193.118(56080):myapp@mydb:[22418]:CONTEXT:  PL/pgSQL function memory.f_memory_usage(boolean) line 13 at RETURN QUERY There are at least 2 cases where stuff can spill over to disk: * queries that don't fit in work_mem, and * temporary tables that don't fit in temp_buffers Question, if log_temp_files is turned on (=0), then how can you tell from where the temporary log line comes from? I see a pattern where work_mem spill overs have a CONTEXT line that immediately follows the LOG LINE with keyword, temporary. See case 2 above. For other LOG lines with keyword, temporary, there is no such pattern. Could those be the ones caused by temp_buffer spill overs to disk?  case 1 above. I really want to tune temp_buffers, but I would like to be able to detect when temporary tables are spilling over to disk, so that I can increase temp_buffers. Any help would be appreciated. Regards, Michael Vitale